Noise gate suggestion

Skymirrh

New Member
Hello,

The noise gate feature is cool but it would be even cooler if it had some more options. In particular regarding noise recognition: in Mumble you can choose between Amplitude and Signal to Noise, which is really useful as on some mics one will be better than the other and some other mics vice-versa.

At the moment OBS noise gate seems to use Signal to Noise, as it behaves exactly like in Mumble with Signal to Noise checked. It would be pretty nice for people like me to have an Amplitude setting as well, since I have a mechanical keyboard but a good microphone, with Amplitude detection I can safely mash my keyboard but with Signal to Noise my keyboard is captured.

Do you think that could be done?

EDIT: Woops, sorry for wrong subforum, thanks for fixing it :)
 

Boildown

Active Member
I use a desktop mic, as the headset mic on my headset is crap. And it picks up my keystrokes whenever there's violence and flying keys. If this omits me pounding my keyboard, I'm all for it as well.
 

ThoNohT

Developer
I've been trying to figure out what is different about the Amplitude setting. So far the internet has given me no results, just people telling you which one they prefer. So is there anyone here who can explain how the Amplitude setting works?
If not, I might have to suck it and try and install Mumble to try it out myself, even then I don't know if I'll find out what it does under the hood.
 

Skymirrh

New Member
As far as I understand it, "Amplitude" in Mumble refers to the raw amplitude captured from input, which means what is captured from the microphone is used as-is.

The Signal to Noise ratio is different since it is defined as a ratio between the maximum amplitude signal and the background noise, which typically is the signal captured when there is no input.

My experience so far (I'm only a "sound hobbyist", so I may be wrong) is that SNR is better for omnidirectional microphones (low-end microphones tend to be of that kind) as they pickup a lot of background noise, and that Amplitude is better for cardioid (sometimes called directional) microphones as they pickup only noise in front of them (so little to no background noise if properly positioned).

Now that I've put everything to words, I feel like I was mistaken and OBS probably uses Amplitude for noise gate since SNR would require additional computing, and would probably not be the default choice for developers to implement. In that case, that means I was just unable to reproduce my Mumble noise gate settings in OBS. I'll try again to make sure :)

EDIT: I confirm, I was mistaken. OBS actually uses Amplitude, and I was able to set it up like on Mumble. So I guess this thread is now more of a suggestion to add SNR since I think people with generic headset mics could take advantage of it.
 

ThoNohT

Developer
Hmm, this still is not clear to me. I wonder what the processing is that defines this ratio. Basically what 'Amplitude' does is also compare signal to noise. All you are doing (in the current Noise Gate) is set the noise ratio, although it may be called differently. Sounds up until a certain volume are considered noise. Then there is a gray area which is considered noise if the gate is closed, and considered signal if it is open, if it is open, dropping below this threshold closes the gate. And finally there's a threshold that explicitly is signal and crossing that threshold triggers opening the gate.

The difference in those microphones is really the amount of noise that is being picked up. If a directional microphone is set up correctly, there will simply be less noise, and it will be easier to gate it because the difference between your voice and noise is bigger. If I remember correctly, cardoids use the noise coming in from all other directions to actually cancel out the noise coming from straight ahead. But yet again, there is no separate signal that can be picked up to count as "noise". They both produce one sound signal, which will have some form of signal to noise ratio. So all of this still doesn't explain to me what the difference is between signal to noise and amplitude. I may very well be missing something here, but that might require an expert to explain the exact workings behind signal to noise.
 

Skymirrh

New Member
I fear there is a misunderstanding. You described in your first paragraph how a noise gate works, but my suggestion has nothing to do with the actual noise gate. It is just a different means to handle the microphone input, which itself will be used by the noise gate.

If by "Amplitude" we agree that the input from the microphone is used as-is, the noise gate receives a certain signal directly from the mic and decides to let it pass through or not depending on the thresholds.
"Signal to Noise ratio" would just be an additional treatment applied to the signal after being received from the mic and before being passed to the noise gate for threshold comparison.

I've had some signal processing classes in the past (although in electronics, it should probably look the same for noise, after all it's a signal as well :p) :
SNR = 20 * log (Signal / Noise)
log is the base 10 logarithm. Signal and Noise are amplitudes in volts, Signal being the actual "Amplitude" received from the mic and "Noise" being an "Amplitude" defined as such. I guess it would typically be the "Amplitude" received from the mic when it does not pick anything (or should not pick anything), and would probably be the tricky part to interpret.

I've looked up the sources of Mumble on GitHub and if we take a look here, we can see there is something resembling the formula given above with a prefixed "noise amplitude" of 32768.0f (no idea of what this float means inside Mumble representation, had no time to dig it yet). On line 768 we see there is something related to fSpeechProb being used when Signal to Noise is checked in the settings, although I did not quite understand what this fSpeechProb is by looking at the documentation of speex_preprocess_ctl.

Have I misinterpreted your message? Hope that'll help :)
 

ThoNohT

Developer
I'm not sure if you misinterpreted my message. But you sure have cleared some stuff up.

I tried comparing the two functions: signal (x), and SNR (20 * Log10(x / 32768) according to Mumble). I guess the real power of SNR is in the fact that it uses a logarithmic scale. I wonder what the maximum value of x is though, I'd have to find that out before I can make any senseful conclusion out of this.

I tried comparing the graphs: https://www.google.nl/search?q=plot+20* ... 2768%29,+x. As expected, the amplitude is a simple straight line. But for the SNR formula, it's probably all about the negative part. It goes from negative infinity to 0 as x goes from 0 to 32768. So I'm guessing the upper bound for the signal is 32768, and the lower bound for SNR is -96. This does look like a typical curve used in a compressor, the effect of it is to decrease the difference in level between all sounds loud enough to be considered 'signal', and to progressively increase the difference in level as the amplitude lowers. The added benefit would be that it would be easier to find the point where the noise ends, as this part of the scale is stretched out a lot and you can pick with more precision.

However, when interpreted like this, the 'noise' amplitude isn't the actual noise level, because how can this be fixed? That differs per microphone. I interpreted it as the maximal possible signal. And then the user would have to pick some levels between -96 and 0 as the signal and noise thresholds. If that's not true, then I'd really like to find out what this magic number is, and what the maximum amplitude is. And then I guess a SNR of <= 0 would be considered noise, and >0 signal.

I don't currently have time to really try stuff out, but I'm just trying to get a feeling for how it works. If I get a good idea for how this works. and no one else does this before me, I might like to fiddle around with it in a few weeks.
 
Top