• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AudioUnit and FFT (Daniel Todd Currie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioUnit and FFT (Daniel Todd Currie)


  • Subject: Re: AudioUnit and FFT (Daniel Todd Currie)
  • From: Daniel Todd Currie <email@hidden>
  • Date: Wed, 17 Mar 2004 15:30:46 -0800

Jay,

The frequency is dependent upon the audio sample rate and the size of inputData (which is the same size as outputData). The frequency calculation would be something like this:

particularFrequency = particularOutputDataIndex * (audioSampleRate / outputDataSize);

For example, if the index in question is 128, and you are sending 512 samples from a 44.1 kHz audio source, then the frequency for that index would be 11.025 kHz. Index 0 is therefore the DC component of your audio signal.

So if you want to increase the accuracy of your FFT, you need to give it more samples. However, these samples needn't be real data. You can actually milk more accuracy from the FFT by appending a couple thousand zeros onto the end of your inputData array. I'm not entirely qualified to comment on the tradeoffs in doing this, but I do know that adding zeros to the input array is relatively standard practice.

The world of FFTs goes much deeper than this, yet we have now nearly exhausted my knowledge of the subject. Feel free to contact me with any other questions, though I may not have an answer for you. There are numerous detailed resources online; one good resource in particular can be found here:

http://www.dspguide.com/

-- Daniel


On 2004 Mar 17, at 11:03, Jay Ridgeway wrote:

Hmmm... this works. Excellent!

How do you find the frequency associated with a particular index in the
outputData float array? Thanks.

Jay

email@hidden wrote on 2/28/04, 1:00 AM:


A very simple implementation using FFTW on a single-channel array is as
easy as this:

fftwf_plan p;

p = fftwf_plan_r2r_1d(fftSize, inputData, outputData, FFTW_R2HC,
FFTW_ESTIMATE);

fftwf_execute(p);
fftwf_destroy_plan(p);


--
bStandards are a vehicle of communication for producers and users. They
serve as a common language, defining quality and establishing safety
criteria. Costs are lower if procedures are standardized. Training is
simplified. And consumers accept products more readily when they can be
judged on intrinsic merit.b
-- American Society of Testing and Materials (ASTM)
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Re: AudioUnit and FFT (Daniel Todd Currie) (From: "Jay Ridgeway" <email@hidden>)

  • Prev by Date: Re: AudioUnit and FFT (Daniel Todd Currie)
  • Next by Date: Re: Sound Input Values
  • Previous by thread: Re: AudioUnit and FFT (Daniel Todd Currie)
  • Next by thread: measuring overall CPU load
  • Index(es):
    • Date
    • Thread