musichack – hacking audio…one sample at a time

Replacing Sections of Audio for Video

attention: musichack is moving! that’s right, we’re moving out of the wordpress apartment and in to our own server…sorta (ok, so I run other domains..but hey, i pay for the damn thing)…but I’ve installed wordpress-mu and will be moving the entire ordeal there. the address is also going to change…rather than being a subdomain…we now have a domain. http://www.musichack.org will be where you’ll find the new musichack..with all the old content and tons of new stuff. check the main page for the final notification about the move, also, the notice about “Gold Wave Editor” has been removed since it appears they have changed names…but still be on the lookout for the editor with the space in the name…that looks nothing like my screen shots.

To attempt to get back in the swing of things, I’m going to explain a rather simple concept that can get really difficult..and it’s editing audio for video files.

There really isn’t too much to consider if you’re good with video editing already, you probably know how to sync and audio and video file up already. But what I’m talking about is audio editing for the non-video professional. Let’s say you need to censor something, or you want to replace part of the audio..I’m going to explain a few simple tricks and tactics so that, hopefully, you’ll wind up with a good file.

The important thing to remmeber when editing an audio file is you DO NOT want to modify the length of your file…espically at the begnning of the file. If you shorten the file and attempt to resync it into a video file…a simple editor will sync up the audio and video streams at the beginning of each…and if you’ve deleted the first 10 seconds of your audio file…your audio will begin 10 seconds early. So let’s get to a few simple tricks on how to solve this problem and make the files come out right using Goldwave.

For this tutorial I’m going to outline a procedure I did for a Goldwave forum memeber. He had a video shot with a camcorder and wanted the original audio track with the the ambience noise and music to be replaced with JUST the music. Not so hard of a task really, just find the audio and sync it up…however, we’re dealing with a video source and need to make sure that after we replace the music, everything still syncs up. The best way to do this is with a multitrack editor…but we really don’t need one, so here’s how we do it.

The first thing we need to do is open the original file in Goldwave and see what we’re dealing with.

replace1

Now, upon listening to the file we can hear where there’s a lot of unwanted noise and the typical hallowy sound of the music as it was recorded in an auditorium and played back on a PA system. Now, per the member’s instructions, there was a tone that was played before the track was started at the venue; basically an audible cue. So, we’ll open the mp3 as normal (screenshot omitted) and give it a listen. We can hear the audible tone followed by the music about 3.1 seconds later.

Now, instinct should tell you that all we need to do is find that tone right? Of course! However, we have a major issue. The sound on the PA for the most part isn’t picked up by the camera that well and the audience ambience drowns it out, and since it’s a simple synthizied piano note, it’s not very long and powerful and gets entirely drowned out by the sound, however, the song has a rather sudden start and we are able to hear that in the file. However, I still want to find out WHERE that tone is, just to make sure I’m at the actual starting point. So what we’ll do is load up the mp3 of the track and find out where it should be.

replace2

Thanks to the lovely fact we can highlight a portion of audio and get the length of selected audio, we find the tone is about 3 seconds before the start of the song.

replace3

What I’ve done here is selected a portion of audio right before the music begins. Now, it’s difficult to see WHERE the song begins exactly because of the noise and the fact someone is yelling in rather close proximity to the camcorder (represented in the right channel by the fact it’s waveform is a bit “fatter” than the one on the left). Finding the exact positioning is going to be a bit tough, but I *THINK* I see something that’ll help.

replace4

When we zoom in Horizontally and Vertically, we can see right around 9 seconds where there is an attack in the wafeform…espically in that right channel. At first I thought given the fact the song starts off with an acoustic guitar, this is the type of thing you’d expect. So I listened to that section, and yes, the startpoint is in that window view…but it’s not at 9 seconds like i thought. When selecting from the beginning to the window to just before 9.1 seconds and looping, we don’t hear any guitar, just the voice in the auidence (and I mean no disrespect becuase I’m sure the woman is a kind respectable person, but honestly, when you’re doing audio work and listen to segments that loop, ANYTHING will get annoying as crap). Since the voice is so loud in the right channel, what we’re going to do is go to Efect -> Stereo -> Channel Mixer and select mono-left. This will “bounce” the left channel in to the right as well.

replace5

However, right around 9.1 IS where the guitar and track start, and we can see where the waveform (or in this case, average envelope) changes. I can’t explain exactly what I’m showing you, but if you look at the area before the selection and after, you might see what I’m talking about. Reading and identifying waveforms are difficult. I’ve already selected the starting point in this screenshot…here’s where it gets tricky.

We need to remmeber we’re editing audio FOR video…and we’re not really editing the video. We need to make sure EVERYTHING syncs up. As it is, output.wav, which is our video’s audio track, is in what i call a “pre-synced” state, and we need to keep it that way.

replace6

What we have here is an overall zoom out of the output file. The selected area starts at the begnning and goes to 9.107 seconds, which is where we determined the song starts. Here’s where I say it gets tricky. Normally, when you want to dispose of as section of audio, you’d hit delete, HOWEVER…we can’t do that here. If we were to hit delete, this would cause the begnning of the file to be offset by 9 seconds with the video…so what we’re going to do is silence the audio by going to Edit -> Mute. So what we have now is 9 seconds of silence..and then the original track where the music begin.

replace7

So here we are…the real deal. 9.107 seconds in to the file is where the music starts. All we have to do now is jump to the music file, select the music, and we can paste it in at 9.107 seconds. There’s a reason I say paste, and this applies only to this specific video project…we’re only worried about getting the music in sync…the rest of the audio is “trash”. So we paste the music file at 9.107 seconds and then after the music is over…we can DELETE the remaining audio. Yes, this will cause the video to be longer than the audio…however…as i stated, we’re only worried about getting the music sync’d up, that’s it…whatever is after the music, we’re not worried about…trashing the file means the audio ends early, however, the video stream will continue playing in the final project.

replace8

Now, we need to find out how it compares to the original. Normally, one would take a multitrack editor and layer them, see how they do, we don’t exactly have that ability in Goldwave, so here’s another trick do do that. *After* we save the file, what we’re going to do is mix it to mono using Channel Mixer’s Average, we’re also going to reopen the original video file (if you haven’t saved over it) and average it out to mono. We go to one of our files, either the finished or the original and copy it to the clipboard using Edit -> Copy. Once it’s copied to the clipboard we’re going to go Using either Edit -> Channel (or the Shift+Ctrl shortcuts), we select one of the channels, either left or right, of the file we didn’t copy from and paste it in. This will paste the file in to the other channel..creating a “stereo” file of the original and the new one. It’s a simple process, listen to the file and see how far off you are.

There’s a simple way of doing this though since we’re dealing with an intro sync…since we know the music starts around 9.107 seconds…we can create a 10-sec new file and paste the song in to that.

One can use this method to replace segments in a video file…but you just have to remember to keep things in sync…if you want to replace a section of audio in the middle of the file…just make sure the section you’re replacing it with is the EXACT same length. Sometimes it helps if you copy a large chunk to a new file (an area round what you want to work) so you can do some editing without damaging the original file..and after you have it the way you want it matching the exact length as it did before…you can delete the chunk and paste in the new chunk.

I would give audio samples, however, I’m waiting for permission from the video author to redistribute the audio from the video.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License. GoldWave® is a registered trademark of GoldWave Inc. Screenshots courtsey Goldwave, Inc. Used with permission. Created 16 Feb 2009 by Jay Moore (dewdude@g*oogle*mail.com)

Advertisements

2 Comments »

  1. It’s appropriate time to make a few plans for the future and it’s time to be happy.
    I have learn this submit and if I may just I wish to counsel you few
    attention-grabbing issues or advice. Maybe you could write next articles referring to this article.
    I desire to read more things approximately it!

    Comment by studio lighting — 4.August.2013 @ 10.54.am

    • Someone forgot how to english!

      Comment by dewdude — 4.August.2013 @ 4.30.pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: