fadeGlobalOut
fadeGlobalOut(duration?: number, startVolume?: number, endVolume?: number): void;
Fade out the global volume over a specified duration. Optionally, set start and end volumes.
| Parameter | Type | Default | Description |
|---|---|---|---|
duration | number | 1 | Fade duration in seconds |
startVolume | number | current | Volume to start from |
endVolume | number | 0 | Volume 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.