Using the Audacity Spectrum Analyzer
Audacity® supplies a handy tool for analyzing sounds called a Spectrum Analyzer. What the Spectrum Analyzer does is simple, but how it does it is not. In fact, enough scholarly papers have been written on the subject to fill a small town library.
In the previous post, I discussed the use of equalization. Sometimes, applying equalization doesn’t have the desired effect or seems to have no effect at all. Often, the problem is that you are trying to act on something that isn’t there or, at least, is not where you thought that it was.
When you look at a track in Audacity®, you are seeing a time domain representation of a sound – that is, the amplitude of the sound over a period of time. Through the use of a mathematical process known as Fast Fourier Transform, the time domain can be converted into the frequency domain. The useful thing about the frequency domain is that it lets you see a representation of the individual frequency components that make up a sound. Now you know where to place your filters!
If you are looking to replicate a certain sound, it can be useful to compare their individual spectra, applying filters or adding components until you have a match. The Spectrum Analyzer can also help you locate extraneous sounds for removal.
In Figure 1, I have taken the spectrum of a “sawtooth” wave created by the Audacity® “Generate” function. A sawtooth is one of the “geometric” waveshapes common to the original analog synthesizers. It’s a bright, buzzy sound and has the characteristic spectrum shown. All of the partials are present out to infinity and the levels of the partials decrease with increasing frequency.
By contrast, Figure 2 is a heavily low-pass-filtered square wave, another common analog synthesizer tone. You can see by the spectrum that the partials are lower in amplitude and that the even numbered ones are attenuated. A spectrum such as this one belongs to a bright but hollow sounding flute.
The controls on the Spectrum Analyzer no doubt seem cryptic. The controls are there because spectrum analysis is somewhat imprecise math. How you accomplish the Fast Fourier Transform (FFT) depends on what you want to see and what your source material is. The first box selects “Spectrum” along with some other functions for which I have yet to find a use.
To the right of that is drop-down list of numbers, each double the number above. This number is the number of sample points that will be used in the analysis. More points gives you a better picture but, you also get more averaging. More points is great for a steady tone such as an organ, but useless for something such as a drum hit.
Since a drum hit varies tremendously over time, you want to analyze small pieces of the whole and you can’t do that with a large number of sample points. You could, however, re-sample the drum to a much higher sample rate first.
The lower left window is perhaps the most cryptic. Since you are chopping out a chunk of sound to analyze, the actual sample points included in the chunk are somewhat arbitrary. If you use a “Rectangular” window, then you are just analyzing the raw, chopped out chunk. The abrupt “edges” on this chunk cause a lot of errors, so mathematicians have devised means to minimize the error.
Not surprisingly, most of these “window” functions have been named after mathematicians. If you really want to know the hows and whys of these window functions, there are plenty of papers on the web. My advice is to use what works best for you. Sometimes, the rectangle is best. Of the windows available in Audacity®, I prefer the “Hanning” (actually Hann) window as it generally gives me the most useful result.
The final window gives you a choice of linear or log scale. Always use log scales for audio. Log handles the wide ranges a lot better. You can get precise numbers for amplitude and frequency by moving the mouse over the graph. If you do the “mouse over” with the different window functions, you will see how the results vary from one function to the next. Note that in the case of amplitude (dB), it is the relative amplitude that is important, not the actual amplitude.
The Spectrum Analyzer is probably more useful for music synthesis. It is quite invaluable for creating electronic instrument sounds, but it also has uses in creating a clear audio mix. When mixing many instruments, some of the instruments can become “lost in the mix.”
You can often “find” these instruments by determining which other tracks are occupying the same frequency space and filtering those tracks to create a “hole” for the lost instrument to fit into. The ear/brain happily fills in these holes and also hears the formerly lost instrument. This trick works well with the snare drum, allowing you to keep the level of this drum high without its beats obliterating everything else. Filter the snare so that comes through the holes where the other instruments are not.
Stephen Wise has been designing electronic musical instruments since 1975. Steve specializes in realistic recreations of traditional instruments. He became interested in the field after hearing Walter/Wendy Carlos’ “Switched On Bach” and upon being introduced to the Allen Digital Computer Organ, the world’s first all digital musical instrument. Steve is currently designing instruments for Schulmerich Bells, maker of handbells, electronic carillons, and the breakout MelodyWave® instrument.