Browsed by
Category: Software

Spectrograms on the iPhone

Spectrograms on the iPhone

Screenshot of the Spectrogram application for iPhone, showing how it renders Killdeer vocalizations. Click for link.

An email from Denise Wight alerted me to the Spectrogram application for the iPhone, which is a pretty neat little app indeed.  It uses the iPhone’s built-in microphone to create realtime scrolling spectrograms of any sound you’re hearing.  This means you can see spectrograms in the field, at the very same time that you’re listening to the bird sound.

Why is this exciting?  Because now those with hearing loss can see the sounds that their ears can’t hear!

Here’s an example.  Ted Floyd, editor of Birding magazine and author of the Smithsonian Guide to Birds, is Colorado’s recognized guru of nocturnal migration study.  Ted and I have gone out together many times to listen to nocturnal migrants giving their quiet “seep” and “tsit” notes high overhead in the dark, and every experience has been frustrating for me, because Ted invariably hears ten times more flight calls than I do, and that’s no exaggeration. My ears simply aren’t good enough to register such high-pitched sounds at such low volume.  I can only hear the lowest, loudest migrants, and for a while I suspected Ted might be making up the rest.

No such luck.  I realized the phantom flight calls were real when I carted my laptop into the field, plugged my shotgun microphone into it, and started recording with Raven.  Voila: a realtime scrolling spectrogram showed me the sounds of the night sky, even the ones I couldn’t hear.  The scrolling spectrogram gave me a chance to identify sounds visually that I couldn’t even detect by ear.

Now anyone with an iPhone can have the same experience, for the low price of $4.99, without having to lug a laptop and a microphone into the field.

The Spectrogram application has its pros and cons.  The gain is adjustable, which is nice.  You can adjust the frequency scale to run from zero to 8 kHz, 22 kHz, or 44 kHz — the 8 kHz setting should work best for most bird sounds — but you can’t zoom in or out on the time scale, which means those flight calls aren’t likely to be visually identifiable.  This may be better in future versions.

One thing that drives me absolutely nuts is the color scheme.  You can’t change it to grayscale — you’re stuck in the odd red-and-blue mode.  Personally, I can’t stand spectrograms in colors.  They may be nice for other purposes, but when it comes to identifying bird sounds, the colors get in the way.  Birders don’t need much information about loudness; for us, a spectrogram is text, and it’s meant to be read.  Therefore it needs to be in black and white, for the same reason that books need to be printed in black and white — anything else hurts the eyes after a while.

I could say more, but I’ll dismount my soapbox. Before signing off I should note that Pete Schwamb, the creator of Spectrogram for the iPhone, has also created a couple of other cool audio-related iPhone apps — including CricketSong, which uses the chirping of Snowy Tree Crickets to determine the air temperature.  Check it out.

Editing Sounds in Adobe Audition

Editing Sounds in Adobe Audition

While using just a basic program such as Raven Lite will be sufficient for many recordists, you may find yourself wishing you had a more versatile program for fine-tuning your recordings.  If this is the case the one I recommend is Adobe Audition.  It isn’t cheap – but it is a fully professional sound-editing tool and will let you do pretty much anything you want with your sounds.

In this post I will take a sound from a raw unedited start to what I consider a finished state.  Some of the editing techniques below are the same as what you can do in Raven Lite, while others will be entirely new.

Before I start writing about various ways to manipulate a recording let me stress that the cardinal rule of editing a bird sound is to not alter the target signal itself.  The example I use below is a pretty simple bird sound, so it is easy to not mess with the actual song.  However in more complex cases you will not be able to use many of these methods quite as thoroughly.  Use your best judgment and look carefully at the sonogram before starting any editing procedures.

Disclaimer: to best hear the results of the methods below I recommend using headphones when listening to the examples.  You can also see larger images of all the sonograms and pictures below by clicking on them…this will be especially useful to see the finer details of the results of some of the editing.

Step One: Crop

As before, the first step is to crop out the audio you want to edit.  Audition has the HUGE advantage of being able to load and edit cuts longer than the one minute limit of Raven Lite, and you don’t have to worry about any of that annoying copying and pasting to get longer clips.  In the Waveform Display view, you use the Time Selection Tool to select a portion of the recording that you want to remove, and then go to “Edit”, “Delete Selection”, or simply just hit the “delete” key on your keyboard.

striolated-puffbird_start
Striolated Puffbird, Cristalino Jungle Lodge, Brazil. This will be the test case for the methods details below; here it is untouched except that I cropped this sample out from the original, and amplified it some to better show the differences that editing will have on it.

Step Two: Filter

This is actually more like three or four steps with Audition.  I have gotten in to the habit of removing the low frequency rumble entirely, so I will describe my method for that first, then an alternate method later.

Using the Marquee Selection Tool, select the frequency range you want to remove…for most of my recordings this is from about 350-380 hertz (hz) and lower.  Then go to “Edit”, “Delete Selection”.  This will remove the frequency range you’ve selected, similar to using the “filter out selection” feature in Raven Lite.

striolated-puffbird_filter1
Striolated Puffbird with all frequencies below 350hz removed.

Notice how on this recording there is still a band of louder low frequency noise.  This is where what is perhaps Audition’s most useful tool comes in handy.  Hit “Ctrl A” on the keyboard to select the entire sound, and go to “Effects”, “Filter and EQ”, “FFT Filter”.

You will see this weird box with a straight line come up.  This handy feature allows you to select frequency ranges and amplify or deamplify them as much as you want.  For most my recordings I amplify from a minimum amount at 750 or 800hz to around –15dB at 400hz.  To place points on the line click at the approximate frequency you want the point to appear.  Next right click on the point, and type in the frequency and how much you would like it amplified or deamplified.  The beauty of the FFT filter is that you can smoothly deamplify across a range of frequencies, so that no abrupt “line” is apparent.  Notice how after applying the filter below the band of low frequency noise is the same strength as the sounds immediately above it.

striolated-puffbird_fft1
FFT Filter window. Here the sound is filtered from 750hz in a cline down to 400hz at -15dB.
striolated-puffbird_filter2
Striolated Puffbird after applying the FFT filter above.

But wait!  The FFT filter is useful for far more than just deamplifying a small low frequency noise band.  Notice that very noisy and very, very annoying band of insect noise around 3 kilohertz (khz)?  Well, let’s kill it!  The first step in removing insect noise is to figure out what frequencies it covers.  I take the cursor and go first to just below the lower edge of the recording, and then to just above the upper one and write down those frequencies.  Then I either figure out the halfway point, or the frequency of the most powerful part of the noise.

striolated-puffbird_fft2-1
FFT filter window showing how to deamplify a frequency band in the middle of a recording, in this case with from a range of 2500 Hz to 3500 Hz, with a midpoint of 3000 Hz deamplified -25dB.

Now, back at the FFT filter window you will have to enter three points onto the graph.  The first and third will be your high and low points, with an amplification of zero decibels (0 dB).  The second will be the one in the middle or the height of the bug noise.  For this one you can experiment with different values until you get the effect you want.  Or you can compare the amplitude from the noisy part of the recording to the frequencies you used as the upper and lower bounds, and deamplify by that amount.

striolated-puffbird_fft2
Striolated Puffbird with the main band of bug noise deamplified.

As a final step in the filtering process I also deamplified those two smaller bands of bug noise over the first part of the cut.  You can deamplify portions of the sound by using the Marquee Selection Tool to select just the areas you want to deamplify, instead of applying the filter to the whole cut.

Remember how I promised to talk about another way to filter that lowest band of low frequency noise?  Well, you can also use the FFT filter to deamplify the rumble at the bottom of the spectrum to a lower level, rather than just removing it.  I remove it as a matter of personal preference, but many people prefer to leave even the lowest frequencies in their recordings and feel that it gives the cut a more natural sound.

Step Three: Clean-up

Notice all those popping and clicking sounds in this recording?  Those are from a combination of handling noise – I was trying to find the bird for some clients I was leading while recording it, and thus moving around a lot – and also noise from said clients moving around.  Many recordings have at least some handling noise, and it can range from merely a small annoyance to downright dreadful.

Audition offers a couple of ways to remove handling noise.  The one I usually use is to select a small sliver of “clean” sound with the Marquee Selection Tool and paste it over the noisy section I want to replace.  I typically try to select a piece of clean sound from close to the noisy part, but sometimes this isn’t possible.  In this particular recording, note the nice clean section from 5.8 seconds to 6.6 seconds that could be used as a source of replacement sound.

Once you’ve selected the sound you are going to use to replace the noisy section, click a point on the spectrogram immediately before the part you are going to replace, and use the “mix paste” function to replace it.  You can find this under the edit menu, or by using the “Ctrl+shift V” shortcut.  Once you have the “mix paste” window up, click on “replace” rather than “mix”, and voila!  The noisy sound will be replaced by the quieter one.

striolated-puffbird_cleaned1
Striolated Puffbird with most of the handling noise removed. Note the quiet rustle that overlaps with the first note of the bird song that I did not remove because it overlapped with the target signal (and the harmonics thereof).

http://earbirding.com/blog/wp-content/uploads/2010/03/striolated-puffbird_audition-cleaned.mp3

striolated-puffbird_start
The original Striolated Puffbird cut for comparison with the finished one to the left.

http://earbirding.com/blog/wp-content/uploads/2010/03/striolated-puffbird_audition-start.mp3

Another way to remove annoying clicks and pops is to use the “Spot Healing Brush” – this has comparable results, but I tend to use the method detailed above as a personal preference.  Both these ways of removing background clicks and pops could also be used to remove other background noises — I quite often end up having to “mix paste” over some quiet talking in the background, for example.  But I pretty much never remove natural background sounds, whether they be other bird species vocalizing, the noise of wings in flight, the sound of the target bird itself moving, etc.  Again this comes down to personal preference, but I would rather have the sound be a better representation of the situation the bird was in than a completely sterile cut with nothing but the target species.

Step Four: Amplify

This step can actually be done at any stage in the process.  I left it for the end in this discussion, but just as often I amplify right at the beginning, immediately after cropping.  I actually amplified this particular recording before any of the steps I detailed above, for ease of illustration in this post.

For amplification it is best to be in the Waveform Display window, since this allows you to see whether or not the sound is clipping from over-amplification.

There are two ways you can amplify the recording.  The first is to use the amplification tool, found under the edit menu, on the amplification tab.  This amplifies it by a decibel (dB) amount, which I find hard to visualize.  You can, however, use the Waveform Display to see how many dB the peak amplitude of the recording is below the max-out point, and then amplify by an amount less than the difference of those two numbers.

The other option is to use the “normalize” feature, also under the edit menu, amplification tab.  This allows you to amplify the sound to some percentage of the maximum amplification possible.  So, if you normalize to 100% it will amplify the recording to a point just below clipping.  50% will be halfway between no sound and maximum sound, and so forth.  With this particular sound I will not amplify it any more than I already have, as the signal to noise ratio isn’t high enough (in my opinion).  Many thanks to K. Cowcill for making me aware of this method.

Other Features

I will be the first to admit I barely scratch the surface of what Audition can do.  The number of tools that you can use to tweak every aspect of your sound is simply staggering, and if you do some digging you will doubtless find additional ways of editing your sound that I haven’t talked about.  One last method of filtering that I will discuss here goes way beyond the techniques I talked about above.  It is also rather sketchy if you’re a purist about not touching the actual target signal itself.  It is called dehissing, and it allows you to remove or deamplify ALL the background noise of your recording, leaving the target signal clearer.

But dehissing often doesn’t work well on certain types of bird sounds.  I’ve found that it works best with clear whistles with little or no modulation; sounds that contain more noise or cover a broader frequency spectrum will be unacceptably altered by this process.   I tend to not use dehissing much except in the rare case when I have heavy water or wind noise combined with a clear enough bird vocalization to make for an reasonable result.

dehiss1
Pheasant Cuckoo, Cristalino Jungle Lodge, Brazil. Note the heavy hiss from a nearby river.

Note the heavy background noise in this recording.  While it would be possible to edit this cut in such a away that the background noise will be much less apparent by using the more standard techniques I talked about earlier, it would be impossible to be completely rid of a rather unpleasant amount of hissing.  So, to filter the recording using the dehiss method, select the whole recording and go to “edit”, “restore”, “hiss reduction”.  You’ll immediately notice a large number of options in this window, and I will freely admit that I don’t entirely understand how they all work.  I typically set the precision rate at 40, the transition width at 7 dB,  the spectral decay rate at 65%, and the hiss reduction amount at a varying number depending on how loud the background noise is.  Finally, on the noise floor adjust level on the slider on the left, I use a number between 8 and 11, usually with some experimentation to see what results.

dehiss2
Pheasant Cuckoo with the hiss reduction filter applied.

Note how the hiss reduction filter more uniformly removes background noise than is possible with just the FFT filter.

I chose this sample to illustrate a tiny portion of what Audition is capable of doing…experiment with it some, be sure to save untampered originals, and let me know if you find any other useful features I haven’t talked about here!

Editing Sounds in Raven Lite

Editing Sounds in Raven Lite

Once you’ve come back from the field with a card full of new audio, renamed the files, and backed everything up, you may want to think about editing your sounds.  While having untouched originals is useful if you’re doing scientific analyses, editing portions of the sound for posting on the internet, sending to friends, using for quizzes, etc. can make it easier to get your sound out there and heard by others.

Pretty much all the tracks used on commercial CDs of bird sounds have been edited to one degree or another, often quite heavily.  Just because the recordings on, say, the Stokes Field Guide To Bird Songs sound like they were recorded in a sound room with no background noise doesn’t mean they were; quite likely most of them were the target of skillful and careful editing to bring out the target species in the recording.

I use two different programs to edit sounds.  The first is Raven Lite, available free from the Macaulay Library.  Though somewhat limited in its abilities, it does let you do some basic editing that, for many, will be sufficient for their sound editing needs.  Detailed below is my normal process for editing recordings in Raven Lite.

Disclaimer: to best hear the results of the methods below I recommend using headphones when listening to the examples.  Low frequency sounds are hard to hear over laptop speakers and small external speakers, so if you don’t hear a difference in the examples below that may be the problem.

Step One: Crop

First off I load the original recording.  The first step is to select the part of the sound you want to edit…usually for me this involves cutting out any talking I did into the mic at the end of the cut, and sometime some severe handling noise from the beginning.  Quite often the loaded sound is longer than the one minute maximum that Raven imposes on files…longer than that and you can’t edit it, and you have to save it in one-minute chunks.  There are two ways to deal with this:

  1. select a one minute piece that you want to have as the final edited sound and “save selection as” for your new file that you will edit, OR
  2. copy one minute chunks and paste them into a completely new file, one after the other.

Using the second method you can get up to about three minutes of your recording into an editable file before Raven runs out of memory.  Once you get over those amounts you have to create two or more files to edit and then paste them together using another program (I recommend Audacity).

Step Two: Filter

Once I have a manageable section of audio to edit, I filter out low frequency rumble (discussed in the “extra credit” box at the bottom of the Noise page), which is present in all recordings below 300-400 Hz or so.  It’s more noticeable if you are recording in noisy conditions, and less noticeable if you are recording a very loud bird and the gain was turned way down.

unfiltered1
White-crested Spadebill, Cristalino Jungle Lodge, Brazil. Unfiltered.
filtered1
White-crested Spadebill, Cristalino Jungle Lodge, Brazil. Filtered below 350 Hz.

Filtering out this low frequency band of noise can have varying consequences.  If you were recording in a quiet environment it typically makes the target signal easier to hear and the whole recording more pleasant to listen to.  However, if you were recording somewhere with increased background noise, such as traffic, it has the effect of making any noise that you didn’t filter out  (i.e., the low frequency noise above what you filtered out) sound tinnier and unpleasant.  When this is the case, there are several options.  First, you can filter out a larger frequency band than normal, but this often results in a “hissy” tone to the whole recording, as in the following example:

overfiltered2
Golden-crowned Spadebill, Cristalino Jungle Lodge, Brazil. This recording has been too agressively filtered...note the high-pitched hissy sound of the recording.

On the other extreme, you can actually filter less of the low frequency band than you would normally; quite often the whole recording will sound better with less filtered in such cases than with more.  (In an upcoming post I’ll discuss advanced techniques for filtering out low-frequency noise, including frequency replacement.)

To remove the low frequency band in Raven Lite, select the frequency band you want to filter out (vertically), and then expand it horizontally to cover the entire time of the recording.  Then go to edit, filter, filter out selection.  This method is also useful if there is an especially loud band of insect noise in the recording, a common problem when recording in the tropics.  You have to be especially careful to make sure you don’t filter out any of the target signal in these cases, though, since insect sounds are higher frequency and often overlap the bird sound you were recording.

Step Three: Amplify

After filtering, the next step I usually take is amplifying the recording.  The amount I amplify is also a bit of a balancing act.  When the target signal is quite loud I amplify little or none, whereas when the bird noise is very quiet I tend to amplify more.

unamplified
Plain-tailed Wren from Peru, unamplified

The key is not to amplify so much that the recording clips (like in the example below), but to a level approaching that.  I tend not to amplify more than four or five times the current levels as this amplifies the background hiss as well, and makes the whole recording sound unpleasant.  Experiment a bit with the amplification factor and find the result that sounds best to you.

tooamplified
Plain-tailed Wren from Peru, overamplified. Notice how the sound clips at the top and the bottom, and how the sound is distorted.
amplified
Plain-tailed Wren from Peru, amplified 1.7 times. Note how the peaks come close to clipping, but don't actually max out.

Note that to deamplify you don’t use negative numbers, but fractions…i.e., a 0.9 multiplier deamplifies to 90% of the original level.

On a side note, amplification is one of the few things for which I like Raven Lite better than Audition.  With Raven Lite you can pick a multiple amount to amplify by, whereas in Audition you amplify by dB.  I find it easier to visualize how amplifying by a multiple will affect the recording, rather than using a more esoteric measurement like decibels.

Extra credit: the images above are waveforms, a graph showing sound amplitude versus time.  The higher the peaks on the waveform, the louder the sound.  An ideal recording will have the highest peaks possible for the target signal without them maxing, and also having the lowest possible amplitude during the non target signal portions of the recording.

Step Four: Clean-up

Typically my final step when editing a sound in Raven Lite is what I call “clean-up” work: removing handling noise, talking in the background, the sounds of walking, car horns, etc.    Note: I personally far prefer Audition over Raven Lite for this step, but back before I started using Audition, here is what I used to do.

Since in Raven Lite you can only cut and paste timed pieces of the recording covering the entire frequency range, you have to replace the whole time span of the sound that contains the unwanted noise.  To maintain natural intervals between the bird sounds themselves, I select a piece of sound with no extraneous noise that is the same length of time and paste over the section with the unwanted noise.

At the very end I will often paste a little bit of empty sound at the beginning of the cut to give a bit of lead time until the first vocalization, and sometimes a bit at the end to make the whole recording more “symmetrical”.