@prtcl/plonk 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
|
-
# plonk
|
|
1
|
+
# @prtcl/plonk
|
|
2
2
|
|
|
3
|
-
Tiny library
|
|
3
|
+
Tiny library providing timers, envelopes, and random generators for creative coding, animation loops, and synthesis engines. Inspired by time-based functions from Max/MSP and SuperCollider.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i @prtcl/plonk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's included
|
|
12
|
+
|
|
13
|
+
- **Timers** — `Metro`, `Frames` — high-resolution recursive loops with runtime metrics
|
|
14
|
+
- **Generators** — `Drunk`, `Rand`, `Env`, `Sine`, `Scale` — random walks, envelopes, oscillators, and range mapping
|
|
15
|
+
- **Utilities** — `now`, `ms`, `clamp`, `expo`, `flip` — timing and math helpers
|
|
16
|
+
|
|
17
|
+
Generators follow an iterator-inspired `value()` / `next()` pattern — they're stateful objects you pull from on your own schedule (a timer callback, a Web Audio worklet, a game loop, etc).
|
|
18
|
+
|
|
19
|
+
## Quick example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { Metro, Drunk, Rand } from '@prtcl/plonk';
|
|
23
|
+
|
|
24
|
+
const d = new Drunk({ min: -1, max: 1 });
|
|
25
|
+
const r = new Rand({ min: 50, max: 150 });
|
|
26
|
+
|
|
27
|
+
const metro = new Metro(() => {
|
|
28
|
+
console.log(d.next());
|
|
29
|
+
metro.setTime(r.next());
|
|
30
|
+
}, { time: 100 });
|
|
31
|
+
|
|
32
|
+
metro.run();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
See the full [API Reference](https://github.com/prtcl/plonk/blob/main/docs/API.md).
|
|
38
|
+
|
|
39
|
+
Also available: [`@prtcl/plonk-hooks`](https://www.npmjs.com/package/@prtcl/plonk-hooks) for React integration.
|