Client: Add support for input gain control#1222
Client: Add support for input gain control#1222hoffie merged 1 commit intojamulussoftware:masterfrom
Conversation
|
Ok. Just tested the artifact. An immediate thought I had after installing it: why isn't it a slider? But probably that's ok if it's a one time setting. |
That's a deliberate choice. This is supposed to be a one-time setting. Changing this repeatedly or on-the-fly would be really annoying for other participants who would have to constantly update the person's level in their mix. |
|
Internal computer microphones will pick up extraneous noises and are basically junk. Jamulus cannot make up for hardware shortcomings. Get a better microphone ... I did! |
|
Also, a cheap gamer headset with a mic is much better than the internal microphone (that picks up the fan noise). |
|
Thanks for your comments, @DavidSavinkoff!
I agree.
It can improve things in some cases, at least.
I did. Not everyone can or wants to affort that.
Yes, the relevant change is in the audio processing path. I would not call a multiply operation bloat or a relevant performance degration unless proven. Might make sense to run a benchmark though.
I don't agree here. Adding gain decides about being able to use Jamulus or not in such cases.
This is due to the organization of UI code. Adding anything with a UI setting is going to touch these files.
If it is decided not to accept this PR for main stream Jamulus, then this will continue to be my workaround: Distributing a special build to the users who need it. I'm doing this already. I have opened this PR because the code has been developed, has proven to work and has helped making Jamulus usable for those persons. A previous version of your comment suggested guarding such new code by
I see you have already opened a discussion for that, thanks! Please also note that this is still a Pull Request, so it is not decided yet whether to have this in Jamulus or not. |
|
This has been discussed before and my stance hasn't changed: input audio processing happens outside Jamulus. |
|
Although in general I agree that audio processing should take place on OS level if possible, we also need to keep usability in mind. This feature seems simple and I do see value with it. |
|
For uses having trouble with their internal microphone, do we consider a set of earbuds with a microphone from their smartphone a good step? It does seem everyone has a smartphone and, by extension, earbuds and microphone too. This could be a quick (temporary) fix for the internal microphone noise. |
|
I notice that I need to click outside of the text field in order for the newly entered setting to take effect. I think it would be useful to mention this in the help text. Alternatively, maybe there's a different signal than
I'd be surprised if this gave reasonable latency. Has anyone tried it? |
I wasn't clear. Many people have a wired set of earbuds with microphone for their smartphone. We can hate the reposnse curve of that microphone. Seems to me that would be better than the builtin notebook microphone. That won't introduce any latency issues; its wired. |
Oh I see. It's not common in my experience so I didn't think of that. I don't know whether it would generally produce better results, but if someone has access to multiple microphones they may as well try them all to see which one sounds best.
This is sometimes true, but other times not. I play with 3 other people using internal sound cards and builtin/not great microphones. For 2 of them, there is quite a bit of background noise coming from their microphones, and this feature would not help them. But the 3rd person's built-in microphone actually sounds perfectly fine, it's just kind of quiet (I could hear them almost okay with both the Jamulus slider and audio interface volume set to max, but the others had trouble). I got them to test out this build yesterday, and it worked quite well. Thanks for posting it @hoffie!
As far as I can tell, when using ASIO4ALL, there is no way to adjust microphone gain. The standard OS audio settings don't affect the sound level. So while this position seems logical, I don't think it corresponds to the reality. |
22a4081 to
39cafd8
Compare
|
Thanks for the feedback so far. Although I'm not sure if this has a chance of being accepted, people do use it and I have therefore fixed two bugs in 39cafd8:
|
39cafd8 to
ca8d93c
Compare
|
My two cents is that while I agree with @pljones, I think this issue has become a "will of the people" thing. If we oppose it, we will forever more be explaining why. So I'm OK not spending the energy on that, and instead accepting what is in reality a pretty minor UI change. |
ca8d93c to
e847ecd
Compare
|
Just fetched this to build it and try it, and noticed it said it was building "3.7.0 (release)". It looks like this was branched from 03bc4c1 (tag r3_7_0). We ought never to branch from a tagged release. In this case the branch point should be the 3.7.0dev commit immediately afterwards fabe41c or later. |
There was a problem hiding this comment.
The code as it is looks fine, and does what it was intended to, but I have some comments and suggestions:
- I noticed that changing the value did not affect the input level meter. It would probably help the user determine the optimum setting if the input level meter was driven from the scaled input.
- I imagine the user does not need a very fine resolution in the setting, and I wonder if it would be better to have a drop-down offering multiples of 100% (or multiples of 2dB?)
- For people who have a microphone in one channel and an instrument in the other, might they want to set the input gain independently for each channel?
|
In fact, since 100% is the lowest accepted value, maybe it should be called Input Boost, rather than Input Gain? That might make its purpose clearer? |
Uhm, you are right. This shouldn't have happened. I've rebased on master now. Sorry for that. Thanks for your other suggestions, I'll look at them later. |
79ecd44 to
d0faac3
Compare
This sounds like a good idea. I have adapted the code by moving the gain application right before the input level meter update.
Hrm, good point. This would require more UI space and more logic though. I wonder if we should just wait if someone comes and requests this feature? It might not be that common to have a bad, low-gain microphone in addition to having an instrument attached (probably via some interface)? I'd tend to not add it now to keep it as simple as possible.
Good idea, I have renamed all variables, functions, comments and labels accordingly. |
ghost
left a comment
There was a problem hiding this comment.
In:
src/client.cpp
The following code is inefficient:
if ( iInputBoost != 100 ) {
// apply a general gain boost to all audio input:
for ( i = 0, j = 0; i < iMonoBlockSizeSam; i++, j += 2 )
{
vecsStereoSndCrd[j + 1] = static_cast<int16_t> ( iInputBoost * vecsStereoSndCrd[j + 1] / 100);
vecsStereoSndCrd[j] = static_cast<int16_t> ( iInputBoost * vecsStereoSndCrd[j] / 100);
}
Fix before for loop:
Boost=iInputBoost*0.01;
Then use Boost instead of iInputBoost, and get rid of the /100
d0faac3 to
56a28b2
Compare
I have turned this into a combo box with factors ranging from "None" for no boost to 10x. What do you think?
Thanks for the pointer. I have incorporated this into the latest state of this PR. Due to the change from percentages to factors, the division by 100 is eliminated completely. |
ghost
left a comment
There was a problem hiding this comment.
Audio processing code in src/client.cpp is efficient and minimally invasive.Good.
The smallest useful increment is 3dB. However, most people cannot hear that difference. If a coarse adjustment is enough then 10dB is a common increment. |
softins
left a comment
There was a problem hiding this comment.
There are a couple of unneeded .qm file updates here too, but it doesn't matter, as they will be updated when rebuilding anyway.
Code looks good, and the feature operates as intended.
e278811 to
f501e85
Compare
This adds a new client-only UI setting to apply a gain boost on all audio input. Related to: jamulussoftware#1030 Signed-off-by: Christian Hoffmann <[email protected]>
f501e85 to
c5db1b2
Compare
|
Just a small question (didn't test the new code here): Why don't we support lowering the input gain too? |
I don't see a use case for this. Reasoning:
I also tried explaining this in the Let me know if you think otherwise. :) |
I usually have problems with people clipping not being to quiet. Therefore I tell them to reduce their input gain on OS level (if they don't have an interface). The question for me is where clipping occurs: If it happens before it comes into Jamulus, sure it wouldn't help. If it occurs in Jamulus, adding this feature does help. At least that's my understanding. |
Yes, and this is the right thing to do. Clipping may occur due to Windows' microphone gain/boost. If it happens there, this is the place to fix (and Jamulus would not be able to fix it).
Yep.
I don't think Jamulus does have any features which could cause clipping on the input (maybe the reverb could, but only if the input signal is really close to clipping to begin with). Mixing could clip (I think), but this is usually more of a problem if choosing a mix which is too loud, I think? |
|
As discussed with @ann0see via chat, we can merge this as-is for now and look if permitting lowering of input gain should be implemented. |
|
In a build of the currrent 3.7.1 state I noticed the implementation of the microphone boost. Certainly this is a very useful feature whenever the hardware microphone gain is insufficient. But the current implementation using equispaced numeric gain factors may not be adequate to human loudness perception. To match better with human perception gain factors should be spaced by equal factors, or even better, replaced by equispaced dB steps. These steps could either be |
|
For a setting that will be adjusted frequently in use, I would agree with you. But when I reviewed and tested this PR, with a low-level input, I did find a noticeable change with each boost factor. This feature is designed for set-and-forget use, and typically the user will just choose the setting appropriate to their input device and leave it there. |
|
There are already too many Gain levels... +6dB=2 +12dB=4 +20dB=10 are abundantly generous. |
This adds a new client-only UI setting to apply a gain value on all audio input.
This solves the problem that some (internal?) microphones cannot be made to output louder signals using operating system mechanisms (Windows sound settings). Multiple people in my choir use builds with this code included.
This approach solves the problem as close to the source and as simple as possible. I would have preferred to permit extending the fader range in the mixer board, but this would have been a way more intrusive change (introduction of new protocol messages, etc.).
Related to: #1030