LaVOZs

The World’s Largest Online Community for Developers

'; How to apply 3D audio effect on streaming audio in Android - LavOzs.Com

I want to develop an application for Android that allows you to apply a 3D sound effect when playing streaming music.

The effect that I would like to achieve is the possibility to change the virtual position of the speaker in a 3D space when the user is listening to music with headphones, i.e. be able to locate sounds in three dimensions: in range (distance), in direction above and below (elevation), in front and to the rear, as well as to either side (azimuth).

I am using MediaPlayer and AudioFx for basic audio effects such as: Equalizer, PresetReverb, BassBoost, Virtualizer. None of the effects made available by AudioFx allow you to apply 3D effects.

In a nutshell, I would like for Andorid the equivalent of the AVAudioEnvironmentNode function available for IOS.

The official documentation of the Virtualizer says:

The methods, parameter types and units exposed by the Virtualizer implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLVirtualizerItf interface. Please refer to this specification for more details.

The AudioFx effects therefore use interfaces implemented in OpenSL. The OpenSL ES specification 1.1 demonstrates the implementation for 3D audio, through the SL3DLocationItf interface, which looks just what I'm looking for.

If there is no function/library that allows to apply 3D audio effects, what is the least painful way to use OpenSL SL3DLocationItf interface in combination with my current implementation of the MediaPlayer and Audiofx?

It would be perfect extend the AudioFx library to add only the 3D effect, thus avoiding having to work with NDK and JNI to reimplement, in practice, a new Media Player just to add an audio effect (too much overhead).

Any help and suggestions would be greatly appreciated.

Related
Is there a way to run Python on Android?
How to lazy load images in ListView in Android
How to get screen dimensions as pixels in Android
Close/hide android soft keyboard
How to stop EditText from gaining focus at Activity startup in Android
Is there a unique Android device ID?
What is 'Context' on Android?
Proper use cases for Android UserManager.isUserAGoat()?
Make some audio effects and store it in a mediaplayer