Skip to main content

unmuteAllSounds

Lift the global mute. The master volume goes back to the value it had before muteAllSounds.

unmuteAllSounds(): void;

Parameters​

This method takes no parameters.

Returns​

Nothing.

Example​

import { SoundHub } from 'soundhub';

const soundHub = new SoundHub();
await soundHub.loadSounds([
{ id: 'music', url: '/audio/theme.mp3' },
{ id: 'rain', url: '/audio/rain.mp3' },
]);

soundHub.play('music', { loop: true });
soundHub.play('rain', { loop: true });

soundHub.muteAllSounds();
soundHub.unmuteAllSounds();

Try it​

Try it

Mute everything at once

Idle
tokyo-trainstopped
bells-melodystopped
techno-tunestopped
Masteraudible

The three sounds keep playing while muted. Only the master output goes silent.

Code
Your clicks show up here as soundhub calls

Good to know​

  • It restores the master gain. Buffered sounds you muted one by one with mute stay muted.
  • Streams from loadStream are all unmuted with unmute, including a stream you had muted on its own.
  • It also lifts the mute that autoMuteOnHidden applies when the page is hidden, and the silence left by fadeGlobalOut to 0.
  • Dispatches SoundEventsEnum.UNMUTE_GLOBAL ('unmute_global') with the restored volume.

See also​