From 9d396dadbfbb05ecba20b9524656a9130c5f034b Mon Sep 17 00:00:00 2001 From: Markus Aurala Date: Mon, 8 Jun 2026 12:01:34 +0300 Subject: [PATCH] =?UTF-8?q?fix(utils-sound):=20muted=20SFX=20emit=20a=20fu?= =?UTF-8?q?ll-volume=20click=20=E2=80=94=20apply=20player=20volume=20to=20?= =?UTF-8?q?the=20Howl=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit createPlayer.volume() retuned sounds already in soundMap but never set the Howl's own (default) volume. A sound played after volume() runs starts at the Howl default (1) for the instant between howl.play() and initSoundVolume() applying its per-sound volume — a full-volume attack transient, audible as a click, most obviously when muted (player volume 0). The fix line existed but was commented out and referenced an out-of-scope `howl` (every call site uses playerOptions.howl), likely commented before a refactor renamed it. Re-enable it in the in-scope form; the per-sound loop still refines each active sound. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/utils-sound/src/createPlayer.svelte.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/utils-sound/src/createPlayer.svelte.ts b/packages/utils-sound/src/createPlayer.svelte.ts index db9dd095b..684c13460 100644 --- a/packages/utils-sound/src/createPlayer.svelte.ts +++ b/packages/utils-sound/src/createPlayer.svelte.ts @@ -82,8 +82,11 @@ function createPlayer(playerO const volume = (volume: number) => { playerVolume = volume; - //Adjust the whole player volume - // howl.volume(playerVolume); + // Also set the Howl's default volume, so a sound played AFTER this runs + // inherits the current (e.g. muted) level. Otherwise it starts at the + // Howl default and emits a full-volume attack transient before + // initSoundVolume applies its per-sound volume — an audible click when muted. + playerOptions.howl.volume(playerVolume); //adjust volume per sound (Object.values(soundMap) as Sound[]).forEach((sound) => {