Reputation: 129
I was wondering how can I boost the audio volume on an Android application.
Also, is it possible to create a service that automatically boosts audio volume of other apps?
Explaining what I want to do:
I have a Galaxy Mini phone, and its audio volume is not really that that loud. I usually listen to radio apps like ESPN and game broadcasts like the one's from the mlb At Bat app, but they can get particularly low and become difficult to hear.
Recently I installed an mp3 player app that has volume boost that works great. So I was wondering how that is done and if it would be possible to create one application that boosts the phone volume so other apps would benefit from it. Really, my interest is completly personal, since develop an app for that would be a hobby and my main interest is to be able to hear the games I love :)
Could anyone point me to how I can achieve this?
Thanks in advance Regards. Decio
Upvotes: 4
Views: 6446
Reputation: 6164
if you use a SoundPool, (look it up there is a ton of help all over online) you can have some control over this.
public static void playSound(int index, float speed)
{
float streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
streamVolume = streamVolume / mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, speed);
}
however this will still only play the original-sound at your devices max volume output (between 0.0-1.0). So it doesn't amplify the actual data of the sound (it won't go louder then your device's volume will turn it up).
If you were to use an audio file that was already included with app this wouldn't be a problem since you could amplify the sound in an editor and then add it to your project. But to amplify streaming-sound is more difficult.
Android SDK comes with a bass boost feature, but not a general amplifier.(as far as I know) To do this you will either have to write your own code, or find someone else who has done it already and use their code.
This is no trivial task. W/O a lot of previous programming experience, or programming knowledge it may take quite a bit of effort to understand all that is going to need to happen, or what you need to do to make this happen.
If you feel up to the challenge here is a good place to start.
It will teach you the basics, and give you a solid idea of what you are getting into. It wont cover exactly what you are looking for, but it will give you a good starting place for understanding the concepts of how to handle raw audio, edit it, and play it back.
Upvotes: 5