Skip to content

Commit 751a7ef

Browse files
committed
document generator functions, remove patterns page (whoops)
1 parent 3bc56f5 commit 751a7ef

File tree

3 files changed

+68
-156
lines changed

3 files changed

+68
-156
lines changed

src/content/docs/js/interval.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,35 @@ let n = Interval.fromName("m3");
301301

302302
m.subtract(n); // M3
303303
```
304+
305+
## Ranges
306+
307+
### `range.diatonic`
308+
309+
```ts
310+
diatonic(start?: Interval, end?: Interval): Generator<Interval, void, unknown>;
311+
```
312+
313+
Generates a range of `Interval` vectors between the two boundary `Interval`s passed-in, such that all intervals found diatonically occur.
314+
315+
If no boundary `Interval`s are specified, defaults to P1 - P8.
316+
317+
```ts
318+
let m = Interval.fromName("P1");
319+
let n = Interval.fromName("M9");
320+
Interval.range.diatonic(m, n).forEach(k => console.log(k.name));
321+
// P1 m2 M2 M3 P4 d5 A4 P5 m6 M6 m7 M7 P8 m9 M9
322+
```
323+
324+
### `range.melodic`
325+
326+
```ts
327+
melodic(): Generator<Interval, void, unknown>;
328+
```
329+
330+
Generates all the intervals traditionally considered "easily singable". Essentially no dissonant leaps or augmented/diminished intervals, nor leaps bigger than an octave.
331+
332+
```ts
333+
Interval.range.melodic().forEach(m => console.log(m.name));
334+
// P1 m2 M2 M3 P4 P5 m6 M6 P8
335+
```

src/content/docs/js/pitch.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,39 @@ let p = SPN.toPitch("F#4");
361361

362362
p = p.transposeDiatonic(4, context); // p now points to C5
363363
```
364+
365+
## Ranges
366+
367+
### `range.diatonic`
368+
369+
```ts
370+
diatonic(from: Pitch, to: Pitch, context: TonalContext): Generator<Pitch, void, unknown>;
371+
```
372+
373+
Generates a diatonic range of `Pitch` vectors between the two boundary `Pitch`es passed-in, within the specified `TonalContext`
374+
375+
```ts
376+
let context = TonalContext.fromStrings("C", "major");
377+
let p = SPN.toPitch("C4");
378+
let q = SPN.toPitch("E5");
379+
380+
Pitch.range.diatonic(p, q, context).forEach(r => console.log(SPN.fromPitch(r)));
381+
// C4 D4 E4 F4 G4 A4 B4 C5 D5 E5
382+
```
383+
384+
### `range.chromatic`
385+
386+
```ts
387+
chromatic(from: Pitch, to: Pitch, context: TonalContext): Generator<Pitch, void, unknown>;
388+
```
389+
390+
Generates a chromatic range of `Pitch` vectors between the two boundary `Pitch`es passed-in, within the specified `TonalContext`. Essentially any all pitches between the boundaries that could occur diatonically or chromatically in a given tonal context.
391+
392+
```ts
393+
let context = TonalContext.fromStrings("C", "major");
394+
let p = SPN.toPitch("C4");
395+
let q = SPN.toPitch("E5");
396+
397+
Pitch.range.chromatic(p, q, context).forEach(r => console.log(SPN.fromPitch(r)));
398+
// C4 Db4 C#4 D4 Eb4 D#4 E4 F4 Gb4 F#4 G4 Ab4 G#4 A4 Bb4 A#4 B4 C5 Db5 C#5 D5 Eb5 D#5 E5
399+
```

src/content/docs/start/patterns.mdx

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)