Sample rate for iPhone audio recording

Boon picture Boon · Oct 25, 2009 · Viewed 12.9k times · Source

What's the lowest optimal sample rate for audio recording on iPhone while still yielding good file size? Currently I am using 44.1kHz but it produces file that's way too big.

Answer

lucius picture lucius · Dec 31, 2009

On the iPhone with the built-in microphone, you're going to get a maximum of 8 kHz. If you use a headset, you can get 44.1 kHz. If you're using the built-in mic and setting your recording sample rate to 44.1 kHz, you're upsampling the audio, which is unnecessary and generates the big files you mention. Also, make sure you record in mono. That cuts the file size in half.

If you always want to record at the best rate, you should ask the hardware:

size = sizeof(sampleRate);
err = AudioSessionGetProperty (kAudioSessionProperty_CurrentHardwareSampleRate,
    &size, &sampleRate);

For voice, you can just always record at 8 kHz. For music, you want the best quality so use the sample rate that the hardware is running.