Re: Fourier beginner: sanity check
Re: Fourier beginner: sanity check
- Subject: Re: Fourier beginner: sanity check
- From: Kurt Revis <email@hidden>
- Date: Fri, 14 Feb 2003 11:02:49 -0800
On Friday, February 14, 2003, at 09:27 AM, Phillip Mills wrote:
For the past few days, I've been trying to learn something about
CoreAudio so that I could capture input and do some analysis.
You should check out the Music-DSP list; there are list archives and
lots of sample code you could look at. Once you get past the problems
of interfacing with the hardware and software, and more into the issues
of mathematically processing audio, I think that list is a lot more
appropriate than this one.
I also found this book very helpful:
http://www.dspguide.com/
1) My program captures input through the microphone and gets 1024
floats at a time.
2) When the entire capture is finished, I process every second sample
to compensate for interleaved data.
3) Running it through the forward transform in 512 sample chunks gets
me a mirrored curve around the midpoint of the X-axis. (Seems to
match what the book says.)
What you probably want is the power spectrum, not individual complex
samples. The power spectrum is typically what you see in spectrum
analyzers (hardware or software). If I remember right this would be
mag = (sqrt(x^2 + y^2))^2 = x^2 + y^2.
4) For a particular data block, the maximum of the real values shows
up at offset 9 of the transformed data. I take this as meaning a
frequency near (9/512)*44100 has the highest amplitude.
Right. You might be off-by-one depending on where your FFT routine puts
the 0-frequency value.
5) That amplitude is reported as 7.3564, but I have no idea what unit
of measure.
You will need to experiment a bit, probably. I would take a full-scale
sine wave at an integer multiple of the sample rate (say 4410 Hz) and
see what values pop out. Your FFT may give you a certain scale factor,
and if you apply any windowing function, that will also have an effect.
In general the numbers won't mean anything physical; you should find
the maximum value you can possibly get, and consider that to be 0 dB.
Then you can calculate the dB for smaller values.
The end result that I'd like to get to is an estimate of notes and
durations for simple musical input.
Just warning you: This is by no means quite as easy as you might think.
Music-DSP can certainly tell you more.
--
Kurt Revis
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.