Try using AudioManager.STREAM_MUSIC when calling the setStreamVolume(...) method. In a speech example, the volume of the multimedia affects if I adjust the volume of music on my phone, so I think STREAM_MUSIC is what you need.
EDIT: This code works great for me ...
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE); int amStreamMusicMaxVol = am.getStreamMaxVolume(am.STREAM_MUSIC); am.setStreamVolume(am.STREAM_MUSIC, amStreamMusicMaxVol, 0); tts.speak("Hello", TextToSpeech.QUEUE_FLUSH, null);
The maximum volume for STREAM_MUSIC on my phone is 15, and I even checked this by replacing amStreamMusicMaxVol with my call am.setStreamVolume(...) above with values โโof 3, 6, 9, 12, 15 and speech volume correctly set.
source share