Re: Sample Code to record audio
Re: Sample Code to record audio
- Subject: Re: Sample Code to record audio
- From: Jens Bauer <email@hidden>
- Date: Sun, 1 Feb 2004 17:08:29 +0100
Hi Jean,
On Sunday, Feb 1, 2004, at 11:08 Europe/Copenhagen, Jean-Baptiste wrote:
Hello, I'm looking for a sample code to show me how to record and save
to a file an audio sound, I'm new to this API, and any pointer to a
documentation or a sample code would be very valuable to me. thanks in
advance.
Try having a look at
http://objc-source.com/junkyard/ and download
DoubleBufferRecord.tgz.
I wrote this utility, to receive an audio-signal from an Atari ST (I
couldn't get my serial-interface to work on the Mac, and still can't).
Unfortunately, I named the file "DoubleBuffer" + "Record", but uhm, it
seems I forgot about implementing the double-buffer part. :)
But I believe that these days, we're not using the double-buffer system
anymore (anyone, please correct me), it seems to me, that we receive a
buffer address, which contains the received sound data; this *could* in
technically be one part of a double-buffer, but I believe that it could
also be just a chunk (eg. a part) of the data received since last time
the callback was called.
The loading-system is the system taken from the good ol' Sinclair ZX
Spectrum home computer (from 1982).
[I extended the loader, so it could load blocks larger than 63k, and I
loaded a 500k file from the Atari ST, took around 50 minutes.]
Take a look at the Controller.m file, especially these methods:
OSStatus recordCallback(...) // this function is the installed
callback that reads the data from the input device (eg. microphone)
- (id)init // sets up the callback(s)
I also install a timerTask, but you shouldn't need this. This is just
for visual effects and for storing the data on disk periodically. =)
Hope this helps. Note: You should probably try and store the data
directly within the callback, and not do as I did. ;)
Love,
Jens
_______________________________________________
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.