Re: Basic sample code for FFT audio frequency spectrum? Sarcasm Maybe? Thank You...
Re: Basic sample code for FFT audio frequency spectrum? Sarcasm Maybe? Thank You...
- Subject: Re: Basic sample code for FFT audio frequency spectrum? Sarcasm Maybe? Thank You...
- From: Nigel Redmon <email@hidden>
- Date: Sat, 7 Jul 2007 13:06:40 -0700
Matt,
I'm not a cocoa guy, so there's a lot I can't speak to there... I
assume you'll have to read and parse the file yourself, unless
there's some pre-fab code for it. I haven't used this, but I know
there libsnd file, which handles a lot of format-specific details for
various types of audio files:
http://www.mega-nerd.com/libsndfile
If you want to go the route of building plug-in support, there's a
free spectrum analyzer plug-in that you can use, or use as a guide
while you're doing your own... trying to remember who makes it...
don't have it anymore... I think this was it:
http://www.rogernicholsdigital.com/inspector.htm
As far as developing such a thing, maybe the music-dsp list would be
a good place to try:
http://music.columbia.edu/cmc/music-dsp
You probably know that you need to run continuous overlapped FFTs.
Since FFT size trades off temporal resolution (and processing speed)
for frequency resolution, you'll have to make decisions about FFT
size and overlap. I think you'd probably get hits for terms STFFT
(short time FFT), sliding window FFT--I don't know what the popular
terms are these day--or simply words like "overlap" "FFT" "spectrum"
etc.
Now, re-reading your post, I'm not so sure you're talking about
showing a time-varying display of the spectrum as it plays. You
mention reading the file in and allocating a buffer "he size of the
audio file", crunching the data, and displaying it. That's over
marginal usefulness, if you mean getting maybe the spectral envelope
of the whole file, but if it is, then maybe I'm sending you in the
wrong direction.
Nigel
On Jul 6, 2007, at 10:40 PM, IgnisFatuus wrote:
Nigel,
Thanks for your feedback. That is the most intelligent feedback
I have got so far on this list. First I got links to products to
buy $$, then a one function do all response.
The last time I performed any DSP DFT or FFT was
at the assembly language level in college. I then
used an ADSP-2181 Analog Devices EZ-KIT Demo board
for senior design project for chorus and Reverb audio effects in a
Vacuum tube
Electric guitar amplifier I built for final exam... but LONG time
ago and in
assembly language and everything in real-time. Nothing "C" or
"Objective-C" levels.
Maybe the answer is right in front of my
face, but I am looking to deep for the answer? Or maybe I am
asking to high a level questions? Maybe I should have mentioned
the discrete-time fourier transform instead of the fast fourier
transform? Been to long. I need to get used to the types
of questions to ask since I am new to this forum.
From your great response I went and dug out my old DSP
college book to make sure I was asking the right question. FFT,
DFT, DTFT,
FIR, etc. and what fourier transform do I really
need to ask about? Or did my questions not clear that up with the
words
frequency analysis of an audio file? Sometimes it takes tough love
to understand and know which are the right questions to ask. Thanks.
Maybe I should have been more specific with my questions?
Everything should be as simple as possible but not simpler.
--Albert Einstein
How to...
1. Open an audio file and get that mono or stereo audio file into a
buffer and c/m/re/alloc the buffer size to the size of the audio file.
2. How to extract the audio file data samples (from audio file
buffer) to give to some of the fourier transform routines that
apple provides at the developer site in SDK.
Then once I have the 2D data from the fourier transform function, I
will plot in an NSView
the frequency, and the dB of each sample point that I am assuming gets
put into another buffer from the apple supplied fourier transform
routine? That way I will be able
to see the frequency spectrum of an audio file. All the way from
20Hz to 20kHz. Then I'll develop the code further so I can see in
an NSView
the frequency spectrum of different audio files layered on top of
one another.
Say for instance I recorded a band, there will most likely be lots
of individual tracks, kick drum, snare, electric guitar, bass
guitar, vocals, then
I can see how the different frequency spectrum of each track(diff
colored plot lines), or instrument
looks like, so I can provide the necessary frequency spectrum space
each instrument needs in the
mix EQ wise so all the instruments are heard in the final mix, and
not fighting
frequency wise.
That is my goal to learn how to do programming wise in Objective-C.
I haven't looked at the Audio Units developer info because I want
this to be an application,
and not just an AU that runs in real time. But maybe I need to
start looking at the AU
documentation instead for additional info?
I don't mean to ask loaded questions if that is what you meant from
below. But since I didn't know the lower level or higher level talk on
the forum when I signed up I figured to ask a higher level question
for starters for the knowledge. Thanks again.
Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden