<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Tone demo</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/0.10.0/Tone.min.js" charset="utf-8"></script>
    <script type="text/javascript">
      var synth = new Tone.Sampler("./bass-1.wav").toMaster();
      //synth.triggerAttackRelease("C4", "8n");

      var steps = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
      var loop = new Tone.Sequence(function(time, col){
        synth.triggerAttackRelease(Math.floor(Math.random() * 16), "4n");
      }, steps, "16n");
      Tone.Transport.start();

      loop.start();


      //loop.stop();
    </script>
  </head>
  <body>

  </body>
</html>

Изменить пасту