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