Extracting and Using a Recorded Sound Effect with VLC and Audacity

Extracting and Using a Recorded Sound Effect with VLC and Audacity


I found a useful sound effect in an online video from NASA which replaces an earlier temporary sound I used in a scene soundtrack for the Lunatics pilot, "No Children in Space." I'm going to extract the sound from the video (with VLC), cut out the sound I need, clean it up, and insert it into an existing sound mix (all with Audacity). This should give you some insight into using Audacity and a VLC on a real project.

Making Movies with Free Software

This article is part of an on-going series on the challenges I've faced in producing two free-licensed movies, Marya Morevna, through the Morevna Project and Lunatics, which we are working on as Anansi Spaceworks.

I needed the sound of a particular type of hatch (namely the docking hatch used by Soyuz at the International Space Station) being opened. I originally had only my best guess at what this would sound like, and I conjured something up by mixing sounds from an ordinary house door, a washing-machine door, and a hissing steam sound to create something artificially. I didn't think I'd be able to find the real sound, but then -- there it was.

In doing the research for this part of the film, I came across a NASA video which included the actual hatch being opened. It's almost hard to tell -- the hatch doesn't make a very loud sound (it's quieter than my fake version was). There's a lot of other sounds going on in that scene (people talking, a commentator, other movement noises), but by a stroke of good luck, the hatch sound itself is well-isolated for the fraction of a second that it lasts.

So now I want to replace this sound in my already-mixed scene soundtrack to make a new version (and I'm also making a few other minor changes).

Extracting Sound from a YouTube Video

One nice thing about a space-themed project like mine: most NASA media is under a very permissive license -- effectively "public domain" or "attribution", depending on how you define the terms. It's technically called "copyright free." The terms say that you should credit NASA as the source; that it violates a federal law to attempt to place a copyright on the work after you get it (is that a copyleft?); and that no personality or endorsement rights are conveyed at all.

One nice thing about a space-themed project like mine: most NASA media is under a very permissive license

So that takes care of the legal bit. Technically, I get the video in Flash Video (FLV) format by simply copying the temporary file in /tmp that the flash plugin in SeaMonkey or IceWeasel uses. I am told that there are other ways (using browser extensions), but I've been too lazy to find that out since my way works.

After that, though, things are a little more interesting. I view flash videos outside of my browser using VLC (VideoLAN Client). VLC works very well with this format -- in fact, so well that I usually view internet videos this way rather than watching through my browser, just because it's smoother.

But VLC can do more than just view videos. Here I used it to strip out the audio track by itself.

Converting Video With VLC

First, I start VLC from the desktop menu (it's not necessary to "open" the video). Then I select "Media→Convert/Save...". In the ensuing dialog, I tell where to find the video file, provide a location to save the .ogg audio file as output, and what codec to use for the audio output (Figure 1).

Figure 1: Extracting the audio from a flash video with VLCFigure 1: Extracting the audio from a flash video with VLC

A progress bar appears, and the file is converted. On my computer, this takes about the same time as playing the video, so be prepared to wait a couple of minutes.

The resulting file is just an Ogg Vorbis audio file, which I load directly into Audacity.

Getting a Sound Effect out of a Raw Recording

First of course, I need to start an Audacity project and import the new audio track. I believe you can also use "File→Open" to do this. (Figure 2).

Figure 2: Loading the audio fileFigure 2: Loading the audio file

One small brief sound in a long noisy video can be a little hard to find. I find the easiest way is to play the video (in VLC) to find the correct time, then look around that region in Audacity (Figure 3).

Figure 3: Using the original video helps to locate the desired sound effect in the fileFigure 3: Using the original video helps to locate the desired sound effect in the file

I select the region around the sound and expand that (there's a toolbar button for this in Audacity). Using the "Trim" operator from the "Edit" menu gets rid of the rest of the audio, and then I zoom back out and use the time-shifting tool to move the sound over to the zero point (Figure 4). There's another toolbar button to snap the view to the full length of the track, which was very short at that point.

Figure 4: Trim the sound (leaving some margin) and shift to the beginning of the trackFigure 4: Trim the sound (leaving some margin) and shift to the beginning of the track

Next, I use the "Amplify..." plugin to increase the volume level. By default, this plugin rescales the audio so that the greatest amplitude in the selection has the maximum representable value (i.e. the largest integer value that the digital representation allows).

Figure 5: Amplify the sound to full saturation (normalize)Figure 5: Amplify the sound to full saturation (normalize)

This is fairly convenient, so I do follow this convention (Figure 5). However, it does mean that you always need to diminish the volume with the track fader when you use the sound effect in a mix (otherwise, the mix will get "clipped", since any additional sound will push it over the limit). This will make more sense when I describe using the track below.

Figure 6: Filtering out background noiseFigure 6: Filtering out background noise

I leave a little extra sound on the ends, as you can see in Figures 5 and 6. This is useful, because I can then use the "Noise Removal..." plugin to clean up the sound. I have to say this is an awesome filter -- it can't be a simple job to profile and remove background noise, but this filter has worked wonderfully for me in the past. Here, I just sample some sound from right after the hatch opening (select this sound; open the plugin dialog; and select the "Get Noise Profile" button). Then I select the region surrounding the hatch sound itself, and use the plugin filter on it (Figure 6).

Figure 7: I trim again to get just the effectFigure 7: I trim again to get just the effect

I worried a little that there might be a problem because the background ambience changes after the hatch is open (because of the acoustics of the module being opened up), but this doesn't seem to cause any trouble (perhaps because the track is just very quiet before the door is opened).

Figure 8: Minimal shaping to taper off the endsFigure 8: Minimal shaping to taper off the ends

After that, I trim again and then shape the ends of the effect with the envelope tool (this tapers off the ends so no annoying clicks or "ringing" are generated when the sound is mixed). This leaves me with just the isolated, re-normalized, noise-filtered hatch sound effect, which I then export to an Ogg Vorbis file in my "FX" directory (Figure 9).

Figure 9: Exporting the audio file to Ogg Vorbis formatFigure 9: Exporting the audio file to Ogg Vorbis format

At that point, I'm ready to use the effect in my scene soundtrack mix.

Using the Sound Effect

The original effect was used in a complex mix as a transition point between two music tracks. Together, these elements constrain the timing of the scene. Here I need to open a pre-existing sound mix in Audacity, import the new sound effect, and remove the old one. I also need to get rid of some chickens, due to a minor re-write ("no chickens in space").

For some reason I've not been able to understand, I get a lot of error messages about leftover "blocks" of sound when I re-open heavily-edited mixes. I can only assume this means that Audacity loses track of them somehow, and doesn't do a consistency check until it loads up. However, this seems to be harmless. Apparently the blocks are for sounds that were already cut out, so I just follow the default cleanup procedure (Figure 10).

Figure 10: Opening the project. For some reason, I always get this warning about stray blockfiles, but it seems to be harmless. I think it's deleting audio data that is no longer in use in the projectFigure 10: Opening the project. For some reason, I always get this warning about stray blockfiles, but it seems to be harmless. I think it's deleting audio data that is no longer in use in the project

To get a better view of the mix, it's a good idea to use "View→Fit Vertically" to squeeze the tracks up into the window. This does have the disadvantage that the controls for each track (including the fade and pan sliders) are hidden (Figure 11). So I also usually expand the particular tracks I'm working on again.

Figure 11: Zooming the view to an overview of the projectFigure 11: Zooming the view to an overview of the project

To get my new sound effect, I just use "File→Import...→Audio..." and select the appropriate file (Figure 12). This creates a new track at the bottom, which I then need to move up (Figure 13). I could also have selected the track and dragged it up into position. This saves a few clicks when you have to move tracks several positions up or down.

Figure 12: Importing a sound creates a new trackFigure 12: Importing a sound creates a new track

Once the tracks are together, it's easy to use the old track for alignment guidance on where to put the new one (using the "timeshift" tool, Figure 13). I can do this visually, but also by using the "Solo" buttons to listen to just these two tracks.

After this, while still zoomed in on the area of interest, I listen to the full mix (which includes music) for that segment. From this, I realize that the visual match to the timing is not so good, and I should move the new effect (which is shorter) to a little bit earlier point. So the new track is positioned. You might notice that the fader has been adjusted. This is necessary for the reasons I mentioned earlier -- the effect track is saturated, so the volume needs to be reduced in order to avoid clipping. Also, the hatch is not very loud in real life, so we don't want the effect to be overpowering.

Figure 13: Using visual cues and the Figure 13: Using visual cues and the "Solo" buttons to line the new sound up in the right place, using the old one. I also set the volume using the fader (inset)

Rather than deleting the old sound effect (who knows? I might want it later), I just use the "Mute" button on that track. I do the same with the offending chickens (it's a shame though, they were a funny touch -- but the goat will just have to carry the humor). This gives me my new version of the soundtrack mix.

Figure 14: Using the Figure 14: Using the "Mute" buttons to select which tracks will be used. I muted the old hatch effect and also some other sound effects and music I had decided to omit from this mix

Then I export the mixed track, just as I did with the sound effect (though I have these in different directories). The result is the track I needed. And that's it for today!

Licensing Notice

This work may be distributed under the terms of the Creative Commons Attribution-ShareAlike License, version 3.0, with attribution to "Terry Hancock, first published in Free Software Magazine". Illustrations and modifications to illustrations are under the same license and attribution, except as noted in their captions (all images in this article are CC By-SA 3.0 compatible).

Category: 

Author information

Terry Hancock's picture

Biography

Terry Hancock is co-owner and technical officer of Anansi Spaceworks. Currently he is working on a free-culture animated series project about space development, called Lunatics as well helping out with the Morevna Project.

Most forwarded

Interview with Dave Mohyla, of DTIDATA

Dave Mohyla is the president and founder of dtidata.com, a hard drive recovery facility based in Tampa, Florida.

TM: Where are you based? What does your company do?
DTI Data recovery is based in South Pasadena, Florida which is a suburb of Tampa. We have been here for over 10 years. We operate a bio-metrically secured class 100 clean room where we perform hard drive recovery on all types of hard disks, from laptop hard drives to multi drive RAID systems.

Anybody up to writing good directory software?

Since the very beginning, directories (of any kind) have had a very central role in the internet. (I have recently grown fond of Free Web Directory. Even Slashdot can be considered a directory: a collection of great news and invaluable user-generated comments. As far as software is concerned, doing a quick search on Google about software directories will return the free (as in freedom) software directories like Savannah, SourceForge, Freshmeat and so on, followed by shareware and freeware sites such as FileBuzz, PCWin Download Center and All Freeware (great if you're looking for shareware and freeware, but definitely less comprehensive than their free-as-in-freedom counterparts).

Interview with Mark Shuttleworth

Mark Shuttleworth is the founder of Thawte, the first Certification Authority to sell public SSL certificates. After selling Thawte to Verisign, Mark moved on to training as an astronaut in Russia and visiting space. Once he got back he founded Ubuntu, the leading GNU/Linux distribution. He agreed on releasing a quick interview to Free Software Magazine.

Is better education the key to finding better software?

I read David Jonathon's article Anybody Up To Writing Good Directory Software? the other day, which got me thinking about software directories in general. As David mentioned, many of the software directories one finds when doing a quick google search are free as in beer, not as in freedom. But what interests me is the software directories that already exist, providing a combination of both free as in beer software, and open source software. Sites such as Freeware Downloads and Shareware Download don't advertise themselves as providing free as in liberty software, but each of them have a good selection of open source software available... if you know where to look.

Most emailed

Free Open Document label templates

If you’ve ever spent hours at work doing mailings, cursed your printer for printing outside the lines on your labels, or moaned “There has got to be a better way to do this,” here’s the solution you’ve been looking for. Working smarter, not harder! Worldlabel.com, a manufacture of labels offers Open Office / Libre Office labels templates for downloading in ODF format which will save you time, effort, and (if you want) make really cool-looking labels

Creating a user-centric site in Drupal

A little while ago, while talking in the #drupal mailing list, I showed my latest creation to one of the core developers there. His reaction was "Wow, I am always surprised what people use Drupal for". His surprise is somehow justified: I did create a site for a bunch of entertainers in Perth, a company set to use Drupal to take over the world with Entertainers.Biz.

Update: since writing this article, I have updated the system so that the whole booking process happens online. I will update the article accordingly!

So, why, why do people and companies develop free software?

More and more people are discovering free software. Many people only do so after weeks, or even months, of using it. I wonder, for example, how many Firefox users actually know how free Firefox really is—many of them realise that you can get it for free, but find it hard to believe that anybody can modify it and even redistribute it legally.

When the discovery is made, the first instinct is to ask: why do they do it? Programming is hard work. Even though most (if not all) programmers are driven by their higher-than-normal IQs and their amazing passion for solving problems, it’s still hard to understand why so many of them would donate so much of their time to creating something that they can’t really show off to anybody but their colleagues or geek friends.

Sure, anybody can buy laptops, and just program. No need to get a full-on lab or spend thousands of dollars in equipment. But... is that the full story?

Fun articles

Santa Claus - the most successful open source project

It dawned on me the other day, as I was shopping for the dozens of gifts it seems I have to buy every December, that Santa Claus is the most successful open source project in history. (Bridget @ Illiterarty would agree with that). Santa Claus is essentially a marketing development that is embodied by everyone who stuffs a sock, gives a gift, hosts a dinner or wishes Merry Christmas over the holiday season.

Most emailed

Editorial

When I first started thinking about Free Software Magazine, I was feeling enthusiastic about the dream. I had Dave, Gianluca, and Alan willing to help me, I had established members of the free software community willing to help me out, I had writers volunteering their time and energy for free, and I had a generous offer from OpenHosting for servers, all before I'd proved myself. There was a sense of excitement in the air, and I thought maybe, just maybe, I could make this work.

Free Software Magazine uses Apollo project management software and CRM for its everyday activities!