add superdough package

This commit is contained in:
Felix Roos 2023-08-11 10:42:59 +02:00
parent 2483bf812f
commit 30fe2dd502
19 changed files with 1384 additions and 17 deletions

View file

@ -0,0 +1,25 @@
import { superdough, samples, initAudioOnFirstClick, registerSynthSounds } from 'superdough';
initAudioOnFirstClick();
const load = Promise.all([samples('github:tidalcycles/Dirt-Samples/master'), registerSynthSounds()]);
let button = document.getElementById('play');
const loop = (t = 0) => {
superdough({ s: 'bd', delay: 0.5 }, t);
superdough({ note: 'g1', s: 'sawtooth', cutoff: 600, resonance: 8 }, t, 0.125);
superdough({ note: 'g2', s: 'sawtooth', cutoff: 600, resonance: 8 }, t + 0.25, 0.125);
superdough({ s: 'hh' }, t + 0.25);
superdough({ s: 'sd', room: 0.5 }, t + 0.5);
superdough({ s: 'hh' }, t + 0.75);
};
button.addEventListener('click', async () => {
console.log('play');
await load;
let t = 0.1;
while (t < 16) {
loop(t++);
}
});