|
|
@ -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( |
|
|
|
"C3", |
|
|
|
textDensityFrequencyString, |
|
|
|
time + (0.1 + 0.8 / textDensity) |
|
|
|
); |
|
|
|
}, "4n").start(); |
|
|
|
loop2.iterations = (linkDensity - 1) / 2 + 1; |
|
|
|
Tone.Transport.start(); |
|
|
|
|
|
|
|
const now = Tone.now(); |
|
|
|
|
|
|
|
synth.triggerAttackRelease("C3", textDensityFrequencyString, now); |
|
|
|
|
|
|
|
const reverbSynth = linkDensity > 0 ? drumSynth.connect(reverb) : drumSynth; |
|
|
|
reverbSynth.triggerAttackRelease( |
|
|
|
"C3", |
|
|
|
textDensityFrequencyString, |
|
|
|
now + 0.2 |
|
|
|
); |
|
|
|
|
|
|
|
pushToSonificationLog("detail_model"); |
|
|
|
offCooldown = false; |
|
|
|
setTimeout(() => { |
|
|
|
offCooldown = true; |
|
|
|
reverb.wet.value = 0; |
|
|
|
synth.disconnect(); |
|
|
|
reverbSynth.disconnect(); |
|
|
|
Tone.Transport.stop(); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
} |