fix: still had strudel core imports

This commit is contained in:
Felix Roos 2023-08-11 10:51:59 +02:00
parent 2778e4d697
commit 82cb4c8c11
5 changed files with 42 additions and 17 deletions

View file

@ -1,12 +1,13 @@
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 init = Promise.all([
initAudioOnFirstClick(),
samples('github:tidalcycles/Dirt-Samples/master'),
registerSynthSounds(),
]);
const loop = (t = 0) => {
// superdough(value, time, duration)
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);
@ -15,9 +16,8 @@ const loop = (t = 0) => {
superdough({ s: 'hh' }, t + 0.75);
};
button.addEventListener('click', async () => {
console.log('play');
await load;
document.getElementById('play').addEventListener('click', async () => {
await init;
let t = 0.1;
while (t < 16) {
loop(t++);