Where to start for making a program to convert MP3 files to iphone audiobook (M4B) format? - iphone

I'm new to programming and want to find something that I can work on to help learn more about it. I want to do this is C++ if possible. What i want to do is start working on developing a program that has a user interface and will convert an mp3 into an m4b (the format iphone uses for audiobooks. I have been looking for some source code examples but have had no luck. If anyone can give me some places to start that would be great. Thanks

This is really trivial with the Audio Converter Services that are part of Core Audio.
I know it is not cool to just post a book reference but I really highly recommend Learning Core Audio: A Hands-on Guide to Audio Programming for Mac and iOS if you want to do Core Audio stuff.
Chapter 6 is all about audio conversion from one format to another.

M4B simply is a MP4 file (AAC encoded) with the extension M4B. So it basically is an MP4 file with a renamed file extension.

Perhaps consider using an encoding library such as ffmpeg.

Related

Is it possible to convert audio file with some music notes?

I have a music file with a particular tone(music.mp4). I want to convert existing sound file (speech.mp4) into the tone which is specified in music.mp4. Its like converting a speech into some particular tone. I do not want to play both files simultaneously. I want to convert source file with help of some music file. So, output file will be converted file.
Is it possible? I searched for Audio Unit Hosting and Multimedia guide. But do not get any clue.
Thanks in advance.
The answer is: it sounds (no pun intended) like it would be possible with the iOS. You just need to find someone who knows how to program that specific functionality. I do not know why you would think to find the answer in the Apple Docs. I want to know if it's possible to program music that plays backwards. I want to know if I can program a sound that converts my words into something my dog understands. I can't imagine the documentation could possibly cover everything everyone ever wants to program an iPhone to do.
There are no iOS public APIs for frequency analysis of audio files. You would have to write your own DSP code for that. The AVFoundation and Accelerate frameworks have some audio file conversion and math functions that may help, but that is only a small portion of the code needed.

Convert .wav file to .mp3

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
CoreAudio framework has an API called Extended Audio File Services, which enables converting from one format to another. See here: http://developer.apple.com/library/ios/#samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009222-Intro-DontLinkElementID_2
Following on to sbooth's answer about LAME, there's a separate post on StackOverflow that gives you what you need to create a .a for the library:
How can I compile lame as static library(.a) for armv6 and armv7 of iPhone?
Once you have done that, follow LAME's docs and you're set.

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.

Create video in iPhone

I need to convert image sequences(ie,png) to video file in iPhone. How i can convert the images to video.
Regards,
Just ignore bad advice like "use ffmpeg". That would work on the desktop, but the license issue makes including ffmpeg source code in your iPhone app legally questionable. Apple provides a class named AVAssetWriter that you would use in your app to encode a series of images as h.264 stored in a .m4v quicktime container file. While the apple provided logic does work, it is not so easy to actually use and you will need to read quite a lot of documentation to get the code working. If you want to skip implementing it yourself (and likely save yourself 3 or 4 days of work), please consider using my AVAnimator library for iOS as the h.264 encoding logic is already implemented in the class AVAssetWriterConvertFromMaxvid. Once encoded as h.264, the video can be played with the standard player and it is small enough to upload to a remote server.
You are likely going to need something like FFMPEG

Play midi file on the iPhone

Is it possible to play .mid files directly via some API, or one have to convert the midi file to e.g. AAC first?
(2 years later…) You can use MusicPlayer and MusicSequence APIs. Available in iOS 5.
There is no Apple API for this. You could write your own, which i think would depend on what you are hoping it is going sound like.
There is lots of available source code for reading midi files and there are a few open source synths for the iphone - or you could use openAl for triggering samples. It probably isn't going to sound like Garageband tho.
If you want it to sound as good as possible you will have to convert it first.