|
|
@ -20,6 +20,29 @@ const setRotationRamp = (panner, angle, rampTime) => { |
|
|
|
|
|
|
|
var offCooldown = true; |
|
|
|
|
|
|
|
const playChordEndSound = function () { |
|
|
|
if (offCooldown) { |
|
|
|
const synth = drumSynth.toDestination(); |
|
|
|
|
|
|
|
var loop = new Tone.Loop((time) => { |
|
|
|
synth.triggerAttackRelease("C3", "4n", time); |
|
|
|
}, "4n").start(); |
|
|
|
loop.iterations = 1; |
|
|
|
|
|
|
|
var loop2 = new Tone.Loop((time) => { |
|
|
|
synth.triggerAttackRelease("D3", "12n", time + 0.3); |
|
|
|
}, "12n").start(); |
|
|
|
loop2.iterations = 2; |
|
|
|
synth.context.resume(); |
|
|
|
Tone.Transport.start(); |
|
|
|
offCooldown = false; |
|
|
|
setTimeout(() => { |
|
|
|
offCooldown = true; |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// Maybe also dat... |
|
|
|
export function playTabEarconSonification() { |
|
|
|
if (offCooldown) { |
|
|
|
var loop = new Tone.Loop((time) => { |
|
|
@ -27,7 +50,6 @@ export function playTabEarconSonification() { |
|
|
|
}, "4n"); |
|
|
|
loop.iterations = 2; |
|
|
|
loop.start(); |
|
|
|
drumSynth.context.resume(); |
|
|
|
Tone.Transport.start(); |
|
|
|
pushToSonificationLog("tab_earcon"); |
|
|
|
offCooldown = false; |
|
|
@ -37,14 +59,32 @@ export function playTabEarconSonification() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export function playTabModelSonification() { |
|
|
|
export function playTabModelSonification(pannerVal, frequencyVal, endReached) { |
|
|
|
|
|
|
|
if(endReached) { |
|
|
|
playChordEndSound(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (offCooldown) { |
|
|
|
const frequencyString = frequencyVal + "n"; |
|
|
|
const panner = new Tone.Panner3D({ |
|
|
|
panningModel: "HRTF", |
|
|
|
positionX: 1000, |
|
|
|
positionY: 1000, |
|
|
|
positionZ: 0, |
|
|
|
}); |
|
|
|
const synth = drumSynth.toDestination().connect(panner); |
|
|
|
Tone.Listener.positionX.value = pannerVal * 5.0; |
|
|
|
Tone.Listener.positionZ.value = 5.0; |
|
|
|
var loop = new Tone.Loop((time) => { |
|
|
|
drumSynth.triggerAttackRelease("C3", "4n", time); |
|
|
|
}, "4n"); |
|
|
|
synth.triggerAttackRelease("C3", frequencyString, time); |
|
|
|
}, frequencyString).start(); |
|
|
|
loop.iterations = 2; |
|
|
|
loop.start(); |
|
|
|
drumSynth.context.resume(); |
|
|
|
|
|
|
|
if (frequencyVal > 12) { |
|
|
|
loop.iterations = 3; |
|
|
|
} |
|
|
|
Tone.Transport.start(); |
|
|
|
pushToSonificationLog("tab_model"); |
|
|
|
offCooldown = false; |
|
|
@ -54,6 +94,7 @@ export function playTabModelSonification() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Menu Sonification Paper. :) |
|
|
|
export function playDetailEarconSonification(textDensity, linkDensity) { |
|
|
|
if (offCooldown) { |
|
|
|
var loop = new Tone.Loop((time) => { |
|
|
@ -73,12 +114,18 @@ export function playDetailEarconSonification(textDensity, linkDensity) { |
|
|
|
|
|
|
|
export function playDetailModelSonification(textDensity, linkDensity) { |
|
|
|
if (offCooldown) { |
|
|
|
var loop = new Tone.Loop((time) => { |
|
|
|
drumSynth.triggerAttackRelease("C3", "4n", time); |
|
|
|
}, "4n"); |
|
|
|
loop.iterations = 2; |
|
|
|
loop.start(); |
|
|
|
drumSynth.context.resume(); |
|
|
|
const synth = drumSynth.toDestination(); |
|
|
|
|
|
|
|
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(); |
|
|
|
pushToSonificationLog("detail_model"); |
|
|
|
offCooldown = false; |
|
|
|