Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Record audio on iPhone with smallest file size

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.

like image 748
Jitendra Singh Avatar asked Dec 16 '22 09:12

Jitendra Singh


2 Answers

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.

like image 65
Jitendra Singh Avatar answered Dec 29 '22 00:12

Jitendra Singh


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

like image 36
Srikar Appalaraju Avatar answered Dec 28 '22 23:12

Srikar Appalaraju