Merge pull request #607 from tidalcycles/doc-fixes

tonal fixes
This commit is contained in:
Felix Roos 2023-06-18 10:36:17 +02:00 committed by GitHub
commit 36aa7d9b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 21 deletions

View File

@ -145,7 +145,7 @@ export const scaleTranspose = register('scaleTranspose', function (offset /* : n
export const scale = register('scale', function (scale, pat) {
// Supports ':' list syntax in mininotation
if (Array.isArray(scale)) {
scale = scale.join(' ');
scale = scale.flat().join(' ');
}
return pat.withHap((hap) => {
const isObject = typeof hap.value === 'object';

View File

@ -87,7 +87,7 @@ export const SIDEBAR: Sidebar = {
{ text: 'Signals', link: 'learn/signals' },
{ text: 'Conditional Modifiers', link: 'learn/conditional-modifiers' },
{ text: 'Accumulation', link: 'learn/accumulation' },
{ text: 'Tonal Modifiers', link: 'learn/tonal' },
{ text: 'Tonal Functions', link: 'learn/tonal' },
],
Development: [
{ text: 'REPL', link: 'technical-manual/repl' },

View File

@ -32,4 +32,4 @@ import { JsDoc } from '../../docs/JsDoc';
<JsDoc client:idle name="stut" h={0} />
There are also [Tonal Modifiers](/learn/tonal).
There are also [Tonal Functions](/learn/tonal).

View File

@ -1,14 +1,29 @@
---
title: Tonal API
title: Tonal Functions
layout: ../../layouts/MainLayout.astro
---
import { MiniRepl } from '../../docs/MiniRepl';
import { JsDoc } from '../../docs/JsDoc';
# Tonal API
# Tonal Functions
The Tonal API, uses [tonaljs](https://github.com/tonaljs/tonal) to provide helpers for musical operations.
These functions use [tonaljs](https://github.com/tonaljs/tonal) to provide helpers for musical operations.
### scale(name)
Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like scaleTranspose.
<MiniRepl
client:idle
tune={`"0 2 4 6 4 2"
.scale("C2:major C2:minor").slow(2))
.note().s("piano")`}
/>
Note that the scale root is octaved here. You can also omit the octave, then index zero will default to octave 3.
All the available scale names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).
### transpose(semitones)
@ -22,21 +37,6 @@ Instead of numbers, scientific interval notation can be used as well:
<MiniRepl client:only="react" tune={`"c2 c3".fast(2).transpose("<1P -2M 4P 3m>".slow(2)).note()`} />
### scale(name)
Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like scaleTranspose.
<MiniRepl
client:idle
tune={`"0 2 4 6 4 2"
.scale(seq('C2 major', 'C2 minor').slow(2))
.note()`}
/>
Note that the scale root is octaved here. You can also omit the octave, then index zero will default to octave 3.
All the available scale names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).
### scaleTranspose(steps)
Transposes notes inside the scale by the number of steps: