Sign in to follow this  
Followers 0
PurpleJesus

Spectrum Analyzers

9 posts in this topic

I've been looking at how digital spectrum analyzers work for the last couple of days and found they use something called FFT or Fast Fourier Transformation. Could someone give me a dumbed down explanation of how the hell that works? How is a stream of data converted into frequencies? I don't know crap about calculus btw.

0

Share this post


Link to post
Share on other sites

I've been looking at how digital spectrum analyzers work for the last couple of days and found they use something called FFT or Fast Fourier Transformation. Could someone give me a dumbed down explanation of how the hell that works? How is a stream of data converted into frequencies? I don't know crap about calculus btw.

This is *very* condensed. I can suggest some good reading if you're interested in more detail.

Jean-Baptiste Fourier came up with mathematical formulas to show that a waveform can be described as the sum of one or more sine waves. In terms of audio, a sine wave is a single, repeating frequency. Any complex sound is made of these "sinusoids" whose frequencies are harmonically related. Keeping this in mind, you can describe any sound by the sinusoid components that make it up. This is the great value of FFT. It means that you can create a mathematical statement that describes those components. Each complex sound is unique because of the number of sinusoidal components and each component's characteristics. The primary characteristics of sinusoids are Frequency, Amplitude and Phase. Think of the display of a oscilloscope -- the rise and fall of the wave (http://upload.wikimedia.org/wikipedia/commons/a/a0/Oscilloscope_diagram.svg). Frequency is how fast a waveform goes from rise (Compression) to fall (Refraction) -- this is called the Period. Amplitude is how high up the wave goes. Phase is how much the entire wave is shifted forward or backward from 0 time. In other words, Phase tells you at time 0 what part of the wave shape is passing through. With FFT, you can describe sound as Amplitude vs. Time (the "waveform") or Energy vs. Frequency (the "spectrum"). For the purposes of this discussion, we're interested in the latter.

Doing FFTs by hand would be very time-consuming. Luckily, you can play around with FFT for sound analysis in programs such as CSound (http://www.csounds.com/) and MAX/MSP (http://cycling74.com/).

Does that help?

1

Share this post


Link to post
Share on other sites

I've been looking at how digital spectrum analyzers work for the last couple of days and found they use something called FFT or Fast Fourier Transformation. Could someone give me a dumbed down explanation of how the hell that works? How is a stream of data converted into frequencies? I don't know crap about calculus btw.

This is *very* condensed. I can suggest some good reading if you're interested in more detail.

Jean-Baptiste Fourier came up with mathematical formulas to show that a waveform can be described as the sum of one or more sine waves. In terms of audio, a sine wave is a single, repeating frequency. Any complex sound is made of these "sinusoids" whose frequencies are harmonically related. Keeping this in mind, you can describe any sound by the sinusoid components that make it up. This is the great value of FFT. It means that you can create a mathematical statement that describes those components. Each complex sound is unique because of the number of sinusoidal components and each component's characteristics. The primary characteristics of sinusoids are Frequency, Amplitude and Phase. Think of the display of a oscilloscope -- the rise and fall of the wave (http://upload.wikimedia.org/wikipedia/commons/a/a0/Oscilloscope_diagram.svg). Frequency is how fast a waveform goes from rise (Compression) to fall (Refraction) -- this is called the Period. Amplitude is how high up the wave goes. Phase is how much the entire wave is shifted forward or backward from 0 time. In other words, Phase tells you at time 0 what part of the wave shape is passing through. With FFT, you can describe sound as Amplitude vs. Time (the "waveform") or Energy vs. Frequency (the "spectrum"). For the purposes of this discussion, we're interested in the latter.

Doing FFTs by hand would be very time-consuming. Luckily, you can play around with FFT for sound analysis in programs such as CSound (http://www.csounds.com/) and MAX/MSP (http://cycling74.com/).

Does that help?

it does a bit.. what's this recommended reading you have?

So let's say I have a audio sample I just took and shoved it into a buffer. It's say, 1/50th of a second long.. Now I compare that signal with a mathematically generated sine wave of a target frequency. Is it the superposition(for lack of a better word) of those two that becomes the 'line' in the spectrograph?

0

Share this post


Link to post
Share on other sites

So let's say I have a audio sample I just took and shoved it into a buffer. It's say, 1/50th of a second long.. Now I compare that signal with a mathematically generated sine wave of a target frequency. Is it the superposition(for lack of a better word) of those two that becomes the 'line' in the spectrograph?

If I remember correctly (at it's been a really long time) you would first perform a hamming window function on the buffer to remove high frequency components at the start/end, perform the FFT and then use the amplitude of each 'bucket' as a line on the spectrograph.

Munge.

0

Share this post


Link to post
Share on other sites

So let's say I have a audio sample I just took and shoved it into a buffer. It's say, 1/50th of a second long.. Now I compare that signal with a mathematically generated sine wave of a target frequency. Is it the superposition(for lack of a better word) of those two that becomes the 'line' in the spectrograph?

If I remember correctly (at it's been a really long time) you would first perform a hamming window function on the buffer to remove high frequency components at the start/end, perform the FFT and then use the amplitude of each 'bucket' as a line on the spectrograph.

Munge.

Appreciate this info guys..

Thanks again.

0

Share this post


Link to post
Share on other sites

it does a bit.. what's this recommended reading you have?

So let's say I have a audio sample I just took and shoved it into a buffer. It's say, 1/50th of a second long.. Now I compare that signal with a mathematically generated sine wave of a target frequency. Is it the superposition(for lack of a better word) of those two that becomes the 'line' in the spectrograph?

Sorry for the delay, things are busy. In terms of reading, I'd start here... http://www.indiana.edu/~emusic/etext/toc.shtml. This will give you a good overview of the whole digital audio thing in general. Mungewell is correct on the windowing. Here's a good account of how that works... http://web.engr.oregonstate.edu/~moon/ece323/hspice98/files/chapter_25.pdf

If you download one of the various audio programming environments such as CSound, I can walk you through performing an FFT yourself.

hope that helps.

Edited by Pan
0

Share this post


Link to post
Share on other sites

Pan, Mungewell, others......

Do you guys know any good primer textbooks for getting into the technical details of audio: Digital Audio, File Formats, Digital Synthesis, Acoustics etc.

Pretty much everything from here:

http://www.indiana.edu/~emusic/alldocs.htm

I'm sure you've read plenty of books, any recommendations.

I prefer 'in print'.

0

Share this post


Link to post
Share on other sites

Pan, Mungewell, others......

Do you guys know any good primer textbooks for getting into the technical details of audio: Digital Audio, File Formats, Digital Synthesis, Acoustics etc.

Pretty much everything from here:

http://www.indiana.edu/~emusic/alldocs.htm

I'm sure you've read plenty of books, any recommendations.

I prefer 'in print'.

Many of the techniques used for audio processing are fairly simple (they have to be in order to do real time processing). As is usual when you are talking about a field as varied as audio there isn't one solid textbook that covers everything, so here are some things I found useful.

You will need a reasonable grasp of mathematics. I suggest books like Engineering Mathematics and Advanced Engineering Mathematics (the second one covers fourier transforms, the first is required knowledge for the second).

There is a good book that is released online for free called 'Music: A Mathemtical Offering' which starts off with physical audio (including how humans perceive audio) and also gets into digital audio stuff later on, you can also buy physical copies of the book. The maths is pretty difficult right out of the gate but it is not impossibly difficult if you have a decent math textbook to reference if you get stuck.

It's also worth get Max/MSP or the open source equivalent Pure Data, this provides a good visual audio programming laboratory to test out ideas as you learn them - if you don't want to have to learn too much maths puredata is a great way to go. (also, some books on audio programming provide example code for Max/MSP, pure data can also open these). CSound is worth getting as well. If you are programming in linux it might also be worth getting the JACK development libraries, which makes audio programming easier by abstracting away from the underlying drivers (OSS, ALSA, ...) and running the processing via callbacks.

When it comes to file formats it's often easier to just google around. I found this page useful when I was working with wave files.

If you are interested in experimenting with hardware midi controllers I can't recommend getting an arduino board highly enough. I went from having no experience with electronics to being able to make basic midi controllers in a couple of weeks.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0