Convert .m4r/.mp3 to .caf/.aiff in iphone app - iphone

As of right now I am using ffmpeg to convert from .mp3 --> to .aiff but I would like a native way to do this in xcode but i do not understand how to use AudioConverter.h in AudioToolbox soo if someone could please help me I would be really appreciative.
Thank You
Enea

ExtAudioFile can do a fantastic job of this. One reason to take some compressed formats like MP3 and convert to PCM is that there is much less of a latency when playing the sound. An MP3 sound effect, for example, can take close to a second to start playing back, when the same sound in PCM could start almost immediately. I know since I am converting my sounds to PCM at launch time and eliminating the delays I was plagued with.
Go download iPhoneExtAudioFileConvertTest and you will find everything you need to do your own conversions

I think the real question is why would you want to? The iphone and AudioQueue has full mp3 support for playback and mixing. I know of no way to do this on the fly in the iPhone. It is a fairly processor intensive task and I doubt you could do it efficiently on the iPhone anyway.

You can use ExtAudioFile to open and convert the file to CAF with PCM data.

Related

What audio formats does the iPhone AudioServicesCreateSystemSoundID support?

I tried WAV but that failed, although I've seen example code using WAV.
I found an AIFF in another example which worked.
I'm planning on buying sounds for my app, and I want to know which format to go for.
You can also take a look at AVAudioPlayer, that’s a fairly nice sound playback API. If your WAV did not work, did it have the right endianity and sample resolution? You should be safe with little-endian sampled at 44.1 kHz, mono or stereo. You can buy in almost any format, the conversion quite very easy and can be done using free tools like afconvert.
You can use .WAV format sounds if the audio properties are acceptable to iOS. What makes them acceptable you ask? Well, I don't know the full list of metrics, but I do know I am successfully using files sampled at 8kHz, 16-bit PCM, mono.

iphone : play rm files on iphone programmatically

i have a good experince with playing audio in general on iphone but i would like to have a way to play .RM files on iphone app .. i've tried the normal approach put it didn't give me any sound at all ..
so any help??
You'll need to convert these RealMedia files into a more modern format before you can play them.
You could learn the file format and write your own decoder and obtain the pcm data, or whatever format you want the samples in, and then feed that to either AudioQueues or AudioUnits.

iOS: Create an MP3 on device

I am trying to create an MP3 audio file on the device (iPhone).
I have found that there is no possibility to record directly in MP3 format.
Only .caf file that may contain AIFF, Linear PCM etc.
I have also found here that there is an AudioConverterFillComplexBuffer function that might, theoretically, convert CAF file to MP3, but I can't find any sample code or explanation on how to use this function.
Any help will be greatly appreciated.
--
Michael Kessler
Try using LAME - open source MP3 encoder library (liblame)
http://lame.sourceforge.net/
As far as I know LAME is GPL which may be an issue for you if you are building an iPhone app.
I believe AudioConverterFillComplexBuffer indeed is the way to go. You might want to take a look at the book "Core Audio Rough Cuts" which has explanations and examples on how to convert audio.
Good luck.

how to play MID sound file in iphone?

I have implement game application in which i want to play mid sound file in the background.How it possible?
The short answer is there is no easy way. When this question came up before the best recommendation was to try porting TiMidity++. This appears to be difficult.
A more iPhoney solution would be to convert your midi file into an audio file using something such as
Easy-Pro Midi to Audio Converter 1.3
and then playing the the audio file normally in your app. This may have the downside of enlarging your app size.

Which audio format would be the best?

I was using AVAudioPlayer to play multiple audio clips back to back but there was always a small silence between tracks and then i came to know of Finch, a library which uses OpenAL to play audio. with this the silence problem seems to be solved theoretically but then i found that it doesn't play m4a or any other compressed formats.
Now i am looking for an uncompressed audio format which would have relatively less file size (though uncompressed means that all of them should have almost same size) and a method to convert, i am also googling on afconvert in a mean while.
CAF files work great for this. I've built an application that loops audio files, and I was impressed with the relatively small file size.
Check out this question for more info on converting to CAF.