jevstrudel.git / packages / core / README.md
1# @strudel/core
2
3This package contains the bare essence of strudel.
4
5## Install
6
7```sh
8npm i @strudel/core --save
9```
10
11## Example
12
13```js
14import { sequence } from '@strudel/core';
15
16const pattern = sequence('a', ['b', 'c']);
17
18const events = pattern.queryArc(0, 1);
19
20const spans = events.map(
21  (event) => `${event.value}: ${event.whole.begin.toFraction()} - ${event.whole.end.toFraction()} `,
22);
23```
24
25yields:
26
27```log
28a: 0 - 1/2
29b: 1/2 - 3/4
30c: 3/4 - 1
31a: 1 - 3/2
32b: 3/2 - 7/4
33c: 7/4 - 2
34```
35
36- [play with @strudel/core on codesandbox](https://codesandbox.io/s/strudel-core-test-forked-9ywhv7?file=/src/index.js).
37- [open color pattern example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/canvas.html)
38- [open minimal repl example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/vanilla.html)
39- [open minimal vite example](./examples/vite-vanilla-repl/)