xxxxxxxxxx
63
let chain = new Tone.CtrlMarkov({
"kick": [{
"value": "kick",
"probability": 0.5
}, {
"value": "snare",
"probability": 0.5
}],
"snare": [{
"value": "hh",
"probability": 0.7
}, {
"value": "hho",
"probability": 0.3
}],
"hh": [{
"value": "kick",
"probability": 0.5
}, {
"value": "snare",
"probability": 0.5
}],
"hho": "kick"
});
let drumNames = ["kick", "snare", "hh", "hho"];
let kit = new Tone.Players({
"kick": "/samples/kick.mp3",
"snare": "/samples/snare.mp3",
"hh": "/samples/hh.mp3",
"hho": "/samples/hho.mp3"
}).toMaster();
function draw() {
}
function mouseClicked(){
var next = chain.next();
print(next);
}
// Uncomment the lines below to auto-generate and play a drum pattern
// let toneLoop = new Tone.Loop(loop, "8n").start(0);
// function loop(time) {
// let drumName = chain.next();
// print(drumName);
// kit.get(drumName).start(time);
// }
// function setup() {
// chain.value = "kick";
// }
// // Once all audio files have been loaded, start the Tone playhead
// Tone.Buffer.on('load', start);
// function start() {
// Tone.Transport.start();
// }