Denis Thiessen
6 months ago
5 changed files with 66 additions and 27 deletions
-
32package-lock.json
-
1package.json
-
3src/components/ScrollableTab.jsx
-
57src/core/audio/AudioHandler.jsx
-
BINsrc/core/audio/samples/snare_drum.wav
@ -1,33 +1,42 @@ |
|||
import { Component } from "react"; |
|||
import * as Tone from "tone"; |
|||
import { pushToSonificationLog } from "../log/SensorLogger"; |
|||
import drumSample from "./samples/snare_drum.wav"; |
|||
|
|||
export default class AudioHandler extends Component { |
|||
playTabEarconSonification() { |
|||
pushToSonificationLog("tab_earcon"); |
|||
} |
|||
const drumSynth = new Tone.Sampler({ |
|||
C3: drumSample, |
|||
}).toDestination(); |
|||
|
|||
playTabModelSonification() { |
|||
pushToSonificationLog("tab_model"); |
|||
} |
|||
const setRotation = (angle) => { |
|||
Tone.Listener.forwardX.value = Math.sin(angle); |
|||
Tone.Listener.forwardY.value = 0; |
|||
Tone.Listener.forwardZ.value = -Math.cos(angle); |
|||
}; |
|||
|
|||
playDetailEarconSonification() { |
|||
pushToSonificationLog("detail_earcon"); |
|||
} |
|||
const setRotationRamp = (panner, angle, rampTime) => { |
|||
panner.positionX.rampTo(Math.sin(angle), rampTime); |
|||
panner.positionY.rampTo(0, rampTime); |
|||
panner.positionZ.rampTo(-Math.cos(angle), rampTime); |
|||
}; |
|||
|
|||
playDetailModelSonification() { |
|||
pushToSonificationLog("detail_model"); |
|||
} |
|||
export function playTabEarconSonification() { |
|||
pushToSonificationLog("tab_earcon"); |
|||
} |
|||
|
|||
export function playTabModelSonification() { |
|||
var loop = new Tone.Loop((time) => { |
|||
drumSynth.triggerAttackRelease("C3", "4n", time); |
|||
}, "4n"); |
|||
loop.iterations = 2; |
|||
loop.start(); |
|||
drumSynth.context.resume(); |
|||
Tone.Transport.start(); |
|||
pushToSonificationLog("tab_model"); |
|||
} |
|||
|
|||
setRotation(angle) { |
|||
Tone.Listener.forwardX.value = Math.sin(angle); |
|||
Tone.Listener.forwardY.value = 0; |
|||
Tone.Listener.forwardZ.value = -Math.cos(angle); |
|||
} |
|||
export function playDetailEarconSonification() { |
|||
pushToSonificationLog("detail_earcon"); |
|||
} |
|||
|
|||
setRotationRamp(panner, angle, rampTime) { |
|||
panner.positionX.rampTo(Math.sin(angle), rampTime); |
|||
panner.positionY.rampTo(0, rampTime); |
|||
panner.positionZ.rampTo(-Math.cos(angle), rampTime); |
|||
} |
|||
export function playDetailModelSonification() { |
|||
pushToSonificationLog("detail_model"); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue