question

Amazon Customer avatar image
Amazon Customer asked

Kindle Fire MediaPlayer volume loud relative to SoundPool

I have an app that uses SoundPool for sound effects, and MediaPlayer for ambient noise. On every other device I've tested it on, the relative volumes are good, but on the kindle fire (HDX 7 3rd gen) the ambient noise from MediaPlayer is so loud it drowns out the sound effects from SoundPool. This happens with or without head phones. Is there some way to know the relative volumes of MediaPlayer and SoundPool?
fire tablet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
I used below code in HDX 7 and 8.9 (3rd Gen) and observed that the relative volume is same in both the devices. mMediaPlayer = MediaPlayer.create(this, R.raw.song); mMediaPlayer.start(); AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); float actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); float maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); float volume = actualVolume / maxVolume; // Is the sound loaded already? if (loaded) { soundPool.play(soundID, volume, volume, 1, 0, 1f); } So I am unable to reproduce what you are observing. I would appreciate if you can provide us the code snippet that you are using to play sound and effects in your app. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
I made a test loop with the following code: mMediaPlayer = MediaPlayer.create(getContext(), R.raw.ambient_noise); mMediaPlayer.start(); mSoundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); mSoundId = mSoundPool.load(getContext(), R.raw.sound_effect, 1); queueEvent(new Runnable() { @Override public void run() { mSoundPool.play(mSoundId, 1, 1, 1, 0, 1f); try { Thread.sleep(2000); } catch (Exception e) {} queueEvent(this); } }); And verified with headphones that the ambient noise is much louder on the kindle, and drowns out the sound effect compared to my android phone. For the normal app (not the test loop above) I've noticed the relative volumes are all the same on every device I've tried, including ios, except the Kindle. On the Kindle the ambient noise is much louder. Could it be related to the media files? Can I share them with you? I'm tempted to just scale the MediaPlayer volume by 0.2 for my amazon store version ... Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Can you please share the media file? Please put it in a web storage and the share the path with me. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
I don't see a way to send a private message here, where can I share the links?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Based on your directions, I wrote a sample app with a GLSurfaceView set in the activity. Below is a snippet of the code: class ClearGLSurfaceView extends GLSurfaceView { public ClearGLSurfaceView(Context context) { super(context); mRenderer = new ClearRenderer(); setRenderer(mRenderer); MediaPlayer mMediaPlayer = MediaPlayer.create(ClearActivity.context, R.raw.ambient_noise); mMediaPlayer.start(); final SoundPool mSoundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); final int mSoundId = mSoundPool.load(ClearActivity.context, R.raw.sound_effect, 1); queueEvent(new Runnable() { @Override public void run() { mSoundPool.play(mSoundId, 1, 1, 1, 0, 1f); try { Thread.sleep(2000); } catch (Exception e) {} queueEvent(this); } }); } ClearRenderer mRenderer; } the results of my test are: 1. Kindle Fire 2nd Gen (sound effect is louder as compared to ambient noise) -> API 15 2. Kindle Fire HD 7 2nd Gen (sound effect is louder as compared to ambient noise) ->API 15 3. Kindle Fire HDX 7 3rd Gen (sound effect volume is same ambient noise) -> API 17 4. Kindle Fire HDX 8.9 3rd Gen (sound effect volume is same ambient noise) -> API 17 5. Samsung Galaxy S3 (sound effect is louder as compared to ambient noise) -> API 18 6. Samsung Galaxy S4 (sound effect is louder as compared to ambient noise) -> API 19 So, the sound effect volume intensity seems different across different devices, both Amazon and generic Android devices. From my tests, the Kindle Fire HDX devices seems to have the sound effect volume the as same ambient noise.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
Thanks for testing that. So the next question is, how can I ensure the relative sound volumes are the same across all Kindle platforms? It would seem like a bug that the Kindle Fire HDX plays media files at different relative volumes than older Kindle/Android devices, right? Can/should I detect Kindle Fire HDX and only there scale up the volume of the sound effect?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
As of now, please use android.os.Build.MODEL to detect the device and adjust the relative volume in HDX devices. https://developer.amazon.com/appsandservices/solutions/devices/kindle-fire/... I am forwarding this issue to appropriate team for a permanent fix. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.