Skip to main content

Volume

This is the formula of how the volume of a sound is calculated in minecraft:

function calcVolume(distance, vol = 1) {
let max = 16;
if (vol >= 1) {
max *= vol;
vol = 1;
}

return (vol * (max - distance)) / max;
}

Reference