[gst-devel] How to simulate a VU meter?

Erik Blankinship jedierikb at gmail.com
Sat Nov 13 01:11:04 CET 2010


What is the best way to simulate a VU meter [1] with gstreamer?  (
Preferably, I would get value readings as a percent... unless  I make it go
to 11 :-) )

I am currently grabbing buffers on their way to a fake sink, and then using
numpy in python extracting an average value out of the buffer:

temp_ay = np.asarray( fromstring( buffer, 'int16'  ) )
v = 0
for b in temp_ay:
v = v + abs(b)
avg = v / len(temp_ay)



Using this approach, I don't know what the upper bound is... I just get some
value which appears to go up and down as I make noise.

This works, but surely there is: (1) a better way; (2) some way to know what
the upper bound is so a percentage can be calculated?

Thanks!

[1] http://en.wikipedia.org/wiki/VU_meter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20101112/acf80d40/attachment.htm>


More information about the gstreamer-devel mailing list