1

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.

Roberto Amoroso
  • 146
  • 2
  • 6
  • Welcome to StackOverflow. Do realize that there are a number of possible avenues for investigation: https://stackoverflow.com/search?q=%5Bandroid%5D+3d+audio I would also look at VR/AR audio solutions like https://resonance-audio.github.io/resonance-audio/ Good luck. – Morrison Chang May 23 '20 at 03:23
  • Thank you so much for the suggestions, but unfortunately none of the answers currently on the site offer a solution to my problem. About the VR/AR solutions, they are made for sounds and not for music files so they don't fit in my case. In fact, I need to apply the 3D audio effect while streaming songs (the source of the `MediaPlayer` is the URL of the audio file to be played). – Roberto Amoroso May 23 '20 at 21:04

0 Answers0