1<!doctype html> 2<html> 3 <head> 4 <title>Superdough Example</title> 5 <meta charset="UTF-8" /> 6 </head> 7 8 <body> 9 <button id="play">PLAAAAAAAY</button> 10 <script type="module"> 11 import { superdough, samples, initAudioOnFirstClick, registerSynthSounds } from 'superdough'; 12 13 const init = Promise.all([ 14 initAudioOnFirstClick(), 15 samples('github:tidalcycles/dirt-samples'), 16 registerSynthSounds(), 17 ]); 18 19 const loop = (t = 0) => { 20 // superdough(value, time, duration) 21 superdough({ s: 'bd', delay: 0.5 }, t); 22 superdough({ note: 'g1', s: 'sawtooth', cutoff: 600, resonance: 8 }, t, 0.125); 23 superdough({ note: 'g2', s: 'sawtooth', cutoff: 600, resonance: 8 }, t + 0.25, 0.125); 24 superdough({ s: 'hh' }, t + 0.25); 25 superdough({ s: 'sd', room: 0.5 }, t + 0.5); 26 superdough({ s: 'hh' }, t + 0.75); 27 }; 28 29 document.getElementById('play').addEventListener('click', async () => { 30 await init; 31 let t = 0.1; 32 while (t < 16) { 33 loop(t++); 34 } 35 }); 36 </script> 37 </body> 38</html>