I want to record audio using the iphone (< 2 minutes) and save it to a file. I looked at SpeakHere, but it confuses me. Which classes do I use? What delegate methods do I create?
Thanks!
I want to record audio using the iphone (< 2 minutes) and save it to a file. I looked at SpeakHere, but it confuses me. Which classes do I use? What delegate methods do I create?
Thanks!
I agree, SpeakHere is not a very good starting point to learn iPhone audio.
iPhone audio uses two concepts. AudioQueues, and AudioSessions. If you want to record to a file, you will need to create one AudioSession, activate the session, and create an AudioInputQueue and an AudioOutputQueue.
The reference for AudioQueues (by far the part you will deal with most) is:
As for AudioSessions:
Though you can ignore most of the AudioSession stuff since you won't be doing anything quite that complicated. So basically, here are the steps:
I didn't include all parameters here, but that's what the API is for.
Hope that helps.
[EDIT]
Sorry, forgot to include the output stuff, though they are fairly straight forward. Create another AudioQueue, initialize with an AudioQueueNewOutput, and the API should be able to guide you the rest of the way.
Cheers.
AudioQueues are no longer needed to record audio. It is now a very simple process using the AVAudioRecorder class.