Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Advanced Audio API for decompressing format

On iOS, is it possible to get the user's audio stream in a decompressed format? For example, the MP3 is returned as a WAV that can be used for audio analysis? I'm relatively new to the iOS platform, and I remember seeing that this wasn't possible in older iOS versions. I read that iOS 4 brought in some advanced APIs but I'm not sure where I can find documentations/samples for these.

like image 966
Skoder Avatar asked Feb 24 '26 07:02

Skoder


2 Answers

If you don't mind using API for iOS 4.1 and above, you could try using the AVAssetReader class and friends. In this similar question you have a full example on how to extract video frames. I would expect the same to work for audio, and the nice thing is that the reader deals with all the details of decompression. You can even do composition with AVComposition to merge several streams.

These classes are part of the AVFramework, which allows not only reading but also creating your own content.

like image 146
Grzegorz Adam Hankiewicz Avatar answered Feb 25 '26 22:02

Grzegorz Adam Hankiewicz


Apple has an OpenAL example at http://developer.apple.com/library/mac/#samplecode/OpenALExample/Introduction/Intro.html where Scene.m should interest you.

The Apple documentation has this picture where the Core Audio framework clearly shows that it gives you MP3 out. It also states that you can access audio units in a more radical way if you so need.

The same Core Audio document gives also some information about using MIDI if it may help you.

Edit: You're in luck today.

like image 42
Kheldar Avatar answered Feb 25 '26 23:02

Kheldar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!