remove dynamic updates since WX info is not updated
This commit is contained in:
@@ -147,22 +147,22 @@
|
||||
loop = null;
|
||||
}
|
||||
|
||||
// Create a loop that triggers at intervals with variation
|
||||
const updateLoopInterval = () => {
|
||||
if (loop) {
|
||||
const randomFactor = 0.8 + Math.random() * 0.4; // 0.8x to 1.2x variation
|
||||
loop.interval = burstInterval * randomFactor;
|
||||
}
|
||||
};
|
||||
// Set all audio parameters once (static until page refresh)
|
||||
if (delay) {
|
||||
const delayTimeSeconds = Tone.Time(delayTime).toSeconds();
|
||||
delay.delayTime.value = delayTimeSeconds;
|
||||
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) => {
|
||||
if (noiseSynth) {
|
||||
// Trigger noise burst at the scheduled time
|
||||
noiseSynth.triggerAttackRelease('16n', time);
|
||||
// Schedule interval update for after this callback completes
|
||||
Tone.Draw.schedule(() => {
|
||||
updateLoopInterval();
|
||||
}, time);
|
||||
}
|
||||
}, burstInterval);
|
||||
|
||||
@@ -205,34 +205,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
// Reactive updates for environmental parameters
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
// Audio parameters are set once on playback start and remain static
|
||||
|
||||
// Lifecycle
|
||||
onMount(() => {
|
||||
|
||||
@@ -237,9 +237,36 @@
|
||||
sequence = null;
|
||||
}
|
||||
|
||||
// Set transport BPM
|
||||
// Set all audio parameters once (static until page refresh)
|
||||
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(
|
||||
(time: number, chord) => {
|
||||
if (synth && chord) {
|
||||
@@ -390,55 +417,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
// Reactive updates for environmental parameters using effects
|
||||
$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);
|
||||
}
|
||||
});
|
||||
// Audio parameters are set once on playback start and remain static
|
||||
|
||||
// Lifecycle
|
||||
onMount(() => {
|
||||
|
||||
Reference in New Issue
Block a user