DRUM MARKOV

by kdoodoo

HTML

<script src="https://tonejs.github.io/CDN/r6/Tone.min.js"></script>

JavaScript

var chain = new Tone.CtrlMarkov({
"https://tonejs.github.io/Tone.js/examples/audio/505/kick.mp3" : ["https://tonejs.github.io/Tone.js/examples/audio/505/snare.mp3","https://tonejs.github.io/Tone.js/examples/audio/505/hh.mp3"],

"https://tonejs.github.io/Tone.js/examples/audio/505/snare.mp3" : ["https://tonejs.github.io/Tone.js/examples/audio/505/hh.mp3","https://tonejs.github.io/Tone.js/examples/audio/505/kick.mp3"],

"https://tonejs.github.io/Tone.js/examples/audio/505/hh.mp3" : ["https://tonejs.github.io/Tone.js/examples/audio/505/kick.mp3","https://tonejs.github.io/Tone.js/examples/audio/505/snare.mp3"]
   
});

chain.value = "https://tonejs.github.io/Tone.js/examples/audio/505/snare.mp3"

var player = new Tone.Player(chain.value).toMaster();

Tone.Buffer.onload = function(){

	for (var i = 0; i < 30; i++){ 
		player.retrigger = true;
		player.start(i*.2);
  	chain.next(); 
	}; 

};