How do you increase or decrease the volume of an audio signal which is expressed in a floating point number (float).
Is it just a multiplication?
float volume_control(float signal, float gain) {
return signal*gain;
}
How can you control that function by let’s say decibels like in:
volume_control(x, 28) //should increase 28 DB.
Yes, jsut multiply. If you output it, make sure to clamp the output in [0, 1] or [-1, 1] depending on your conventions.
In decibel, use:
See wiki on decibels.