Audio Library C++ for a multicross platform use (iphone, android...) - iphone

i'm trying to make a C++ engine that will read a mp3 file, and make some image zoom/translation depending on the time of the reading sound file. I think I could use OpenGL ES to render what I want, and calling some OpenGL ES instructions in my C++ files, and init my drawing context in Obj-C/Java. I want to do the same for the sound, but i don't really know what to use, and if I can really do it or not in C++.
I searched for library so I found Bass and Fmod (which is not free for commercial use). They said it's multicross platform (Windows, Unix, MacOS) but I dont understand if it manners for mobile, and if I can really use it. Does anyone have been through this? Do you recommand me another free library?
Thanks again, and I apologize for my poor english,
Arnaud

Have a look at libpd (Pure Data for embedded applications)
http://download.puredata.info/libpd (the library has been released very recently, but the code is very mature indeed)
http://createdigitalmusic.com/2010/10/libpd-put-pure-data-in-your-app-on-an-iphone-or-android-and-everywhere-free/

Audio is often problematic and it is pretty much always a good idea to write your own high-level API that does exactly what you want to do (and nothing else) and to assume you will then be writing a thin layer between it and whatever audio library you are using underneath. If you're lucky and there's a library available that does things the way you would do them then it's trivial. If not, at least it's still possible. In either case, your app code is not tied to an external sound API.
I have used FMOD on multiple different commercial projects over the years for PC, Mac and iPhone, and have always liked it - but it's not free. OpenAL has always seemed sorta, I dunno: clunky? But you only have to deal with it when writing your API layer, and your app code never has to see it.
It's easy for me to say "write your own API" since I've been writing commercial games for 20 years and so know what I think an audio API should look like. If you don't have your own idea how you think it should be, then I suggest you look at a 3rd party library that makes sense to you and take the functions from it that you will be using and write your own API to do be a set of functions that do nothing but call those.
Since you have both OpenAL and FMOD available to you free for development you can then make your API work with both, and chances are it's then going to work with anything else you might come across.

OpenAL may be your best bet. Look at this answer: Android OpenAL?
It seems possible to compile OpenAL on Android.

If you are looking for just PCM audio input/output ( and not MP3 decoding ) try PortAudio or RTAudio
RtAudio or PortAudio, which one to use?

Related

Sound Effect Library/Extension for OpenAL (running on iOS)?

I want to do some DSP effect processing, create effect like flanger, echo, etc.
Could it be done via OpenAL? Or should I use enterely different framework/library?
Since iOS 5.0 some of the DSP effects are natively supported by OpenAL.
For example, reverb is supported with emulation for more than 10 different spaces (Small/Medium/Large Room, Medium/Large Hall, Plate, Medium/Large Chamber, Cathedral and several variations).
You can find a good reference implementation in the ObjectAL wrapper. The repository is available at https://github.com/kstenerud/ObjectAL-for-iPhone
Grab the source from this repository, load "ObjectAL.xcodeproj" and run the ObjectALDemo target on any iOS 5.0 device (should also work on the simulator). This will give you a good starting point and feeling of what the reverb effect is capable of. I personally recommend taking advantage of the ObjectAL library instead of working with OpenAL directly.
Good luck with your project!
Just write your own audio library. iOS devices don't have hardware acceleration for OpenAL. It isnt particularly difficult to do, and then you can also use apples audio units (some of which are hardware accelerated).

Reverb with OpenAL on iOS

Is there any possible way to do reverb using OpenAL on iOS? Anyone have any code snippets to achieve this effect? I know it's not included in the OpenAL library for iOS, but I would think there's still a way to program it in.
Thanks.
Reverb is now natively supported in OpenAL (as of iOS 5.0). You can view a sample implementation on the ObjectAL project:
https://github.com/kstenerud/ObjectAL-for-iPhone
Just grab the most recent source from this repository, load "ObjectAL.xcodeproj" and run the ObjectALDemo target on any iOS 5.0 device (should also work on the simulator).
The actual implementation lies in two places:
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/OpenAL/ALListener.m
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/OpenAL/ALSource.m
Look for the word 'reverb' in these files (and the corresponding header files) to find the name of the OpenAL properties and constants used to set and control the reverb effect.
Good luck!
You could use pre-rendered audio if the situation allows it. If you want to do it real time look into DSP. Theres no way do to this out of the box that I am aware of.
The additional desktop APIs like EFX and EAX use hardware signal processing. Maybe in the future these hand held devices will implement the full OpenAL and OpenGL APIs, but for now we have the stripped down versions, for practical reasons like cost and battery life etc.
I'm sure there is a way, but its not going to be easy.

Acoustic fingerprint code for iOS?

I've started looking on the subject of Acoustic Fingerprint (http://en.wikipedia.org/wiki/Acoustic_fingerprint) for a pet project of mine for the iOS and I was wondering if there are:
Any opensource libraries or source code for the iOS that handle this?
Assuming I'm a veteran jack of all trades coder, is it very problematic to implement this myself if there is no open-source versions?
Will the Accelerate DSP library in iOS able to handle such a task?
Thanks
you may want to check out the EchoPrint CodeGen library by The Echo Nest. They even have a fully functional iOS code example.
You can find some additional links to open source audio fingerprinting related software in this MusicBrainz article, but AFAIK the EchoPrint library is the only one that has a license that is compatible with iOS apps.
Good Luck!
Not of my knowledge
No problem for a veteran, that won't be easy, but achievable.
Never looked into.
Even in java, this might be an interesting reading.
Before doing anything, especially if you intend to sell on AppStore, take care that these techniques/algorithms are patented. Read what happened to the above blog post writer.
Will the Accelerate DSP library in iOS able to handle such a task?
NO
I also notice that you put the tag "voice recognition". Just to make sure voice recognition as nothing to do with audio identification/acoustic fingerprinting !!

How to develop an iphone app with reverb functionality?

I am developing an iPhone application (like Audio Processing). I have to give some effect to the audios.
If it is desktop app, many options are there. We can get good examples and full project like audacity. But I want to develop for iPhone.
I got an app with reverb option; (take a look at following link). Just I watch the "video", I did not test this application in my iPhone device.
http://www.appstorehq.com/reverb-iphone-89870/app
My question is; How can I develop the app with reverb functionality ? Is there any documentation for that ? If it is, just share with us.
NOTE: We can use AudioUnit to develop the app with reverb functionality (I am not clear with this.).
EDIT: I don't like to use any third party library.
If anybody having knowledge about this, please share with us.
Thanks.
if yourre targeting ios5 you can just the audio unit subtype kAudioUnitSubType_Reverb2 of the effect audio unit.
reverb unit
AudioComponentDescription auEffectUnitDescription;
auEffectUnitDescription.componentType = kAudioUnitType_Effect;
auEffectUnitDescription.componentSubType = kAudioUnitSubType_Reverb2;
auEffectUnitDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
AUGraphAddNode(
processingGraph,
&auEffectUnitDescription,
&auEffectNode),
Failing that you could just write your own reverb code in the remoteio callback. A simple delay might be easier to do and would sound similar.
iOS 5.0 brings native OpenAL support, so it is now much easier - you don't have to code the algorithm yourself. It also bring support for a variety of reverb spaces:
Small Room
Medium Room
Large Room (2 configurations)
Medium Hall (3 configurations)
Large Hall (2 configurations)
Plate
Medium Chamber
Large Chamber
Cathedral
I suggest that you try the ObjectAL wrapper which already has a great support for the reverb effect:
https://github.com/kstenerud/ObjectAL-for-iPhone
Grab the source from this repository, load "ObjectAL.xcodeproj" and run the ObjectALDemo target on any iOS 5.0 device (should also work on the simulator). This will give you a good starting point and feeling of what the reverb effect is capable of.
If you still don't to use any 3rd party library, you can just grab the relevant pieces from ObjectAL. Look for the reverb-related code in the following source files (and their corresponding headers):
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/OpenAL/ALListener.m
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/OpenAL/ALSource.m
https://github.com/kstenerud/ObjectAL-for-iPhone/blob/master/ObjectAL/ObjectAL/OpenAL/ALWrapper.m
Good luck with your project!
AUs are a good place to start.
write your own reverb AU which contains a reverb implementation. there are tons of ways to implement a reverb. a medium/long convolution reverb is much to ask from a phone, but something such as a FDN (feedback delay network) will not require a lot of memory or CPU.
both implementations are easy to implement, if you're familiar with audio programming and optimization. the tough part is actually making one that sounds very good and performs well.
if you're unable to write optimal low level code or you do not (presently) understand basic audio signal processing, then you'll have a few obstacles to overcome -- it may be a long road in that case.
Searching the iOS documentation for "reverb" produces a link to the Core Audio Overview, which references reverb as an "effect unit." Perhaps that's worth further study?
No good, I have attempted the audio unit approach and even though it is in the documentation it is "not" implemented yet by the apple engineers. Each time you call the function to set the reverb property you will only get failure status code. You would have to implement your own reverb effect. Try reading some DSP book and you might find a clue.
you need to learn some DSP-level coding, the DSP cookbook book is okay and there are others out there. But basically you need to be comfortable with handling audio signal in the frequency domain and things such as FFT's. Once you have that, implementing a reverb filter should be straight-forward.
This is an answer I've given before, but I believe it is relevant here. I am going to agree with the others and say that you are going to have to become a bit more familiar with core-audio if you want to do this properly.
I highly recommend this core-audio book. It will teach what you need to do this right and will save you a lot of frustration.
The chapter on audio effects has not been published yet, but if it is anything like the rest of the book it's worth the wait.
EDIT
You will most likely need to do this with an audio effect (which is a form of an audio unit).

Port Flash to iPhone

How hard would it be to port a flash game to the iPhone. Obviously Flash CS5 is no longer an options, I still would like to know if there's anything that can be reused? or do I have to write everything from scratch (Is Obj-C that different than ActionScript?) Is there any other shortcuts?
Also, if anyone has done this before please share your experience.
Flash is a very different platform, not only is the language change going to be an issue you're going to be going from Flash's renderer to presumably your own using OpenGL:ES.
Although another method may be to port your app to JavaScript. Both ActionScript and JavaScript are EMCAScript dialects, so very similar in that area, the APIs will be completely different though.
http://paulirish.com/work/gordon/demos/ interesting and slightly related, this is a implementation of Flash in JavaScript.
Note the new Apple T.O.S may affect you, but as far as I'm aware it's still a beta and I'm not Apple or a lawyer so I won't try and decipher it for you.
I am doing the same thing. I am using Cocos2d for iPhone. This is a pretty good 2d game engine. Actually, two apps created with it are in the current top 25. You are going to have to get down and dirty in Objective-C though. Objective-C is different from ActionScript but if you are use to object oriented programming you should be able to make the switch. Programming a Flash game is different than typical game programming done in Objective-C/C/C++. So, if you are familiar with how to do things in the Objective-C/C/C++ game programming world (render loop, capturing inputs, etc), you'll really be ok. If not, you'll have to get use to not having the Flash timeline, dealing with frames, etc. Good luck! You can do it!
read the statements from apple, no its not possible.
For my game Hudriks I used flash to build levels and some animations. For this an animation engine has been developed that supports motion tween, and then wrote JSFL scripts that goes through Flash objects and export to a format that can be parsed in my game.
For writing the JSFL - look for document called Extending Flash.
The rest was developed from scratch using Objective C with OpenGL. Do not see option of 'one-click' compilation or converting from Flash to iPhone (not considering CS5), but with developing extensions for Flash you could reuse some work.
It is hard, but it is possible. I am working on a automatic code converter now.