Skip to content

Commit

Permalink
Lower music volume to 80% on Web
Browse files Browse the repository at this point in the history
  • Loading branch information
necrashter committed Dec 11, 2023
1 parent ece836f commit d066d43
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@
// Loop the audio
source.loop = true;

// Connect the source to the audio context's destination (output)
source.connect(audioContext.destination);
// Create a gain node to control the volume
const gainNode = audioContext.createGain();

// Set the volume to 80% (0.8)
gainNode.gain.value = 0.8;

// Connect the source to the gain node and the gain node to the audio context's destination
source.connect(gainNode);
gainNode.connect(audioContext.destination);

// Start playing the audio
source.start(0);
Expand Down

0 comments on commit d066d43

Please sign in to comment.