The first thing to do would be to be clear about just why you want to
do this. Do you want to show when clipping is happening? How much
headroom you have before clipping? Whether there's sufficient audio
input? Presence of noise? Just a pretty display to assure the user
it's working and look cool?

There are several things you can monitor -- peak levels with decay
(multiply at each frame by a number slightly less than 1.0, and if the
absolute value of the level exceeds that, replace the value with
that), or RMS -- at each frame, multiply by a value slightly less than
1 , and add the square of the current level. Take the square root
before displaying. In either case, the multiplier determines how
quickly values decay, Depending on how you want to display it, you can
maintain a couple of levels -- one "instantaneous", one smoothed, or a
whole array of them with shorter-to-longer time constants, or shorter-
to-longer delays (offsets back into the data).

You can also do a Gabor transform on the data, and display different
frequency components differently -- for example, focus on frequencies
within the range of human speech -- or REJECTING those frequencies,
and indicating the presence of distracting noises. (A Gabor transform
is a time-limited variation of the Fourier transform you may be more
familiar with).

And then you get to decide how to display it. The possibilities there
cover just about ever graphics and animation technique out there, so
that's why it's important to first decide why you're doing this in the
first place.  The simplest would be to draw a 2D rectangle whose
height corresponds to a single value you've decided to display. But
people often opt for more complicated and less useful solutions --
like chopping it up into 7 discrete "bars", or a old-fashioned 'VU
meter'.

On Mar 18, 6:54 am, manigault <manig...@gmail.com> wrote:
> Hi i have an application that records audio and i want to add an
> indicator which shows the volume of the recorded audio ( in real
> time ). Any ideas how to do is. Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to