• 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: Audio Buffers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio Buffers


  • Subject: Re: Audio Buffers
  • From: john <email@hidden>
  • Date: Fri, 10 Oct 2003 22:17:59 -0400

Hi Daniel,

If you're wanting to save the data from a float - which is the type coming through the IOProc - to a double, the simplest method would be to just do a for loop and copy the mData into your array.

Michael Thornburgh's excellent MTCoreAudio framework comes with an example app (AudioMonitor) that has a routine called audio_copy() which has a reasonably extensive example of copying data from the inInputData parameter, though it might be more complicated than what you're looking for.

Personally what I've done is just declare a regular float array that's sole purpose is to hold the data from the IOProc for processing. I do a memcpy on the inInputData->mBuffers[0].mData into the array. If you want to save the data permanently, you could save into an NSData but it would probably get very large - maybe a better idea is to create another thread that saves to disk.

Hope this helps.

-- John


Ok, so I have this audio buffer and I need to convert it to a double array to read it into my FFT. I know that most of you know the answer to this, and it's not listed anywhere in the docs, so please just take 30 seconds to help me out... All I need is to convert an Audio Buffer into a double array. Thanks.

Daniel Currie

Hi, I'm new to this, so I hope you don't mine some newbie questions...

I've just finished setting up an audio recorder, based on Kurt Revis's
example on the CoreAudio Swiki
(http://www.mat.ucsb.edu:8000/CoreAudio/13). In the IOProc I end up
with an AudioBufferList, inInputData. So I guess I can get the buffer
by using inInputData and mBuffers[0], and then I want to get the mData
from the buffer, I think... Would &inInputData->mBuffers[0].mData be
the right syntax? What sort of format is this data in? Can I just
read it into an NSData object? NSArray?
_______________________________________________
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: Audio Buffers (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: Re: AU version hex format
  • Next by Date: Re: coreaudio-api digest, Vol 2 #876 - 13 msgs
  • Previous by thread: Re: Audio Buffers
  • Next by thread: Debugging a MIDServer Driver Plugin
  • Index(es):
    • Date
    • Thread