mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
989 B
989 B
@strudel/web
This package provides an easy to use bundle of multiple strudel packages for the web.
Usage
import { repl } from '@strudel/web';
const strudel = repl();
document.getElementById('play').addEventListener('click',
() => strudel.evaluate('note("c a f e").jux(rev)')
);
Note: Due to the Autoplay policy, you can only play audio in a browser after a click event.
Loading samples
By default, no external samples are loaded, but you can add them like this:
import { repl, samples } from '@strudel/web';
const strudel = repl({
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'),
});
document.getElementById('play').addEventListener('click',
() => strudel.evaluate('s("bd,jvbass(3,8)").jux(rev)')
);
You can learn more about the samples function here.