Browse Source

feat: Added final sonification effect.

master
Denis Thiessen 5 months ago
parent
commit
dce0f4e052
  1. 27
      src/core/audio/AudioHandler.jsx

27
src/core/audio/AudioHandler.jsx

@ -203,21 +203,34 @@ export function playDetailModelSonification(textDensity, linkDensity) {
if (offCooldown) {
const synth = drumSynth.toDestination();
// To circumvent a bug with reverb creation. Doesn't affect the lack of reverb though... See below.
const reverbAmount = linkDensity === 0 ? 1 : linkDensity;
const reverb = new Tone.Reverb(reverbAmount).toDestination();
reverb.wet.value = 0;
reverb.wet.rampTo(1, 0.25);
const textDensityFrequencyString = 2 * textDensity + "n";
var loop2 = new Tone.Loop((time) => {
synth.triggerAttackRelease("C3", textDensityFrequencyString, time);
synth.triggerAttackRelease(
const now = Tone.now();
synth.triggerAttackRelease("C3", textDensityFrequencyString, now);
const reverbSynth = linkDensity > 0 ? drumSynth.connect(reverb) : drumSynth;
reverbSynth.triggerAttackRelease(
"C3",
textDensityFrequencyString,
time + (0.1 + 0.8 / textDensity)
now + 0.2
);
}, "4n").start();
loop2.iterations = (linkDensity - 1) / 2 + 1;
Tone.Transport.start();
pushToSonificationLog("detail_model");
offCooldown = false;
setTimeout(() => {
offCooldown = true;
reverb.wet.value = 0;
synth.disconnect();
reverbSynth.disconnect();
Tone.Transport.stop();
}, 500);
}
}
Loading…
Cancel
Save