How to convert itunes music files in to a low bandwidth PCM for uploading - iphone

i will like to convert itunes music files in to a low bandwidth PCM for uploading.
How to convert m4a file to aac adts file in Xcode?
Real-time converting the PCM buffer to AAC data for iOS using Remote IO and Audio Convert Service
iOS: Create an MP3 on device
i saw a few threads but not too sure how do i go about it. Could anyone provide me a tutorial link please ?
any comment are greatly appreciated.

The easiest way to convert your audio files is by using the EXTAudioFileConvert API from Apple.
Tutorial on using the EXTAudioFileConvert can be found at: Easy AAC compressed audio conversion on iOS.

Related

Video Karaoke Development on iPhone

I have a karaoke app that takes mp3+g files and mixes in the mic (using audio units)... and is able to record the final results to a raw pcm file.
I have potential clients asking me if I can do the same with a karaoke video file. So, can I...
1) playback a video and mix in the microphone audio?
2) take #1 and record it to a video file?
3) possibly even take the video camera and microphone inputs, and video audio... and save this to a file?
Thinking about this can I... take an mp3, camera and microphone inputs and mix all of these to a video file?
Thanks for any feedback!
Brian
Yes, all of these are possible. With the CD+G format, you will be a lot better off converting those to h.264 on the desktop and then loading them as movies with an AAC audio track. Attempting to write a CD+G parser for iOS would be a nightmare since so many CD+G files are badly broken. Also, CD+G files are shocking large, much larger than the MP3 files because CD+G is dumb uncompressed video from the 80's. It is a silly format.

which sound format is best for cocos2d game project?

i am new in cocos2d and facing hard time to find the best file format which is supported in cocos2d ?
and can i use ogg file format if Yes then please any link how to use it is cocos2d
No ogg on iOS. Here's the AVAudioPlayer supported audio formats list.
You also have to differentiate between background audio (streaming audio) and audio effects. For the former you should use mp3 and play only one mp3 at a time because the iOS devices can only decode one mp3 at a time using hardware. Additional mp3 are decoded with the CPU.
For audio effects uncompressed .caf and .wav files are standard. You want them to be 16-bit, mono and using a sample rate of 11, 22 or 44 kHz depending on the quality you need. Personally I would default to 22 kHz.
Here is the way to convert audio to best iOS formate: Click HERE
Open terminal and run this command:
afconvert -f caff -d LEI16 sound.wav
Any file that are supported in iPhone but for me .wav files are better.

How to convert a wav or caf audio file on iPhone

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.
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.
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.

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.

Are there any audio compression libraries on the iPhone?

Can audio being recorded be compressed on the fly?
or are there any libraries to take a .caf file, and convert to a compressed format?
The Core Audio APIs (which is what you'll be using to record audio) allow you to choose format, bitrate, etc. You can choose a low bitrate to keep the filesize down. In most cases with the iPhone, you're recording voice audio, and a low bitrate is fine.
The Audio Queue Services can record and encode audio. These are available on the iPhone. The documentation includes saving to a file of arbitrary format. I don't know if it's a perfect match for transcoding a .caf file but it's definitely worth a look.
The 2.x SDK does not have support for compressing audio.
You'll probably have to compile and link a 3rd party library.
Watch the CPU usage, it obviously won't be hardware
accelerated like the built-in decompression.