Re: Using MTCoreAudio
Re: Using MTCoreAudio
- Subject: Re: Using MTCoreAudio
- From: Michael Thornburgh <email@hidden>
- Date: Sun, 9 Oct 2005 10:38:55 -0700
for the general problem of writing audio to the disk, you should use
the AudioFile API (with which i am not familiar, but plenty of other
folks on the list are). there appear to be some examples of using it
in /Developer/Examples/CoreAudio/Services/AudioFileTools.
when using MTCoreAudio and an MTAudioBuffer, i would have a second
thread responsible for writing audio from the MTAudioBuffer to disk.
your IOProc should write into the MTAudioBuffer in non-blocking mode
(-writeFromAudioBufferList: ... maxFrames: ... rateScalar: ...
waitForRoom:NO), and your write-to-disk thread reading from the
MTAudioBuffer in blocking mode (-readToAudioBufferList: ...
maxFrames: ... waitForData:YES).
the MTAudioBuffer should only need to be a few seconds long -- long
enough to deal with any pauses in your write-to-disk thread (such as
when data is flushed to disk, or if there is contention for disk
bandwidth). it is often suggested on this list that disk buffering
be turned off for your file (see fcntl(2), cmd F_NOCACHE).
-mike
On Oct 9, 2005, at 8:54 AM, Olivier Destrebecq wrote:
I read through the mailing list archive and the exemple coming with
MTCoreAudio and could not find answer to those question. I'm
totally new to sound recording and processing, and thus might have
missed the obvious.
I'm trying to use MTCoreAudio to record sound to the disk and i was
wondering if there was any source code sample of how to write the
file to disk. I used an MTAudioBuffer in my IOProc and would now
need to write it to disk.
Any pointer appreciated.
Also as a secondary question, what is the right approach if i want
to be able to write a 3 hours long recording. Should i try to
create aa MTAudioBuffer large enough. Or is there a way to create a
smaller one and periodically empty it to a file to which i keep
appending as time goes by? (same here, any sample code or pointer
appreciated)
Thanks in advance
Olivier Destrebecq
http://otusweb.spymac.com/portfolio/
_______________________________________________
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