32blit-sdk icon indicating copy to clipboard operation
32blit-sdk copied to clipboard

Volume is too LOUD

Open ali1234 opened this issue 4 years ago • 2 comments

In my opinion, the volume slider doesn't have enough range at low volume levels, and too much at high levels. Basically, the lowest volume you can set is too loud for a quiet room, and anything above 50% is absurdly loud.

Volume handling code is here: https://github.com/pimoroni/32blit-beta/blob/master/32blit-stm32/Src/32blit.cpp#L215

This code attempts to do a logarithmic volume control. However, it seems to be actually doing anti-log. I made a graph to plot the output from this function:

https://www.desmos.com/calculator/rzxgdduvi7

H is the value of volume_log_base which is a constant in the code. In the existing code it equals 2. This makes the volume increase quickly at first, and then slowly at higher volumes. This seems backwards to me: it should increase slowly at first, and then quickly at higher volumes. In order to achieve that, H must be less than 1. (At 1 it would behave linearly, except that it causes a division by zero because log(1) = 0.)

From experimentation I have found that a value around 0.04 is needed to get the lowest volume setting suitable for a quiet room (and therefore an even lower value may be desirable).

(Note that this doesn't change how loud the loudest setting is, it just changes how quickly the volume increases.)

ali1234 avatar Feb 01 '21 03:02 ali1234

Would an 's' curve formula be more suited? This would give greater granularity at either end.

tinwhisker avatar Feb 02 '21 09:02 tinwhisker

Not really. Currently there is no discernable difference between the maximum and max-1 volume, while min+1 is about twice as loud as minimum volume. The backlight control behaves in a very similar way too. This is to be expected, because human senses are logarithmic (and the current volume algorithm in the firmware is anti-log ie it makes the problem worse).

ali1234 avatar Feb 15 '21 16:02 ali1234