Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to record something other than Linear PCM on iPhone

I'm having a hard time trying to record something other than linear PCM on the iPhone :-( The samples I've found (SDK's SpeakHere, Zdziarski's and Sadun's books and the one at trailsinthesand.com) all use linear PCM but I'd like a commonly used compressed format instead (no ima4 or whatever the name is...).

I just cannot figure out how to tweak the sample code to be used with, for example AAC, MP3 or AMR instead. Any suggestions and hints for how to do that are much appreciated!

(Btw, I do not think an MP3-encoder nor AMR-encoder are available due to licensing issues, but AAC does exist, or???)

Edit/Update: I stumbled upon the following text in Apple's "iPhone Application Programming Guide", 2009-01-06, page 137, section: Recording Audio:
"You can record audio in any of the formats listed in “Preferred Audio Formats in iPhone OS” (page 140)", and as preferred audio formats on page 140 are: "For compressed audio when playing one sound at a time, and when you don’t need to play audio simultaneously with the iPod application, use the AAC format packaged in a CAF or m4a file."
Thus, I interpret that as a clear indication that it is indeed, not only possible, but even preferable, to record audio in AAC format wrapped up in a m4a file, which is just what I want. But still, I am not able to achieve that?!

Thanks, /John

like image 367
John Lane Avatar asked Mar 24 '09 10:03

John Lane


People also ask

What is a PCM recorder?

PCM Recorder is a free app from TASCAM that turns your iPhone, iPod Touch or iPad into a portable stereo recorder. Use it with the iM2 to record yourself any- where you go. PCM Recorder has input and output level faders with an “on-screen” meter to help you check levels.

What is a linear recorder?

"Linear" refers to the fact that the data is not compressed. The original analog signal is directly represented in digital form. Most IC recorders record in MP3 or WAV or sometimes a proprietary format that compresses the digital data.


1 Answers

Keep looking at those docs. In "Core Audio Essentials", the section "Core Audio Plug-ins: Audio Units and Codecs" notes that:

iPhone OS contains the recording codecs listed in Table 2-5. As you can see, neither MP3 nor AAC recording is available. This is due to the high CPU overhead, and consequent battery drain, of these formats.

Table 2-5 lists several formats, but as the text notes does not include the ones you're looking for. If you want those formats you'll have to bring your own encoder.

like image 105
Tom Harrington Avatar answered Oct 07 '22 05:10

Tom Harrington