Adding Audio Effects in android

Hi Bitfield,

Sorry for the delay. I’ve been on travel.

[QUOTE=bitfield;29678]Hi Erik,
Based on your reply I tested the unmodified code on HTC ONEX,NOTE1,NOTE2 android 4.1.2 version unable to get reverb effect for buffer queue playback.Unfortunately I tested it on tab android version 4.1.1. There I am able to feel reverb effect.So what is the problem in other devices and the other things I need to ask which are mentioned below.

As reverb effect is attached to outputmix in ndk sample code.

  1. when SLEffectSendItf is exposed for buffer queue playback I am getting effect.but when I create effect send interface for asset audio player.At that point I am unable to get reverb effect.Is there any difference when the music is played by using bufferqueue(using pcm decoded file) and asset(path of the file).

2.Is there any way to decode mp3 file to pcm format in opensl es.

I decoded mp3 using mediacodec in android and passed that byte data to bufferqueue i am getting noise…
[/QUOTE]

For the first part: I don’t the difference between the two versions of Android, but if you are getting different results on two versions of the operating system, I suggest consulting an Android forum to see if they know any differences between the two versions.

For the second part:

  1. When you are using an asset audio player, are you using the same content as for the buffer queue? From your description I believe that you have a file that you decode to PCM not through the OpenSL ES implementation and then submit it using the buffer queue. You are then getting the wanted result from the reverb. That is good. Then you play the original file through the system codec and using the same code except that you use a SLDataLocator_URI instead of SLDataLocator_BufferQueue. I can’t explain it, but you should be getting the same results if you use the same input. Have you tried to load the PCM data through a file?

  2. Yes and no. OpenSL ES was not really designed to do this - one reason is to protect DRM protected content. But if the system allows it, you can use a buffer queue as a data sink for the player. Support for this wasn’t added until 1.1 when we added object chaining so that you can hook a recorder to a player object in order to do transcoding.

For your transcoding the MP3 into PCM and submitting it through a buffer queue, have you verified the pcm data using other means? Since you have successfully managed to submit through the buffer queue then you know the chain works. If you are getting noise then I would suspect your PCM data.

Best,

Erik