1

I've been searching a lot for an easy to use VU meter to use in a simple Audio player/recorder, but I haven't been lucky. I found some samples of LED meters, but not quite what I wanted.

It's good that I'm a bit stubborn, but unfortunately I'm also a complete beginner in C#, but that is the language I want to learn so I started my little project 2 weeks ago. This is the result.

2

I started out from a System.Windows.Forms.UserControl. I decided that the size should be calculated from the number of LED:s being used (I started with the LED, and added the analog this weekend), and added properties for LED size and spacing. The colors are user selectable in three different areas (up to 32 LED:s in each) with different settings for LED on and off so they could have a glow when idle.

BackColor is used for the border round the LED:s.

The LED:s are made up of filled rectangles, with a solid brush, easy to use and didn't take much time to get working, next I added the possibility to enable a PeakHold with selectable Hold time, and then I wanted to have a vertical version also. This solution is quite ugly, but it works ok.

As I wanted to use the LED:s for a VU meter, I wanted both analog and logarithmic scale (Log10) so that came next, and this was a bit tricky for me, but I made it and was very happy with my solution, but then suddenly I got the idea: But I want an old style analog meter, so I started searching, but found nothing (for free anyway), and the meters that had a decent price tag were ugly! I did find some extremely beautiful gauge meters, but almost 700$ is way beyond my budget!

So the only way was the hard way. I started last week, (on my spare time!) this was fun! I haven't learnt so much in many years, and I'm learning new things every day now, and I did get results!

I got the analog meter running over the weekend, but at a fixed size, and I couldn't make the background transparent, so I wasn't quite satisfied yet (I do not lie if I tell you that I had a lot of trouble getting the maths together for the analog meter). To solve the background, I found the example code in C# Help for a round button, set a region, and that did the trick, finally! But it would be nice to be able to have a different size, the TI-66 (I know its old, but it has nostalgic value for me) did some number crunching, and I began to change in the code, suddenly terrified that I hadn't made a backup before the changes, my test application didn't work anymore?!?! What to do, ctrl-z a wonderful key-combination, but when I found the error (I set the size to 0,0 by mistake) I just had to re-enter everything again. And now, tonight, I'm quite satisfied with my work, so the next thing was getting MP3 recording to work (don't now how yet, but I'm leaning towards BASS) so I could get some practical use of my wonderful meters.

3

I've done my best to make it easy to use. Here is a small explanation of how to use it.

First, drag the DLL to your Toolbox, then you could place a VuMeter on your Form.

To set it up the way you want it, go to the properties and look in Analog Meter, VU Meter and VU Meter - Colors. BackColor, Font and Size are also in use.

4

  • Analog Meter - True or False (default False) tells the meter if it should be LED or analog.
  • DialBackGround, is the color of the dial. DialTextNegativ, Positive and Zero is what color the text above the dial should have dependant on the value (text uses DialTextPositive).
  • NeedleColor and PeakNeedleColor are of course the color of the needle and peak indicator.
  • ShowDial Only - True or False (default False) removes the background around the meterdial so you could place it above some nice meter image or anything else you want.
  • ShowTextInDial - True or False (default True) tells if the text (values) should be shown in the dial, and the values are placed in TextInDial (a String array) and all the values are distributed in the upper part of the dial.
  • VuText is a text you could have in the dial (Default VU).

In the VU Meter category, you find more options:

  • Led1(2 and 3) Count number of LED:s in each area (default 6, 6 and 4) max value 32 for each area and minimum 0 (but there must be 1 LED in one of the areas) this is also the number of indicators that are shown in the analog dial.
  • LedSize (default 6;14) size of each led in pixels, same size is used in the analog meter so to get smaller "ticks" change the size here.
  • LedSpace (default 3) pixels between LED:s and also width of border around LED:s.
  • Level input level to meter determines number of LED:s to light or position of needle in analog view.
  • LevelMax (default 65535) Max input value also the level that turns on all the LED:s.
  • MeterScale Analog or Log10 (default Log10) what math to use when calculating Level.
  • PeakHold True or False (default True) if you should use PeakIndicator.
  • Peakms (default 1000) number of ms to hold peak value (max 10000).
  • VerticalBar True or False (default False) if you want a vertical LED-bar instead.
  • VU Meter - Colors, you figure it out for yourself ;)

5

  • UseLedLight True or False (default False) if the Led:s in the dial should follow the needle.
  • ShowLedPeak True or False (default False) if the Peak indicator should be shown in Led also.
  • If you like this analog and digital meter, please give comments and feedback on the code and the component. If anyone out there could give me some help on how to record to a MP3 file from C#, I'd be happy to get some help.