From 45a96448f7ed00b7167306c75835855686f1276e Mon Sep 17 00:00:00 2001 From: GuillaumeSD Date: Fri, 30 May 2025 02:18:59 +0200 Subject: [PATCH] fix : audio volume --- src/lib/sounds.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/sounds.ts b/src/lib/sounds.ts index 558dbcc..077a0ad 100644 --- a/src/lib/sounds.ts +++ b/src/lib/sounds.ts @@ -8,7 +8,10 @@ const playSound = async (url: string) => { audioContext = new AudioContext(); audio = new Audio(); const source = audioContext.createMediaElementSource(audio); - source.connect(audioContext.destination); + const volume = audioContext.createGain(); + volume.gain.value = 0.3; + source.connect(volume); + volume.connect(audioContext.destination); } audio.src = url;