remove dynamic updates since WX info is not updated

This commit is contained in:
2025-12-29 19:23:24 +02:00
parent 8bf5a4dacd
commit ef3343cf62
2 changed files with 41 additions and 89 deletions

View File

@@ -147,22 +147,22 @@
loop = null; loop = null;
} }
// Create a loop that triggers at intervals with variation // Set all audio parameters once (static until page refresh)
const updateLoopInterval = () => { if (delay) {
if (loop) { const delayTimeSeconds = Tone.Time(delayTime).toSeconds();
const randomFactor = 0.8 + Math.random() * 0.4; // 0.8x to 1.2x variation delay.delayTime.value = delayTimeSeconds;
loop.interval = burstInterval * randomFactor; delay.feedback.value = delayFeedback;
} }
};
if (gain) {
gain.gain.value = Tone.dbToGain(volume);
}
// Create a loop with static interval (no variation)
loop = new Tone.Loop((time) => { loop = new Tone.Loop((time) => {
if (noiseSynth) { if (noiseSynth) {
// Trigger noise burst at the scheduled time // Trigger noise burst at the scheduled time
noiseSynth.triggerAttackRelease('16n', time); noiseSynth.triggerAttackRelease('16n', time);
// Schedule interval update for after this callback completes
Tone.Draw.schedule(() => {
updateLoopInterval();
}, time);
} }
}, burstInterval); }, burstInterval);
@@ -205,34 +205,7 @@
} }
}; };
// Reactive updates for environmental parameters // Audio parameters are set once on playback start and remain static
// Note: Reverb wet is fixed at 0.8 for spacious sound, not reactive to humidity
// Memoize delay time conversion to avoid repeated calculations
const delayTimeSeconds = $derived.by(() => {
return Tone.Time(delayTime).toSeconds();
});
$effect(() => {
if (delay && isInitialized) {
delay.delayTime.rampTo(delayTimeSeconds, 0.5);
delay.feedback.rampTo(delayFeedback, 0.5);
}
});
$effect(() => {
if (gain && isInitialized) {
gain.gain.rampTo(Tone.dbToGain(volume), 0.1);
}
});
$effect(() => {
if (loop && isPlaying) {
// Update loop interval dynamically
const baseInterval = burstInterval;
loop.interval = baseInterval;
}
});
// Lifecycle // Lifecycle
onMount(() => { onMount(() => {

View File

@@ -237,9 +237,36 @@
sequence = null; sequence = null;
} }
// Set transport BPM // Set all audio parameters once (static until page refresh)
Tone.getTransport().bpm.value = bpm; Tone.getTransport().bpm.value = bpm;
if (reverb) {
reverb.wet.value = reverbWet;
}
if (delay) {
const delayTimeSeconds = Tone.Time(delayTime).toSeconds();
delay.delayTime.value = delayTimeSeconds;
delay.feedback.value = delayFeedback;
}
if (filter) {
filter.frequency.value = filterCutoff;
filter.Q.value = filterResonance;
}
if (gain) {
gain.gain.value = Tone.dbToGain(volume);
}
if (arpSynth) {
arpSynth.volume.value = arpVolume;
}
if (pingSynth) {
pingSynth.volume.value = pingVolume;
}
sequence = new Tone.Sequence( sequence = new Tone.Sequence(
(time: number, chord) => { (time: number, chord) => {
if (synth && chord) { if (synth && chord) {
@@ -390,55 +417,7 @@
} }
}; };
// Reactive updates for environmental parameters using effects // Audio parameters are set once on playback start and remain static
$effect(() => {
if (reverb && isInitialized) {
reverb.wet.rampTo(reverbWet, 0.5);
}
});
// Memoize delay time conversion to avoid repeated calculations
const delayTimeSeconds = $derived.by(() => {
return Tone.Time(delayTime).toSeconds();
});
$effect(() => {
if (delay && isInitialized) {
delay.delayTime.rampTo(delayTimeSeconds, 0.5);
delay.feedback.rampTo(delayFeedback, 0.5);
}
});
$effect(() => {
if (filter && isInitialized) {
filter.frequency.rampTo(filterCutoff, 1.0);
filter.Q.rampTo(filterResonance, 1.0);
}
});
$effect(() => {
if (gain && isInitialized) {
gain.gain.rampTo(Tone.dbToGain(volume), 0.1);
}
});
$effect(() => {
if (isPlaying && isInitialized) {
Tone.getTransport().bpm.rampTo(bpm, 1.0);
}
});
$effect(() => {
if (arpSynth && isInitialized) {
arpSynth.volume.rampTo(arpVolume, 0.5);
}
});
$effect(() => {
if (pingSynth && isInitialized) {
pingSynth.volume.rampTo(pingVolume, 0.5);
}
});
// Lifecycle // Lifecycle
onMount(() => { onMount(() => {