Question / Help Downmix to Mono = 50%?

m0m0

New Member
#1
Hey,

i just tried OBS Studio and wehen i used the normal OBS, I just clicked "Force Microphone to Mono" and everything was fine. In OBS Studio I have to set the Mic Volume to 200% to get the normal Sound, when clicking "downmix to mono". So I'm losing quality to that. Is there a way to fix this? Or is this normal?

Greetings
 

m0m0

New Member
#3
Why does OBS Studio lower the volume of the mic, when forcing to mono and why doesnt the normal OBS do this? And shouldnt be my Edirol UA-25EX be able to to fix this?
 

Suslik V

Active Member
#4
...when forcing to mono...
Post log, please.

There is setting Downmix to Mono at Advanced Audio Properties, I think, this option is not transparent for understanding. Because it always accessible (visible). It is not transparent what it would 'downmix', if source is Stereo (L, R) and output is Stereo (L, R) too, --> L+ R and double result to L and R channels? I understand "downmix to mono" as Stereo (2.0) to Mono signal conversion or Multi-channel to Mono signal conversion. I think, settings need to be renamed.

In current Studio build, the AAC sound recording uses "Stereo" mp4 container's info regardless of setting Settings>Audio>Channels or Downmix to Mono. Actual number of channels is defined by Settings>Audio>Cannels.
by MediaInfo this is visible as: Channel(s)_Original

And what doing Downmix to Mono - only god knows. Maybe feature incomplete. On my system it reduces volume level for Mic/Aux device too ^_^ It is clearly seen: when you checking the Downmix to Mono - green level bar drops a little (you need a test sound, or you must speak with constant loudness :), and when you unckecking this checkbox - green level bar returns in a few dB up, showing loud sound.

I suggest to avoid Downmix to Mono setting until you really need it (maybe in case of Settings>Audio>Channels: Mono and stereo input it do something good or so).

Edit: My test log: https://gist.github.com/a5c4bb2b071b758c3c7611d5dbfe3f29
 
Last edited:
#5
I think it would maybe make more sense to be able to just record from one of the channels of that particular input, if it's stereo? For example, my microphone goes through a mixerboard, which sends a group out back to my soundcard. So the input I get is L/R but it's the same signal on both L and R. Now when recording microphone, these kind of microphones anyway, they are by nature mono. So "stereo" isn't something you would want to use on that track. So maybe a setting to specify an input as mono in addition to the downmix to mono.

Anyway, since the basic formula is M = L / 2 + R / 2, I'm thinking if you have an input which only sends on one of the channels, and you downmix to mono, the volume would logically be lower. Where as in my case, I have the same signal on both channels, I don't notice any difference.
 

Suslik V

Active Member
#6
I think it would maybe make more sense to be able to just record from one of the channels of that particular input, if it's stereo? For example, my microphone goes through a mixerboard, which sends a group out back to my soundcard. So the input I get is L/R but it's the same signal on both L and R. Now when recording microphone, these kind of microphones anyway, they are by nature mono. So "stereo" isn't something you would want to use on that track. So maybe a setting to specify an input as mono in addition to the downmix to mono.

Anyway, since the basic formula is M = L / 2 + R / 2, I'm thinking if you have an input which only sends on one of the channels, and you downmix to mono, the volume would logically be lower. Where as in my case, I have the same signal on both channels, I don't notice any difference.
And then? How your 'M' becomes stereo at output? Goes to Left only, to Right only, or double?
 
#7
Well, admittedly, I'm no advanced user of ffmpeg and I can't really look things up either since my ISP decided to accidentally shut down my internet before the weekend.

But anyway, you can make mono tracks, right? If there is an issue with combining mono and stereo tracks in the same container and requiring them all to be stereo then your last suggestion is the next best thing and will create what is called a "dual mono" track (same information L/R) instead of a true mono track which in a 5.1 system would play from the center speaker. Doing so, the volume wouldn't be 50% as it is now requiring a gain stage to get back up to 100% and also raising the noise floor by that amount. (Inaudible or not, it's a step away from "quality")
 

Suslik V

Active Member
#8
OK. I went deep into the code and events.

1. There is code:
------------------------
PHP:
////////////////   libobs\obs-source.c
...
mono_output = audio_output_get_channels(obs->audio.audio) == 1;

if (!mono_output && (source->flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0)
        downmix_to_mono_planar(source, frames);
...
/* TODO: SSE optimization */
static void downmix_to_mono_planar(struct obs_source *source, uint32_t frames)
{
        size_t channels = audio_output_get_channels(obs->audio.audio);
        const float channels_i = 1.0f / (float)channels;
        float **data = (float**)source->audio_data.data;

        for (size_t channel = 1; channel < channels; channel++) {
                for (uint32_t frame = 0; frame < frames; frame++)
                        data[0][frame] += data[channel][frame];
        }

        for (uint32_t frame = 0; frame < frames; frame++)
                data[0][frame] *= channels_i;

        for (size_t channel = 1; channel < channels; channel++) {
                for (uint32_t frame = 0; frame < frames; frame++)
                        data[channel][frame] = data[0][frame];
        }
}
...
////////////////   libobs\media-io\audio-io.c
...

size_t audio_output_get_channels(const audio_t *audio)
{
        return audio ? audio->channels : 0;
}
...
What it do? For me, it looks like:

copy sound_data from 1-th channel to the temp_variable,
then take 2nd channel and add sound_data to the temp_variable,
then take 3nd channel and add sound_data to the temp_variable,
then take 4nd channel and add sound_data to the temp_variable,
then take 5nd channel and add sound_data to the temp_variable, //when we get overflow only god knows ^_^ for our luck only 2 channels with 16 bit signed integer data sample accepted by Studio
...
until last channel

temp_variable=temp_variable*(1/Channels_number)
// we are reducing/averaging sound that was added above, like (a+b)/2 = (a+b)*(1/2) = a/2 + b/2 = a*(1/2) + b*(1/2)
// and if Channels_number = 0, how to divide? Maybe it is impossible event?

copy temp_variable to the sound_data channel 1,
copy temp_variable to the sound_data channel 2,
copy temp_variable to the sound_data channel 3,
copy temp_variable to the sound_data channel 4,
copy temp_variable to the sound_data channel 5,
...
until last channel

It can be applied when we are output to mono and using Downmix_to_mono setting (there is some code obfuscation with mono_output, but I think it intended to run as I wrote, I may wrong of course...). But then, why we are counting channels in last assignment if we are output single one?
Code using float to calculate samples, so there is no flaw in this part.

2. Practice.
-----------------

I see level down a bit. I hear volume down a bit. I'm using stereo. In my logs "FFmpeg aac encoder" always says "channels: 0" (Win7), but I saw that it can hold "channels: 2" (Win10 users logs).
Now I wonder where is difference...
 

m0m0

New Member
#9
Hey guys,

here is my normal OBS Log File: https://gist.github.com/76343e4f5000ddf52402bcb04bfcbca8
And here is the OBS Studio Log File: https://gist.github.com/4ca73683426f4774a416688783120d01
https://gist.github.com/4ca73683426f4774a416688783120d01
I dont really understand all the technical aspects and my english is also too bad for it, but why is it working in the normal/old OBS and in the Studio Version it isn't really working.

My Mic is a Rode NT1-A and i'm using a Edirol UA-25EX Audio-Interface. And when I'm recording with Audacity in Stereo, only the left channel has Sound in it. Maybe because the XLR-Cable is plugged in "Input1/L"?

So is there a way, to avoid the volume drop in OBS Studio by the program itself or can i avoid it by doing something to the Mic/Interface driver?

Greetings
 
#10
Why OBS and OBS Studio is different for you is because the code base is different. And from just a quick look seems to be quite a different path. My uneducated guess without digging through all the sources is that somewhere along the way in OBS Classic by either OBS itself or the frameworks it was using, a muted/dead/silent channel gets detected and dealt with. And this doesn't happen now.

Ways you can solve it:
* I'm not too familiar with your audio interface, but it seems to have a mono button. Try pressing/depressing it and see if that changes anything (for example while recording in audacity, maybe you see that you get L/R in one mode). Other than that it doesn't seem to have any control software, which is a shame.

* Shouldn't that work or make no effect at all then take a look in Windows Sound Manager under Recording Devices and see if there is a mode you can switch to that makes it mono or at least voice in L/R. If you're lucky the option is there and then you don't have to use down-mix to mono in OBS as it will detect the lonely channel.

* If Sound Manager doesn't get you there, then you could try out VoiceMeeter (http://vb-audio.pagesperso-orange.fr/Voicemeeter/). I haven't tried it out myself since I use a hardware mixer, but I've seen it quite a lot recently and being recommended by streamers on twitch and youtubers. It's donationware so worth checking it out and it will definitely do what you want.

And last but not least, hopefully OBS at some point will let you choose between stereo and mono inputs making it a bit more user friendly and easier for people who don't know audio too well to get going. :)
 

Suslik V

Active Member
#11
Can you both post a log-files with recording attempts? To make sure that "channels: 0" is the Win7 related log message.

Maybe name: Mix to Planar is better than Downmix to Mono? At least, it doubles average data to both channels.

at Steve Macintosh, You'll never know, is the one channel is a noise or zero channel. And there is nothing wrong - single speaker is quieter than two. If you are simply copy one channel to another (what we are expecting from Studio and other software when we are working with the mono mic and stereo output) then your sound should be heard louder (like two speakers).

There is must be setting or standard for mono signal (to trigger it as left or right channel). This allow lossless gain at some level (by doubling channels; you can even add it both, simply L=L+R, R=L - one of them is zero, thus nothing to worry about - of course that 'zero' may be not quite zero in real life :)
 
#12
Soo, i tried this things:
- Pressing Mono Button on the Interface doesn't do anything
- I tried installing different drivers for the Interface, but also didn't work
- In the Windows Sound Manager i can't select anything with Mono or Stereo, even with the Interface-Driver it doesn't work
- I tried in the past voicemeeter, but if i'm correct, you get a delay on the signal :/

@Suslik, i dont know what "make sure that "channels: 0" is the Win7 related log message." means, but i did some recording attempts WITH downmix to mono in OBS Studio (upload current log filme): https://gist.github.com/da309809d527aedee9c1bde2380d68ff
 

Suslik V

Active Member
#14
@m0m0, It's from streaming, the message appear at recording only. And it doesn't matter are you checked Downmix to Mono or not (for any track). Can you post a new log with recording attempt? Multi-track recording with mic in one track and other sounds in other track is welcomed (You may select Downmix to Mono for mic track, it doesn't matter for log-file).
 

Suslik V

Active Member
#18
Thank you.

So, your system uses CoreAudio AAC for both streaming and recording - this is good. My sys uses FFmpeg aac encoder for streaming and recording encoders. And in case of FFmpeg (Win7) I have info line:

" [FFmpeg aac encoder: 'simple_aac'] bitrate: 160, channels: 0 "

that is strange...
Media Foundation AAC under Win10 & Win8 says channels: 2,
FFmpeg aac encoder under Win10 says channels: 2.

Maybe it do nothing, because sound is OK in my recordings, but who knows.
 

Suslik V

Active Member
#20
http://alsa.opensrc.org/Edirol_UA-25EX said:
...When recording from two mono inputs (Input 1/L and Input 2/R), the sound is mixed into a stereo stream at hardware level. Again, there is no software control over this audio device. This is a problem when you only record from one mono microphone. The resulting stereo sound includes a muted channel with noise. At software level, you may downmix this sound to mono, but this degrades quality because of the muted channel with noise...
Boost? I think, yes! Or in case of 2.5-5V mic try to "forget" about this external mixer. And you can buy second mic too...

Of course, you'll can wait for special setting to be implemented in Studio, that will allow to copy L -> R or R -> L channels or introduce special simple mix L=L+R and R=L for mono line-in.

In case of delay fight, you can try to delay all other sources to maintain whole scene in sync (maybe set offset +/- , if possible in Advanced Audio Properties). But the way you got this delay says to me that this is not right solution.

In my case (Win7), build-in sound card + rec software (OBS Studio as well) + mono mic + mic jack-in = stereo output (both channels filled, I mean), and I don't need to Downmix to Mono at all. (look for windows microphone properties>advanced tab>default format in shared mode - I think, Studio uses wasapi in shared mode for all devices: input and output. My sound card allows me only stereo modes for mic device at different bit deps and freq. Also, I have Microphone Boost +30dB setting by default at windows microphone properties>levels tab)
 
Top