# Master audio level meters



## Take Vos (Dec 24, 2017)

I would like to see some audio level meters on the side of the video preview.
These meters would show the master levels, in other words the levels that are actually recorded and streamed.

I took the specification from the combination of a professional audio recording software I developed (Boom Recorder), and IEC 60268-18 & SMPTE RP.0155.

To make these meters be more useful I would like the following features:

Scalable in height, based on the height of the video preview
dBFS marks at: −60, −50, −40, −35, −30, −25, −20, −15, −10, −5, 0
Green range between -60 dB to -20 dB
Yellow range between -20 dB to -9 dB
Red range between -9 dB and 0 dB
PPM Peak Program Meter
VU RMS Meter
Peak Hold Meter
For the PPM Peak Program Meter:

Fast integration time. This is the time it takes for the meter to go to a higher volume.
Return time 20 dB in 1.7 seconds. This is the time it takes for the meter to return to a lower volume.
It fills up the body of the meter by making the green, yellow and red sections bright; from the bottom up to the level.
For the VU RMS Meter:

300 ms Integration time. The period over which the running-average is being done over the samples.
Shown as a single black-white horizontal line (see picture) drawn on top of the PPM Meter.
For the Peak Hold Meter:

Follows up with the PPM Level
It holds to the maximum PPM Level for 20 seconds before dropping back to the current PPM Level.
Shown as a small horizontal line (see picture) which brightens the green, yellow, red sections.
Is there an easy way to get access to the samples of the master audio stream?
Any other information I should know about?


----------



## Jim (Dec 24, 2017)

I actually intended to add both master audio volume controls and master audio levels, but it's always been lower priority and sort of continually ends up in my "eventually add this one day" box.

The back-end does have API for setting/getting master volume levels as well as API for getting final mix audio samples though.  The only problem is how to add it to the UI in such a way that is nice and elegant, that's the real question.  In terms of UI, modifying the main window can be something I tend to be very picky about.  I think I'd be okay with an optional dockable panel that's disabled by default or something.

To get access to the final audio, you'd use obs_get_audio().  Then you'd use something like audio_output_connect() to connect to the master audio.

However, reading that function again, I just remembered that there can be up to 6 simultaneous final mixes for multi-track audio cases, so technically the situation is a bit more complicated than it might at first seem.  I'm not entirely sure how one would approach that from a UI standpoint.


----------



## Take Vos (Dec 24, 2017)

If I can easilly find out which of the mixes are actually used I can simply not show the mixes that aren't used.

In Boom Recorder I actually make the meter grey-scale when the audio is not routed to an audio file, this way you can still see the mix.


----------



## Take Vos (Dec 24, 2017)

Also master volume control is a lot less important as you can handle this by volume control on the inputs which already exist.

Master volume on mixing desks are more often used for controlling physical volume control of stage-monitors or speaker stacks. That is different for recording and broadcasting, where the master volume control is under control of the listener.


----------



## Jim (Dec 24, 2017)

That's probably going to be a problem, I don't believe I've implemented a way to tell which ones are technically active.  Usually it's determined by which mixes have active callbacks connected to the master audio.  So basically by using audio_output_connect(), it sort of tells the audio backend that "this mix is active", if that makes sense.  Sometimes these sort of things aren't always accounted for when one is creating API.

I can't currently propose a solution to that particular problem, I think some additional API might have to be created specific to monitoring the master audio mixes.


----------



## Take Vos (Dec 26, 2017)

I was thinking of first modifying the current meters graphically. It seems like for the inputs most of the information (peak, mean, hold) that is needed is passed to it already. Then we can have some improvement more quickly.

So:

adding ticks every 5dB,
use three colour parts at -20 and -9 to show how close you are to peak levels,
adding peak-hold and RMS,
maybe add stereo,
without increasing the height for each sound input in the UI.


----------



## Take Vos (Dec 30, 2017)

I've been working on the new source volume meters. Do you mind if I increase the height of the meters? They are now 3 pixels high. I would like to have the meters in stereo, with in between the dB ticks and small numbers.
A bit like this:


```
===========
  10  |  5  |  0
========
```

Part of the ballistics was both done in the controller and the presentation layer. Since ballistics is part of the presentation that needs to be done on every redraw I moved all of the ballistics code into the widget, and do a much simpler calculation in libobs/obs_audio_controls.c


----------



## Take Vos (Dec 30, 2017)

This is how far I got at the moment. Just a little bit more cleanup of the patch and I will create a pull request for it.

Features:

The yellow circle on the left is the input peak level without volume adjustment, which is useful if you need to make sure your input does not clip.
Stereo peak level.
VU meter shown as a black line inside the peak-level.
Peak-and-hold level is shown as a line shown as bright red here.
ticks at 1 dB increments, heavy ticks at 5 dB in increments.
Only 10 pixels high, compared to the original 3 pixels.
All colours, level-ranges and ballistic parameters are tuneable through .qss files.


----------



## Suslik V (Jan 1, 2018)

There was feature request on the forum where you can see the art of how the meter may look. Just alternative thought.


----------



## Take Vos (Jan 1, 2018)

Thank you for the pointer to the art work.


----------



## axd (Jul 10, 2018)

Take Vos said:


> Also master volume control is a lot less important as you can handle this by volume control on the inputs which already exist.
> 1
> Master volume on mixing desks are more often used for controlling physical volume control of stage-monitors or speaker stacks. That is different for recording and broadcasting, where the master volume control is under control of the listener.



This is wrong.

Users can choose correct mixing levels for individual sources and end up with an overall mix that is clipping.

I think a way around this is to average the channel outputs, rather than just sum them.

related: output volume visualization · OBS Studio Ideas and Suggestions


----------

