Skip to content

volumeToGain

function volumeToGain(volume): number;

Convert a volume percentage to the gain applied to the PCM stream.

The curve compensates the loudness perception of the raw sample scaling, so 50 sounds roughly half as loud as 100 instead of being 6 dB quieter.

number

The volume percentage, from 0 to 100

number

The gain to apply to every sample