Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

VU meter: a toy

Started by NoCforMe, May 12, 2024, 01:28:55 PM

Previous topic - Next topic


In case you were following my adventures up there in the Win32 forum about not being able to load a bitmap resource (resolved: my stupid mistake with wrong .rc file syntax), the whole point of that exercise was this li'l project.

I was thinking about VU meters for some reason, and got the brilliant idea: how about creating a Windows control that shows a working meter? That could be useful.

Well, heh: turns out I'm very late to that game, as there are already dozens (hundreds?) of such things already available out there, ready to buy and download.

Still, I thought it would be fun to create a DIY VU meter, and I eventually did. Since I'm basically an analog guy and like old stuff, I opted for a retro look rather than the 70s look of most meters out there (not to mention the all-digital ones that are just a bargraph display). The kind of meter used in old telco equipment and such. Attached is a demo of what I came up with.

The way this works is pretty simple: I show an underlying meter image without a needle, then overlay needle images on top of it. To create the demo, I took an image of a VU meter, sized it to something reasonable, made a copy and erased the needle (by hand, pixel-level editing with good old Paint Shop Pro). I also made a copy of the needle itself, rotated to stand upright. I then made many copies of the needle rotated at various angles, from -40° to +40° at 5° intervals. (The final version actually went from -42° to +42°.)

I wrote a program that showed the underlying meter-without-needle and let me superimpose each needle image on top of it, with controls for moving the (x,y) origin of the image, so that the needle would be in the correct position. (Used TransparentBlt() to show the needle over the base meter image.) I then wrote down (on paper!) the coordinates for each needle in its position.

I also had the program show a rectangle that I could adjust on top of the meter image that would become my clipping rectangle, so I didn't have to trim all those needle images at the bottom.

The demo program shows the base meter image (when the display window receives the WM_ERASEBKGND message). When you "run" the meter, I set up a timer with a time of 40mS. On each WM_TIMER message I cycle through the array of needle structures to show the next image, first going up, then going down. Each structure has a handle to the image (loaded with LoadImage(), finally!) and the coordinates to show it at within the window.

Anyhow, it works, pretty well. Well, except that it looks (on my computah, anyhow) like there are 2 needles instead of one. Probably could eliminate that with some tricky footwork (double buffering? smarter painting?). Doesn't work smoothly like the professional ones.

I'm pretty much done with this; I don't think I could seriously compete with the commercial offerings available. Besides, there's a lot more to making a VU meter than just showing the needle at the right place: there's the whole issue of ballistics--how fast the needle responds to input (answer: not very; the VU meter is a pretty slow device), and more importantly scaling the display to some real-world level (like 0 dB = 1.228 VAC RMS across 600Ω @ 1 kHz).

I found a good video on YouTube that explains a lot about VU meters, about their many deficiencies and also how they can be useful in a studio to set levels.
Assembly language programming should be fun. That's why I do it.


NICE  :thup:
I must say I was a bit disappointed that it was ONLY a Graphical demo as such  :sad: , .... there I was with music playing, hoping to see it work,...  :joking:

One of the older consoles I used to work on, had Quasi peak programme meters (QPPM)
You cannot view this attachment. A typical British quasi-PPM.
Each division between '1' and '7' is exactly four decibels and '6' is the intended maximum level.
(This only shows the true level of the peak if it exceeds a certain duration, typically a few milliseconds. On peaks of shorter duration, it indicates less than the true peak level. The extent of the shortfall is determined by the 'integration time').
I always liked the ballistics of those older Sifam meters.

With correct voltages and system 'gain structure' set correctly, you really could rely on the 6 'Peak' level and with these and VU's, gave you a very good and true indication of what was happening technically, as well as providing a good indicator of loudness etc.

The Meter-Bridge at the 2 track machine, had VU's and a Quasi Peak meter similar to that above but had 2 x Needles, (Green & Red), to display Left and Right, similar to this:
You cannot view this attachment.

Younger people these days Only exposed to digital, have almost no real understanding of real levels as required in the past, with everything set at -1 and whilst it IS getting better Now, often, No longer Squashed to the Max, as in the 'Loudness Wars' era  :dazzled:  :sad:

Modern Streaming services haven't helped much either, nor has peoples laziness in wanting to play their playlists all at the same volume, so we have everyone trying to produce output set to certain LUFS levels, (depending on what streaming service it is destined for)  :sad:

I'm so glad I have lots of older, Non Re-Mastered, (read over-compressed), CD's and regularly look for older correct versions when looking for specific older artists material.

Fortunately, there are some good Databases with Dynamic Range listings, which sure helps to avoid the later releases with Zero dynamic range.