I want to convert an audio file saved with .wav file format to a file with .mp3 format.
Please suggest that how can I achieve this through Objective C coding.
Thanks in advance.
You'll have to use LAME to do this. Apple doesn't ship an MP3 encoder due to patent issues.
Take a look at the AVFoundation
framework, especially the AVAssetWriter
class. It’s very powerful, but it takes some time to digest. There is a nice blog entry by Chris Adamson on decoding songs from the iPod library to PCM. It’s exactly the other way you want it, but it’s a good start.
I don't think there is an API in AVFoundation for that. I think If you use AVAssetWritter you can write *.m4a (AVFileTypeAppleM4A) files which are *.acc, I believe. (ACC are lighter and better than mp3, so a good alternative to mp3)
If you use CoreAudio probably is going to be a lot much work but it should be possible to write mp3. I asked how to read mp3 using coreaudio in apple-lists like 2 years ago and I got code that makes speakHere sample app able to read *.mp3 ;)
Perhaps, you are interested: Newbie trying to play mp3 files instead wav files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With