On Mon, 15 Jan 2018 15:32:13 +0100, Ricard Wanderlof wrote:
On Mon, 15 Jan 2018, Takashi Iwai wrote:
The usecase we have actually calls for 55 dB of gain maximum, but I was thinking that looking at the code the maths can actually handle 90 dB so it would be good 'reasonable limit' - it's a nice round number and fits in 16 bits (signed).
The usecase we have is using digital MEMS microphones ((2S connected, with no integral amplification) and when the sound source is far away, a fair amount of gain can be needed.
But why do you need 90dB? "Because it can" is no good reason to increase such a safe limit.
No, I don't need 90 dB. The specific usecase I have calls for 55 dB, so I could of course just change the maximum from 50 to 55 dB. Or perhaps with a bit of margin, such as 60 dB or 70 dB.
They way I see it though, softvol is just an amplifier component. It's up to the user to use it for whatever purpose they want. And there is no inharent danger in allowing large gains, as the signal will just clip at full scale, it's not like having a power amplifier with infinite power resources. So the upper limit should be bound by something technical, like an internal processing stage overflowing, which is why I suggested 90 dB, as it is at slightly more than 90 dB that a 16 bit signed short overflows, 16-bit shorts being part of the current set of calculations in the MULTI_DIV_ macros. So 90 dB seemed to me a limit that is related to the technical limitations of the algorithm employed.
Note that I'm not suggesting changing the default gain range which I believe is -50 to 0 dB. In order to utilize the large gain, someone must purposefully enter a 'max_dB' value in /etc/asound.conf and then set the gain to that value, so there would seem little risk of setting a large gain by mistake.
Sure, the default shouldn't be changed, otherwise we'll hit many complaints :)
OTOH, the amplification in softvol is really dumb, and such a high gain like 90dB is doubtful whether it's really useful. As Jaroslav already suggested, we need a better setup to get more meaningful results.
Takashi