jevstrudel.git / packages / tonal / README.md
1# @strudel/tonal
2
3This package adds tonal / harmonic functions to strudel Patterns.
4
5## Install
6
7```sh
8npm i @strudel/tonal --save
9```
10
11## Example
12
13```js
14import { sequence } from '@strudel/core';
15import '@strudel/tonal';
16
17const pattern = sequence(0, [1, 2]).scale('C major');
18
19const events = pattern.firstCycle().map((e) => e.show());
20```
21
22yields:
23
24```js
25(0/1 -> 1/2, 0/1 -> 1/2, C3)
26(1/2 -> 3/4, 1/2 -> 3/4, D3)
27(3/4 -> 1/1, 3/4 -> 1/1, E3)
28```
29
30[play with @strudel/tonal codesandbox](https://codesandbox.io/s/strudel-tonal-example-rgc5if?file=/src/index.js)
31
32## Tonal API
33
34See "Tonal API" in the [Strudel Tutorial](https://strudel.cc/learn/tonal)