Skip to main content

fadeGlobalOut

fadeGlobalOut(duration?: number, startVolume?: number, endVolume?: number): void;

Fade out the global volume over a specified duration. Optionally, set start and end volumes.

ParameterTypeDefaultDescription
durationnumber1Fade duration in seconds
startVolumenumbercurrentVolume to start from
endVolumenumber0Volume to reach
tip

Use fadeGlobalIn to fade in the global volume.


Example

await soundManager.loadSounds([{ id: 'techno-tune', url: 'techno-tune.mp3' }]);

soundManager.play('techno-tune', { loop: true });

// Fade out global volume over 3 seconds
soundManager.fadeGlobalOut(3, 1, 0);

// After the fade completes, all sounds are effectively silent
soundManager.stopAllSounds();
Fade type:
⏱ Duration3s
0.5s8s
Try it: Play the techno-tune sound, then use Fade In to gradually raise the global volume or Fade Out to lower it across all sounds.