Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | VU meters on LCD

There are 9 messages in this thread.

You are currently looking at messages 0 to 9.

VU meters on LCD - Richard Sloan - 13:47 25-01-06



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. 



Re: VU meters on LCD - Hans-Bernhard Broeker - 14:35 25-01-06

Richard Sloan <r...@hotmail.com> wrote:

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

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 (b...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: VU meters on LCD - 02:14 26-01-06

Richard Sloan wrote:
> 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.

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


Re: VU meters on LCD - CBFalconer - 03:19 26-01-06

c...@aol.com wrote:
> Richard Sloan wrote:
> 
... snip ...
>>
>> 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.
>>
... snip ...
>>
>> Any thoughts?
> 
> I agree with Hans, you need to do some signal conditioning before
> you sample. Try searching for audio circuits you should find
> something somewhere.

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: <http://cfaj.freeshell.org/google/>;



Re: VU meters on LCD - Bill Davy - 04:47 26-01-06


"Richard Sloan" <r...@hotmail.com> wrote in message 
news:sJPBf.20343$v...@news20.bellglobal.com...
>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?

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
>
> Thanks,
> Richard.
> 



Re: VU meters on LCD - Paul Keinanen - 05:50 26-01-06

On Wed, 25 Jan 2006 13:47:55 -0500, "Richard Sloan"
<r...@hotmail.com> wrote:

>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, 

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.

>I can sample more,

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.
  
>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.

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.

>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.

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


Re: VU meters on LCD - martin griffith - 08:12 26-01-06

On Wed, 25 Jan 2006 13:47:55 -0500, in comp.arch.embedded "Richard
Sloan" <r...@hotmail.com> wrote:

>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. 
>
as others have said, you need time constants.
This pdf will give you some ideas (I hope)
http://www.ebu.ch/CMSimages/en/tec_doc_t3205_tcm6-10506.pdf?display=EN


martin

Re: VU meters on LCD - Paul E. Bennett - 14:20 26-01-06

Bill Davy wrote:

> 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
> 

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 http://sound.westhost.com/project55.htm).

-- 
********************************************************************
Paul E. Bennett ....................<email://p...@amleth.demon.co.uk>
Forth based HIDECS Consultancy .....<http://www.amleth.demon.co.uk/>;
Mob: +44 (0)7811-639972
Tel: +44 (0)1235-811095
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************

Re: VU meters on LCD - Brian Fox - 23:42 28-01-06

"martin griffith" <m...@yahoo.esXXX> wrote in message 
news:v...@4ax.com...
> On Wed, 25 Jan 2006 13:47:55 -0500, in comp.arch.embedded "Richard
> Sloan" <r...@hotmail.com> wrote:
>
>>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.
>>
> as others have said, you need time constants.
> This pdf will give you some ideas (I hope)
> http://www.ebu.ch/CMSimages/en/tec_doc_t3205_tcm6-10506.pdf?display=EN
>
>
> martin

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