Author Topic: Measuring audio level - a quick circuit?  (Read 5847 times)

0 Members and 1 Guest are viewing this topic.

Offline BuriedcodeTopic starter

  • Super Contributor
  • ***
  • Posts: 1610
  • Country: gb
Measuring audio level - a quick circuit?
« on: September 13, 2021, 06:19:00 pm »
I am slowly adding an Aux input to several stereos I have so I can plug in those wonderful cheap bluetooth dongles. I'm hoping to build something portable - another lockdown (or post lockdown now?) quick project. 

The reason being, internally, these seem to have varying levels before the power amp - no real standard.  Not to mention my Bose system has to be on full volume to hear anything on its Aux input (a quick test using a stereo preamp showed the AUX needed a roughly a 8v p-p to be on parr with CD volume).

Although I generally just use a scope to get a rough idea of audio level, given that some of these stereos are a bit large I'd like something portable.  My immedate idea is a precision peak detector, probably both positive and negative, or a precision rectifier and just positive, with jellybean parts - I guess to the nearest 100mV is fine.

Something like Daves video #490:  

With a reasonable time constant on the sampling cap, to hold the peak for 10's of miliseconds, then a micro sampling it with an ADC, and results on a character LCD (I have loads) or a tiny OLED.

Is there anything inherently wrong with this approach? Am I over complicating it? As I said, it's a "useful project to use up parts and time" sort of thing.  And I'm sure it will be useful for testing line out on some guitar effects I have that also appear to not abide by any standard.

 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14306
  • Country: fr
Re: Measuring audio level - a quick circuit?
« Reply #1 on: September 13, 2021, 06:36:39 pm »
There's no need to build an analog peak detector if you're going to use a MCU.

Just use the internal ADC to sample the audio, then you can easily compute the peak inside. Computing the RMS value would be a nice addition too.

So I would just sample the audio, compute the peak = max(abs(Vin)), and the moving RMS value over a certain period. Then display both values. Add a button, so the MCU would reset both the Peak and RMS values upon a button press.
 
The following users thanked this post: Buriedcode

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5840
  • Country: de
Re: Measuring audio level - a quick circuit?
« Reply #2 on: September 13, 2021, 06:50:49 pm »
There IS a standard for Line/AUX levels (or rather two, plus an old one), which is what's should be expected for AUX inputs or outputs.
Manufacturers that do not stick to those standards should earn them a place in the "Audio Hall of Shame".

The old one is 1 mW into a 600-ohm load. This corresponds to ~775 mVRMS.

"Professional Audio" is +4 dBu which corresponds to ~1.228 VRMS.

"Consumer Audio" is -10 dBV which is 316 mVRMS.

Volume control has no place in a Line/AUX signal, it is always at full amplitude.

"Professional" and "Consumer" are mechanically easy to distinguish. The first uses XLR connectors or Phone Jacks, the latter RCA/Cinch plugs.


« Last Edit: September 13, 2021, 06:56:28 pm by Benta »
 
The following users thanked this post: Buriedcode

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7934
  • Country: us
  • Retired, now restoring antique test equipment
Re: Measuring audio level - a quick circuit?
« Reply #3 on: September 13, 2021, 07:17:20 pm »
Note that the AC voltage that corresponds to 1 mW into 600 ohms (regardless of impedance) is denoted 0 dBu = 0.775 V rms.
I have found that CD players often output closer to 2 V rms at maximum signal.
 
The following users thanked this post: Buriedcode

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5840
  • Country: de
Re: Measuring audio level - a quick circuit?
« Reply #4 on: September 13, 2021, 07:23:06 pm »
A second aspect to your approach is the musical one. I mean, classical music has an immense dynamic range. "Nothing Else Matters" from Metallica as well.

Which peak do you want to store? And do you want to store it forever? What if an audio track starts at a very low level, would you then amplify it?
That's called a "Compandor".
I think the only time your peak level detector would give the desired result is at a Techno Rave where all OOMPH-OOMPH-OOMPH-OOMPH peaks are at saturation level already.

 
The following users thanked this post: Buriedcode

Offline BuriedcodeTopic starter

  • Super Contributor
  • ***
  • Posts: 1610
  • Country: gb
Re: Measuring audio level - a quick circuit?
« Reply #5 on: September 13, 2021, 10:03:36 pm »
There's no need to build an analog peak detector if you're going to use a MCU.

Just use the internal ADC to sample the audio, then you can easily compute the peak inside. Computing the RMS value would be a nice addition too.
..

I considered this, as many MCUs have ADCs more than fast enough for audio - especially as one would only require 8-bits. I guess I could prototype a fast peak detector and compare the results side by side.

There IS a standard for Line/AUX levels (or rather two, plus an old one), which is what's should be expected for AUX inputs or outputs.
Manufacturers that do not stick to those standards should earn them a place in the "Audio Hall of Shame".

....

Volume control has no place in a Line/AUX signal, it is always at full amplitude.

Yes, this is the problem. I'm adding Aux inputs to devices that have not made any provision for them (we're talking cheap, but reasonable sounding stereos, two of them portable, being upgraded to run on Lithium batteries). But also the ones that do have Aux inputs, seem to vary in the level required, with some requiring significant amplification before, and one that actually requires attenuation, because it clips - using a bluetooth dongle, with its volume on max.   I don't plan on inserting any volume control, although the devices that don't have Aux, I'll be putting Aux before the volume control in the unit, which seems to be the last thing before the main power amp - that way there's at least some consistency between Aux input and say, CD input.

So, it's a mishmash of different levels for each one, and the only real way of getting any kind of consistency is to add a preamp to the Aux in, with a fixed gain for that particular unit. I could just knock up a few boards with a stereo pot for setting the level, but it would be nice to have some actual measurements. 

I'll admit a simple MCU + LCD is probably the cheapest and easiest way, I tend to over-complicate things, even though precision isn't really the goal here. What I was worried about was missing the peak amplitude.

A second aspect to your approach is the musical one. I mean, classical music has an immense dynamic range. "Nothing Else Matters" from Metallica as well.

Which peak do you want to store? And do you want to store it forever? What if an audio track starts at a very low level, would you then amplify it?
That's called a "Compandor".
I think the only time your peak level detector would give the desired result is at a Techno Rave where all OOMPH-OOMPH-OOMPH-OOMPH peaks are at saturation level already.


Well, I'm assuming here that the designers of these units made sure that the audio from the CD doesn't clip anything pre-power amp.  Thats fixed amplitude, before the volume control.  I'm not trying to add a compressor here, simply finding the max possible p-p voltage that these units have on their CD outputs (that goes to power amp) so I can set a similar level for the bluetooth dongle.  As I said, usually this requires amplification, but sometimes attentuation, it all depends on what I find.   

RMS is fine, but as you alluded to - RMS value.. when? The entire song/album?  I figured finding the peak amplitude would be the best reference.  Play the same track, (albeit one from bluetooth stream, and one from CD) and check the peak amplitude after the same song.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1022
  • Country: us
Re: Measuring audio level - a quick circuit?
« Reply #6 on: September 14, 2021, 06:52:26 am »
RMS is one thing and peak or peak-to-peak are others. A 0 dBu audio signal can easily reach 2 V or more on peaks.

Audio levels are traditionally measured with a VU meter which has specific ballistic characteristics as well as defined impedance. And 0 dBu is a power measure, not one of Voltage as Tim Fox states. So it is only a valid measure on 600 Ohm (balanced) audio lines. Consumer audio equipment normally has high impedance inputs, around 10K Ohms. So just talking about "standard" audio levels in consumer equipment is a difficult thing.

Even in professional and broadcast equipment, the standard has evolved to where most equipment has a very low output impedance while the inputs have those same, high impedance inputs as are found in consumer equipment, but often designed for higher Voltage levels.

If you think it is difficult with consumer equipment, just try putting together a professional or broadcast audio studio. Most try to convert to digital as early in the chain as possible and that brings a whole additional bunch of concerns.

Back to that 0.775 V rms vs. 2 Volt peak thing, even with the original VU meters that were designed to be across a 600 Ohm, balanced audio line, the 0.775 V rms was only the zero dbm reading. They had a red area above that which went up to +3 dbm, which corresponds to about 1.095 Vrms or 1.55 V peak or over 3 V peak-to-peak.

When "setting" audio levels in a professional or broadcast setting it is common to allow the audio meter to go "into the red" or up to as high as that +3 dbm reading for several instants in any given minute. That is considered a proper audio level.

Of course, I do know that there are other standards that are used. For things like classical music the levels were often held lower so that the peaks in the music never reached the point where they would be clipped by processing equipment that would be installed later in the system (such as at a transmitter location). And popular music was often recorded with the meters almost never going below +2 dbm except between songs. No, you were not imagining just how loud those bands were.

Audio levels are anything but well controlled. And the digital world has only seen this get worse, not better. There is nothing surprising about a CD player with an analog output at 2 Vrms.



Note that the AC voltage that corresponds to 1 mW into 600 ohms (regardless of impedance) is denoted 0 dBu = 0.775 V rms.
I have found that CD players often output closer to 2 V rms at maximum signal.
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1022
  • Country: us
Re: Measuring audio level - a quick circuit?
« Reply #7 on: September 14, 2021, 07:12:04 am »
I lost track of the original question in my first post. Quick circuit audio meter?

I have made LED meters with op amps and ten segment LED meter chips. You can look in some of the old application notes for chips like the 741 to get a circuit that will react somewhat like a standard VU meter (attack and decay time) and then just a level control going to the LED meter chip. Of course there are better op amps available, but that is one place to find the circuits. Nothing difficult and you don't really have to worry too much about the frequency response. Just take care not to overdrive the op amp chip you use.

Calibrating it to any given standard would be the harder part. But a relative level may be all you need.
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7307
  • Country: nl
  • Current job: ATEX product design
Re: Measuring audio level - a quick circuit?
« Reply #8 on: September 14, 2021, 07:17:29 am »
Do you have a multimeter with RMS measurement?
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7934
  • Country: us
  • Retired, now restoring antique test equipment
Re: Measuring audio level - a quick circuit?
« Reply #9 on: September 14, 2021, 01:45:49 pm »
Typically, audio systems are calibrated (during design or test) with sinusoidal signals from appropriate signal generators, where the voltages are measured with AC meters that are either true-RMS or average-responding, RMS calibrated.
In the case of a CD player, the system obviously has a maximum output level, that corresponds to the full range of the DAC, for the peak-to-peak voltage.  With a test source (such as the "NAB Broadcast and Audio System Test CD", which is now hard to find), this maximum output can be measured--rarely, it is specified by the CD player manufacturer.  In the old days, there were standards for the maximum groove velocity on LPs, but they were often ignored by record manufacturers.  The phono cartridges, however, were specified for output voltage at groove velocity.
 

Offline JoeyG

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
Re: Measuring audio level - a quick circuit?
« Reply #10 on: September 14, 2021, 03:13:39 pm »
Why not a LM3194 or the logarithmic version

https://www.ti.com/lit/ds/symlink/lm3914.pdf
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Measuring audio level - a quick circuit?
« Reply #11 on: September 14, 2021, 03:28:38 pm »
Audio levels are traditionally measured with a VU meter which has specific ballistic characteristics as well as defined impedance. And 0 dBu is a power measure, not one of Voltage as Tim Fox states. So it is only a valid measure on 600 Ohm (balanced) audio lines. Consumer audio equipment normally has high impedance inputs, around 10K Ohms. So just talking about "standard" audio levels in consumer equipment is a difficult thing.

Tim is actually correct. dBm is the power measurement, with the 600 ohm load. (NB that when doing RF, dBm assumes a 50 ohm load.)

dBu is unloaded, and it's actually a voltage measurement with respect to a 0.775 V reference. That is, the calculation is:

value = 20 log (Volts / 0.775)

As you recall, a power dB measurement is given as

value = 10 log (Pout / Pin)

 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Measuring audio level - a quick circuit?
« Reply #12 on: September 14, 2021, 03:30:18 pm »
A second aspect to your approach is the musical one. I mean, classical music has an immense dynamic range. "Nothing Else Matters" from Metallica as well.

What's funny is that Metallica's recorded output has about a 2 dB dynamic range.
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7934
  • Country: us
  • Retired, now restoring antique test equipment
Re: Measuring audio level - a quick circuit?
« Reply #13 on: September 14, 2021, 03:39:32 pm »
Power-referenced levels such as dBm (reference 1 mW) and dBf (reference 1 fW, used for receiver inputs) are technically independent of the impedance level, assuming you measure the power.  Of course, since the usual measurement is done with a voltmeter equivalent, the impedance value is required to calculate the power.  Wikipedia has a huge table of standard suffixes for dB values.  The dBu is slightly illegitimate, since it is not a power level, but very convenient for normal audio use with ill-defined impedance nodes, and does correspond to dBm in a 600 ohm impedance.  I own an antique (pre-war) Simpson 260 with an older reference level, which I believe was 6 mW in 500 ohms for 0 dB.
When calculating the ratio of two dollar values in dB, use the factor 10, since money is power.
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Measuring audio level - a quick circuit?
« Reply #14 on: September 14, 2021, 03:43:14 pm »
Unless I am mistaken, the goal of this project is to do automatic gain/level control. That is, you have several audio input devices, which all have different "nominal" output levels, feeding an stereo receiver. And the goal is to ensure that all of the inputs end up playing at the same volume. This is so you don't have to jump for the volume control.

The problem is: how do you decide what each device's "nominal level" is? A better question is, "when do you decide?"

I mean, do you choose based on the solo acoustic guitar intro to "Stairway to Heaven," or do you choose the electric guitar solo near the end?

The point is that you don't want the level varying within the song.

And some program material is mastered hotter than others (read about the "Volume Wars"), so even if you get a level you like for the Metallica song, it won't apply to "A Love Supreme."

So I think your best bet is to take advantage of your stereo's handy volume control and not overthink it.
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7934
  • Country: us
  • Retired, now restoring antique test equipment
Re: Measuring audio level - a quick circuit?
« Reply #15 on: September 14, 2021, 03:45:00 pm »
Also, a standard passive VU meter should present 7500 ohms to the circuit being measured, and 0 VU should indicate at +4 dBu with a sinusoidal voltage applied.
A real VU meter has well-defined ballistics (mechanical movement) and was designed to behave as one would perceive the loudness of a complex waveform, not the peak-peak level.  Experienced operators could estimate how a properly-calibrated VU meter related to the peak requirements of a tape deck or transmitter.  Most "VU" meters seen on non-professional equipment are merely average-responding AC voltmeters, without the defined ballistics.
« Last Edit: September 14, 2021, 03:56:11 pm by TimFox »
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5840
  • Country: de
Re: Measuring audio level - a quick circuit?
« Reply #16 on: September 14, 2021, 05:04:10 pm »
And to muddy the waters completely, you don't only have the VU meter (which really shows instantaneous power density of the signal), but also the PPM (peak programme meter), which I believe was pioneered by the BBC to prevent over-modulation of a radio signal.

 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7934
  • Country: us
  • Retired, now restoring antique test equipment
Re: Measuring audio level - a quick circuit?
« Reply #17 on: September 14, 2021, 05:08:51 pm »
For transmitter modulation and tape recording, peak metering (as in the BBC PPM) relates directly to avoiding overload.
My college AM station used a small (Millen) CRT (horizontal driven directly from the 60 Hz line through a low-voltage transformer and vertical coupled from the AM transmitter RF output) to look for "dots" on the horizontal mid-line that indicated over-modulation.
 

Offline BuriedcodeTopic starter

  • Super Contributor
  • ***
  • Posts: 1610
  • Country: gb
Re: Measuring audio level - a quick circuit?
« Reply #18 on: September 15, 2021, 08:13:22 pm »
Unless I am mistaken, the goal of this project is to do automatic gain/level control. That is, you have several audio input devices, which all have different "nominal" output levels, feeding an stereo receiver. And the goal is to ensure that all of the inputs end up playing at the same volume. This is so you don't have to jump for the volume control.

No, the *end* goal, is to design a small add-in board for each unit, that amplifies, or attentuates, an external input to match the units "nominal volume" that comes frm the CD player part. So I don't have to radically alter the volume control when switching to aux in/CD.  The gain will be fixed. On units that already have an Aux in, this will have to be external.

The source is the same, but isn't connected to all units at the same time, it'll just be a cheap bluetooth audio adatpter - the few I have all seem to output a similar level, so at least theres consistency there.

The thread was started, because in order to know what kind of gain each one would need, I need a rough idea of the actual level that feeds the power amp from the CD player, as the CD player part has a fixed level - its before the main volume control - I was going to probe these with a scope, but wondered if I could knock up something small and portable to just hook up to give me a rough idea of the p-p value.

I have a true-RMS meter - the AN8008 - but I dont' see how this will be much help unless I have a CD with a standard tone, at a standard level.  Looking at the peak value after playing a track - I can use any CD I like, using the same one on each unit to check levels.  I could find a test audio file and burn it to disc - but I don't ahve blank CD's since I haven't used them since 2008.

I didn't mean to open a whole can of worms about standards, VU meters, and how the industry does it.  And the "quick circuit" was because during lockdown a made a list of things I could build to use up the vast stock I have of surplus.  Not necessarily accurate.
 

Offline viperidae

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: nz
Re: Measuring audio level - a quick circuit?
« Reply #19 on: September 15, 2021, 11:01:02 pm »
If you have a limited number of stereos, sounds like the quickest and easiest solution would be to just test it out. Burn a CD with some wine waves and compare the output against your input preamp. Mark the levels suitable for each stereo and manually adjust when you switch between them.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Measuring audio level - a quick circuit?
« Reply #20 on: September 18, 2021, 12:37:19 am »
There are any number of audio utilities for PC.
While this will not give you a calibrated answer it will certainly allow you to homogenize levels between sources.
I prefer using CCDF for measuring levels on live audio.
 

Offline BuriedcodeTopic starter

  • Super Contributor
  • ***
  • Posts: 1610
  • Country: gb
Re: Measuring audio level - a quick circuit?
« Reply #21 on: September 18, 2021, 03:55:57 pm »
There are any number of audio utilities for PC.
While this will not give you a calibrated answer it will certainly allow you to homogenize levels between sources.
I prefer using CCDF for measuring levels on live audio.

Thanks, but I'm not sure thats portable. I mean I don't have alaptop anymore.
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2353
  • Country: gb
  • Recovering Electrical Engineer
Re: Measuring audio level - a quick circuit?
« Reply #22 on: September 18, 2021, 05:18:23 pm »
The AD8436 and a nice moving coil meter? ADL5904, nice, or an antique LM3915? Too analog? https://sourceforge.net/projects/audmes/
Or if you dont like solder https://bestengineeringprojects.com/sound-level-meter-circuit-using-arduino/
You'll want to dump the front end in favour of an attenuator and some overload protection.
Caibration is the hard part.

 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Measuring audio level - a quick circuit?
« Reply #23 on: September 18, 2021, 06:46:22 pm »
Thanks, but I'm not sure thats portable. I mean I don't have a laptop anymore.
How about an audio pad, TRRS plug and some app on your Android phone?
 

Offline BuriedcodeTopic starter

  • Super Contributor
  • ***
  • Posts: 1610
  • Country: gb
Re: Measuring audio level - a quick circuit?
« Reply #24 on: September 20, 2021, 05:36:42 pm »
Thanks, but I'm not sure thats portable. I mean I don't have a laptop anymore.
How about an audio pad, TRRS plug and some app on your Android phone?

What kind of app? If its anything like soundcard apps, it's rare to find one that provides absolute amplitude (since integrated sound devices rarely care about absolute accuracy).  I realise I could just use it to measure relative amplitude, but then I would have to calibrate it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf