I think there may be an issue with the effects volume parsing. Any time I hear a sound effect for the first time, it's as if it's set to full volume. Subsequent visits to the planet have the "effects volume" respected correctly (tested on planets 0026 and 0029), but that first one is always deafening. If I update the sound effect volume slider WHILE the loud sound effect is running, it will update to use the correct volume.
At a glance of the massive twine html file, I'm guessing it's to do with with the default case here (stormSound on planet 0029 has similar logic, which is what I've been using to test this):
> run setup.laugSound.volume = (typeof $sfxVol === "number") ? $sfxVol : 1;
Removing this doesn't fix the issue, though, and after trying a few other things, editing the file crashed Vim on my laptop haha. Sorry that's not more useful outside of a problem report -- I barely know JavaScript, let alone the DOM and SugarCube / Twine's nuances.
Tested on Firefox 143.0.4 (64-bit) on Windows 11.
That said, here's a hilariously stupid temporary fix (forces an update to the sound effects slider every 5ms) for anyone with a userscript manager installed that's also very sensitive to loud noises, courtesy of ChatGPT:
JavaScript:
(function() {
'use strict';
// *** USER CONFIGURATION ***
const INTERVAL_DELAY_MS = 5; // Frequency of volume changes
const RETRY_INTERVAL_MS = 100; // Retry interval to check for element
const volume = 0.05; // Change this to whatever volume value you want
function tryFindElementAndStart() {
const mediaElement = document.querySelector("#effectsVolumeControl"); // Change selector as needed
if (mediaElement) {
console.log("Element found, starting volume control.");
function setVolume() {
mediaElement.value = volume;
// Optionally trigger an input event to make it take effect
mediaElement.dispatchEvent(new Event('input', { bubbles: true }));
}
// Set volume repeatedly
setInterval(setVolume, INTERVAL_DELAY_MS);
clearInterval(retryInterval); // Stop retrying once found
} else {
console.log("Waiting for effectsVolumeControl...");
}
}
const retryInterval = setInterval(tryFindElementAndStart, RETRY_INTERVAL_MS);
})();