How to convert a wav or caf audio file on iPhone

2019-09-06 07:25发布

问题:

I am working on a iPhone IM app, which support audio message. I've tried caf and wav format follow "Speak Here", but the files are too large to be send through the internet. So I'm wondering if I can convert any of them to some small format, like mp3 or amr.

Thank you for you help in advance.

回答1:

CoreAudio has som great built-in datatypes for just this Core Audio Data Types

Use iLBC, short for Internet Low Bitrate Codec, to record your audio. Limit your sample rate to 8kHz.

If you insist on mp3, use LAME - the open source MP3 encoder library to convert your audio.



回答2:

After you've recorded the audio file, the iOS AVFoundation AVAsset Reader/Writer APIs can be used to convert the file by, say, reading a .wav and writing AAC or other compressed file type.