0

I'm using MediaPlayer to play a song I have in my raw folder

mPlayer = MediaPlayer.create(this, R.raw.song1;);
mPlayer.start();

Is there a way I can visually see the volume levels as the song is playing? So something like this, but it can be very basic so I can tell when the song is loud or not

enter image description here

Pam
  • 78
  • 7

1 Answers1

0

It is actualy depend upon how much steps You want

Let's suppose you want maximum volume of 100 steps

int maxVolume = 100;

then you can set to setVolume any value (0-99) in range try this:

 `float volume = (float)(Math.volume(maxVolume - currVolume)/Math.volume(maxVolume));`

yourMediaPlayer.setVolume(1-volume);

pawan kasar
  • 170
  • 1
  • 6