VU meters on LCD

I am having difficulty displaying nice VU meter on a character display, right now I have allowed for 8 segments per channel, which I may make into

40 as you get 5 dots across per character.

Now the issue is the bars and very jumpy, either showing a couple or all of them....

I sample the audio every 1/10s and display the bars, I can sample more, but refreshing the display at a high rate is hard due to the fact I need to keep streaming MP3 data and can not miss any.

I also know audio is more logrithmic than what I am doing...

The difference from the softest to loudest on the ADC right now is 80 counts.

I would think I could make a nicer looking VU meter that "follows" the music better.

Any thoughts?

Thanks, Richard.

Reply to
Richard Sloan
Loading thread data ...

That's most likely cause by how you sample. You can't really expect a single random sample of a digitized audio signal to be in any way indicative of its overall loudness. You absolutely need a lowpass filter. An analog VU meter would do that by the sheer fact that its needles couldn't move fast enough to follow a high-frequency oscillation. If you're working in all-digital, you have to do it by computation.

For a somewhat rough 1st approximation, just average all the samples' absolute or squared values between any two updates of the meter display, and display the logarithm of the result.

A more realistic method might be to weigh the individual samples differently, depending on how old they are at the time of the meter position update. Essentially, each input sample would add a pulse to the meter's displayed value, decaying with time. You can combine the two into a formula like this:

for each sample of the input: output = f * output + (1-f) * input

for some dampening factor f. This assumes that the impulse response of the meter is an exponential decay. Beware of round-off errors.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

I agree with Hans, you need to do some signal conditioning before you sample. Try searching for audio circuits you should find something somewhere.

Reply to
cbarn24050

... snip ...

... snip ...

All he needs is a digital filter. A moving average will require some storage for the sampling period. However the equivalent of a RC filter will only require one value.

value = (value + sample) / 2.0

for example. Changing the weighting of value and sample will change the time constant.

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
More details at:
Reply to
CBFalconer

I thought VU meters used some sort of fast attack system (ie rise time < fall time). So

Take sample (could be average of a few readings) if sample > displayed value Displayed Value = Sample else Displayed Value = ( (Denominator-n)* Dsiplayed Value + n * Sample ) /Denominator

NB Denominator and n are to make for easier arithmetic. Perhaps Denominator = 256 and n= 4, but values will need to be tuned for your sampling rate to achieve a visually attractive decay time.

And then you need some way of making Displayed Value logarithmic. With so few bars, perhaps a table holding the display threshold for each bar.

But that is just guess work. Still, it may pass as a thought.

Bill

Reply to
Bill Davy

If you sample a continuous waveform, the sampling rate should be at least twice the highest frequency represented at the input (the Nyquist sampling theorem).

Thus, with 10 Hz sampling, the highest frequency at the ADC input should be 5 Hz. This is "a bit" low for audio signals, but sufficient to record the level changes in the music.

However, in order to use it in this way, you must _rectify_ the audio signal and filter out any components above 5 Hz _before_ sampling. I would suggest using a full wave rectifier for each audio channel built around an op-amp (since this will eliminate the diode threshold voltages) and inserting an RC filter between the op-amp and ADC.

If you want to do everything in digital, you must sample at a considerable higher frequency. If you are only interesting in displaying the lowest bass notes, a 1000 Hz sampling rate would be sufficient, but if you want to include most of the power spectrum from typical music, at least 8000 Hz sampling rate should be used. Anyway, some RC low pass filtering might be still be useful at the analog input. After getting the ADC sample (convert it to a bipolar value if the ADC is unipolar), take the absolute value of each sample (thus rectifying the sample value) and smooth out the sample with methods already suggested in this thread.

Why would you refresh the sampling rate at the same frequency as the audio samples are taken ? Take samples at 8000 Hz and refresh the display at 10 Hz.

If those are linear readings, this would correspond to a 20log(80:1) =

38 dB dynamic range. This would make sense for non-popular music.

Are you sure that you took the logarithm of the sample values before displaying it assuming you wanted a scale with equal number decibels for each step. If you wanted to imitate the official mechanical VU meter, some other compression curve would be needed.

Paul

Reply to
Paul Keinanen

as others have said, you need time constants. This pdf will give you some ideas (I hope)

formatting link

martin

Reply to
martin griffith

Is the OP really needing VU or PPM. The difference is mostly in terms of response and decay times. In analogue terms this simple project provides the dual functionality (see

formatting link

--
********************************************************************
Paul E. Bennett ....................
Forth based HIDECS Consultancy .....
Mob: +44 (0)7811-639972
Tel: +44 (0)1235-811095
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************
Reply to
Paul E. Bennett

In order to be meaningful meters, and I assume that is your intention, it is conventional in audio gear to provide a "VU" meter characteristic and/or a PPM meter Characteristic. Some of the history of these metering standards is forgotten so being an official old person with a significant broadcasting background I will try to recount what was drilled into me many years ago.

VU meters were invented in a simpler time and the old AT&T spec says you must integrate the sound envelope over 300ms. That means that a 300mS tone burst will cause the meter to rise to 99% of the "0 db" reading on the meter. This was done in the old days my pure mechanics. You will have to do this in software to create a real "VU" meter.

The "peak program meter" or PPM meter is a product of an German engineer trying to understand music and so by looking at the fastest musical note in classical repertoire, a hemi-demi-semi-quaver, he determined that a 10mS attack time would capture these fastest notes. (He obviously had not considered the attach time of a drum or piano which is much faster but that is another story). It is now a standard.

He also figured that the decay time of the meter should be be slower so the old spec said something about 3 to 4 seconds decay from "0" back to the resting pin of the meter. The numeric scale on the meter has a different numeric scale depending on which country you live in. UK has one and Germany has another as I recall. Bottom line to be a "PPM" meter you must design to these standards. Audio Operators depend on these specs to keep control of live program being sent down a channel with finite range.

Hope that helps a little.

"Standards are great, everyone should have one" Charles Moore Circa 1985

Brian Fox Former Senior Engineer CFPL TV, London Canada

Reply to
Brian Fox

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.