4

I want to record audio with iPhone and then upload it to server.

I could record the audio, but my question is about which format should I use to record audio, so that the Recorder will result a file with smallest file size.

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
Jitendra Singh
  • 2,103
  • 3
  • 17
  • 26

3 Answers3

9

Here are the results for few encoding supported by iPhone. Size of audio file in KB of duration 10 sec.

kAudioFormatMPEG4AAC : 164,

kAudioFormatAppleLossless : 430,

kAudioFormatAppleIMA4 : 475,

kAudioFormatULaw : 889,

kAudioFormatALaw : 889,

Among these kAudioFormatMPEG4AAC is having smallest size.

Jitendra Singh
  • 2,103
  • 3
  • 17
  • 26
3

Apple iOS supports playback audio in these formats:

  1. AAC (MPEG-4 Advanced Audio Coding)
  2. ALAC (Apple Lossless)
  3. HE-AAC (MPEG-4 High Efficiency AAC)
  4. iLBC (internet Low Bitrate Codec, another format for speech)
  5. IMA4 (IMA/ADPCM)
  6. Linear PCM (uncompressed, linear pulse code modulation)
  7. MP3 (MPEG-1 audio layer 3)
  8. µ-law and a-law

For recording following formats are possible:

  1. AAC (MPEG-4 Advanced Audio Coding)
  2. ALAC (Apple Lossless)
  3. iLBC (internet Low Bitrate Codec, for speech)
  4. IMA4 (IMA/ADPCM)
  5. Linear PCM (uncompressed, linear pulse-code modulation)
  6. µ-law and a-law

while only AAC supports hardware-assisted encoding (see Apple iOS SDK documentation)

For the universality in availability I prefer MP3.

Check these links to find exact code to record audio - Recording Audio on an iPad with AVAudioRecorder

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
  • Can you please confirm that which iOS versions are supporting AMR (Adaptive Multi-rate) audio for recording and playback? – User97693321 Oct 29 '12 at 12:18
  • 1
    sorry, AMP is supported for playback only. – Srikar Appalaraju Oct 29 '12 at 13:17
  • 4
    According to the following documentation, MP3 is not supported for recording, only playing. http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW6 – Oded Ben Dov Dec 23 '12 at 13:17
  • This list is not up to date: see supported audio formats in the Apple iOS SDK Documentation: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html – Michael Dorner Jun 09 '14 at 05:26
0

It depends on the type of audio you are recording and the audio quality you want.

If for example, you are recording voice with the built in mic, iLBC will give you the smallest audio file (15.2 kbit/s for 20 ms frames, 13.33 kbit/s for 30 ms frames).

Eric
  • 2,045
  • 17
  • 24