VU Community Forums

Android recording VU meter

I want to implement a VU meter in my recording app. My app is recording in WAV format and I want the VU meter to update itself at each second.

Please guide me how to do this:

  1. let’s say the sample rate is 44100 . I find the max absolute value from audioData that comes in 1 sec. Should I do this: int average = maxSampleValue / nrOfSamplesInOneSec; ?
  2. I will convert the maxAmpl like this: powerDb = 20 * log10(getAmplitude());
  3. My VU meter will be a rectangle with a fill color(green - yellow - red) . What is the maximum height of this rectangle(in dB)? And the minimum? Where(in dB) the green color should change in yellow?

Please help me with this. Also, a (short)tutorial will be very convenient for me.