Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 612649f

Browse files
committed
document superdough() in the README file
1 parent be8b4d7 commit 612649f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/superdough/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,29 @@ superdough({ s: 'bd', delay: 0.5 }, 0, 1);
9292
- `deadline`: seconds until the sound should play (0 = immediate)
9393
- `duration`: seconds the sound should last. optional for one shot samples, required for synth sounds
9494

95+
### prepare()
96+
97+
Informs superdough that a sound will be needed in the future.
98+
If the sound is a sample that is not loaded yet, it will be fetched.
99+
Otherwise does nothing.
100+
`value` has a syntax identical to the one used `superdough()`.
101+
102+
```js
103+
prepare({ s: 'bd', delay: 0.5 });
104+
105+
// some time later
106+
107+
superdough({ s: 'bd', delay: 0.5 }, 0, 1);
108+
```
109+
110+
Can be awaited to ensure that a given sound is ready to play.
111+
112+
```js
113+
const sound = { s: 'hh' };
114+
await prepare(sound);
115+
superdough(sound, 0, 1);
116+
```
117+
95118
### registerSynthSounds()
96119

97120
Loads the default waveforms `sawtooth`, `square`, `triangle` and `sine`. Use them like this:

0 commit comments

Comments
 (0)