xxxxxxxxxx
23
//a player with an envelope
let sampler = new Tone.Sampler({"A1": "samples/casio/A1.mp3"});
sampler.envelope = {
attack: 0.2,
decay: 0,
sustain: 1,
release: 0.1
}
sampler.toMaster();
function keyPressed() {
sampler.triggerAttack("A1");
}
function keyReleased() {
sampler.triggerRelease();
}
function setup() {
}