I research a way to change in realtime the volume of a sound that I am playing (with sounddevice or with pygame.mixer.
I could just use the pourcentage volume of pygame.mixer.Sound.set_volume() but I have a huge problem, as it seems like it almost doesn't change anything when I do not input values like "0.01","0.12",... This problem had answers: Changing volume in pygame.mixer (almost) no effect, but I don't find in my Windows 10 those parameters...
My purpose is to set everything so I can increase/decrase a sound in real time of a certain dB, which I could do if the pourcentage of the volume would have been respected.
If it is not possible like that, a thing would be to get pydub in realtime, which is to my knowledge not easy...
set_Volume
has a range of 0 to 1.0 where 1.0 is full loudness. If you want to set it in dB, first choose a reference point. Conventionally this is at 1.0 and is called 0 dBFS and 0 is -infinity. Next take the dB value you want to set, say -6 dBFS, and convert it to the linear scale:
level = pow(10, -6/20)