Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverb with OpenAL on iOS

Tags:

ios

iphone

openal

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.

like image 809
c0dec0de Avatar asked May 21 '11 21:05

c0dec0de


2 Answers

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!

like image 172
urish Avatar answered Nov 17 '22 00:11

urish


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.

like image 26
Martin Avatar answered Nov 17 '22 01:11

Martin