@musodojo/music-theory-data 30.0.0 → 31.1.0
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 +87 -287
- package/esm/src/data/chord-progressions/mod.d.ts +3 -0
- package/esm/src/data/chord-progressions/mod.d.ts.map +1 -1
- package/esm/src/data/chord-progressions/mod.js +2 -0
- package/esm/src/data/chords/mod.d.ts +12 -0
- package/esm/src/data/chords/mod.d.ts.map +1 -1
- package/esm/src/data/chords/mod.js +1 -0
- package/esm/src/data/chromatic.d.ts +2 -0
- package/esm/src/data/chromatic.d.ts.map +1 -1
- package/esm/src/data/chromatic.js +2 -0
- package/esm/src/data/colors/mod.d.ts +14 -0
- package/esm/src/data/colors/mod.d.ts.map +1 -1
- package/esm/src/data/colors/mod.js +5 -0
- package/esm/src/data/note-collections/augmented-variants.d.ts +1 -0
- package/esm/src/data/note-collections/augmented-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/augmented-variants.js +1 -0
- package/esm/src/data/note-collections/diminished-variants.d.ts +1 -0
- package/esm/src/data/note-collections/diminished-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/diminished-variants.js +1 -0
- package/esm/src/data/note-collections/dominant-variants.d.ts +1 -0
- package/esm/src/data/note-collections/dominant-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/dominant-variants.js +1 -0
- package/esm/src/data/note-collections/major-variants.d.ts +1 -0
- package/esm/src/data/note-collections/major-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/major-variants.js +1 -0
- package/esm/src/data/note-collections/minor-variants.d.ts +1 -0
- package/esm/src/data/note-collections/minor-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/minor-variants.js +1 -0
- package/esm/src/data/note-collections/other-collections.d.ts +1 -0
- package/esm/src/data/note-collections/other-collections.d.ts.map +1 -1
- package/esm/src/data/note-collections/other-collections.js +1 -0
- package/esm/src/data/note-collections/pentatonic-variants.d.ts +1 -0
- package/esm/src/data/note-collections/pentatonic-variants.d.ts.map +1 -1
- package/esm/src/data/note-collections/pentatonic-variants.js +1 -0
- package/esm/src/data/tunings/bass-guitar-tunings.d.ts +7 -0
- package/esm/src/data/tunings/bass-guitar-tunings.d.ts.map +1 -1
- package/esm/src/data/tunings/bass-guitar-tunings.js +3 -0
- package/esm/src/data/tunings/folk-fretted-string-tunings.d.ts +7 -0
- package/esm/src/data/tunings/folk-fretted-string-tunings.d.ts.map +1 -1
- package/esm/src/data/tunings/folk-fretted-string-tunings.js +3 -0
- package/esm/src/data/tunings/guitar-tunings.d.ts +8 -0
- package/esm/src/data/tunings/guitar-tunings.d.ts.map +1 -1
- package/esm/src/data/tunings/guitar-tunings.js +3 -0
- package/esm/src/data/tunings/orchestral-string-tunings.d.ts +6 -0
- package/esm/src/data/tunings/orchestral-string-tunings.d.ts.map +1 -1
- package/esm/src/data/tunings/orchestral-string-tunings.js +2 -0
- package/esm/src/data/tunings/string-instrument-groups.d.ts +8 -0
- package/esm/src/data/tunings/string-instrument-groups.d.ts.map +1 -1
- package/esm/src/data/tunings/string-instrument-groups.js +6 -0
- package/esm/src/data/tunings/string-instrument-tunings.d.ts +10 -0
- package/esm/src/data/tunings/string-instrument-tunings.d.ts.map +1 -1
- package/esm/src/data/tunings/string-instrument-tunings.js +5 -0
- package/esm/src/mod.d.ts +0 -47
- package/esm/src/mod.d.ts.map +1 -1
- package/esm/src/mod.js +0 -47
- package/esm/src/utils/chord-progressions.d.ts +7 -0
- package/esm/src/utils/chord-progressions.d.ts.map +1 -1
- package/esm/src/utils/chord-progressions.js +6 -0
- package/esm/src/utils/chords.d.ts +1 -1
- package/esm/src/utils/chords.d.ts.map +1 -1
- package/esm/src/utils/chords.js +13 -28
- package/esm/src/utils/intervals.d.ts +1 -0
- package/esm/src/utils/intervals.d.ts.map +1 -1
- package/esm/src/utils/intervals.js +4 -1
- package/package.json +1 -1
- package/script/src/data/chord-progressions/mod.d.ts +3 -0
- package/script/src/data/chord-progressions/mod.d.ts.map +1 -1
- package/script/src/data/chord-progressions/mod.js +2 -0
- package/script/src/data/chords/mod.d.ts +12 -0
- package/script/src/data/chords/mod.d.ts.map +1 -1
- package/script/src/data/chords/mod.js +1 -0
- package/script/src/data/chromatic.d.ts +2 -0
- package/script/src/data/chromatic.d.ts.map +1 -1
- package/script/src/data/chromatic.js +2 -0
- package/script/src/data/colors/mod.d.ts +14 -0
- package/script/src/data/colors/mod.d.ts.map +1 -1
- package/script/src/data/colors/mod.js +5 -0
- package/script/src/data/note-collections/augmented-variants.d.ts +1 -0
- package/script/src/data/note-collections/augmented-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/augmented-variants.js +1 -0
- package/script/src/data/note-collections/diminished-variants.d.ts +1 -0
- package/script/src/data/note-collections/diminished-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/diminished-variants.js +1 -0
- package/script/src/data/note-collections/dominant-variants.d.ts +1 -0
- package/script/src/data/note-collections/dominant-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/dominant-variants.js +1 -0
- package/script/src/data/note-collections/major-variants.d.ts +1 -0
- package/script/src/data/note-collections/major-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/major-variants.js +1 -0
- package/script/src/data/note-collections/minor-variants.d.ts +1 -0
- package/script/src/data/note-collections/minor-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/minor-variants.js +1 -0
- package/script/src/data/note-collections/other-collections.d.ts +1 -0
- package/script/src/data/note-collections/other-collections.d.ts.map +1 -1
- package/script/src/data/note-collections/other-collections.js +1 -0
- package/script/src/data/note-collections/pentatonic-variants.d.ts +1 -0
- package/script/src/data/note-collections/pentatonic-variants.d.ts.map +1 -1
- package/script/src/data/note-collections/pentatonic-variants.js +1 -0
- package/script/src/data/tunings/bass-guitar-tunings.d.ts +7 -0
- package/script/src/data/tunings/bass-guitar-tunings.d.ts.map +1 -1
- package/script/src/data/tunings/bass-guitar-tunings.js +3 -0
- package/script/src/data/tunings/folk-fretted-string-tunings.d.ts +7 -0
- package/script/src/data/tunings/folk-fretted-string-tunings.d.ts.map +1 -1
- package/script/src/data/tunings/folk-fretted-string-tunings.js +3 -0
- package/script/src/data/tunings/guitar-tunings.d.ts +8 -0
- package/script/src/data/tunings/guitar-tunings.d.ts.map +1 -1
- package/script/src/data/tunings/guitar-tunings.js +3 -0
- package/script/src/data/tunings/orchestral-string-tunings.d.ts +6 -0
- package/script/src/data/tunings/orchestral-string-tunings.d.ts.map +1 -1
- package/script/src/data/tunings/orchestral-string-tunings.js +2 -0
- package/script/src/data/tunings/string-instrument-groups.d.ts +8 -0
- package/script/src/data/tunings/string-instrument-groups.d.ts.map +1 -1
- package/script/src/data/tunings/string-instrument-groups.js +6 -0
- package/script/src/data/tunings/string-instrument-tunings.d.ts +10 -0
- package/script/src/data/tunings/string-instrument-tunings.d.ts.map +1 -1
- package/script/src/data/tunings/string-instrument-tunings.js +5 -0
- package/script/src/mod.d.ts +0 -47
- package/script/src/mod.d.ts.map +1 -1
- package/script/src/mod.js +0 -47
- package/script/src/utils/chord-progressions.d.ts +7 -0
- package/script/src/utils/chord-progressions.d.ts.map +1 -1
- package/script/src/utils/chord-progressions.js +6 -0
- package/script/src/utils/chords.d.ts +1 -1
- package/script/src/utils/chords.d.ts.map +1 -1
- package/script/src/utils/chords.js +13 -28
- package/script/src/utils/intervals.d.ts +1 -0
- package/script/src/utils/intervals.d.ts.map +1 -1
- package/script/src/utils/intervals.js +5 -1
package/README.md
CHANGED
|
@@ -1,166 +1,93 @@
|
|
|
1
1
|
# Muso Dojo | Music Theory Data
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
## Features
|
|
36
|
-
|
|
37
|
-
- **Fully Typed:** Written in TypeScript with comprehensive type definitions for
|
|
38
|
-
a great developer experience.
|
|
39
|
-
- **Deno First, NPM Ready:** A modern Deno module that is also published to npm
|
|
40
|
-
for use in Node.js projects.
|
|
41
|
-
|
|
42
|
-
### Rich Data Structures
|
|
43
|
-
|
|
44
|
-
Access detailed information for notes, dyads, scales, modes, chord pitch
|
|
45
|
-
collections, chord progression templates, and more, including intervals, integer
|
|
46
|
-
notations, and common names.
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
// src/data/note-collections/diatonic-modes.ts
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
const ionian: ModalScaleCollection = {
|
|
52
|
-
category: "scale",
|
|
53
|
-
rotation: 0,
|
|
54
|
-
rotatedScale: "ionian",
|
|
55
|
-
mostSimilarScale: "ionian",
|
|
56
|
-
primaryName: "Major",
|
|
57
|
-
names: ["Major", "Ionian", "Major Scale", "Ionian Mode", "Diatonic Major"],
|
|
58
|
-
intervals: ["1", "2", "3", "4", "5", "6", "7", "8"],
|
|
59
|
-
integers: [0, 2, 4, 5, 7, 9, 11],
|
|
60
|
-
type: [
|
|
61
|
-
"major",
|
|
62
|
-
"ionian",
|
|
63
|
-
"mode",
|
|
64
|
-
"scale",
|
|
65
|
-
"church mode",
|
|
66
|
-
"diatonic mode",
|
|
67
|
-
"heptatonic",
|
|
68
|
-
"first diatonic mode",
|
|
69
|
-
"do mode",
|
|
70
|
-
],
|
|
71
|
-
characteristics: [
|
|
72
|
-
"bright",
|
|
73
|
-
"happy",
|
|
74
|
-
"stable",
|
|
75
|
-
"uplifting",
|
|
76
|
-
"consonant",
|
|
77
|
-
"western",
|
|
78
|
-
"foundational",
|
|
79
|
-
"simple",
|
|
80
|
-
"pop music",
|
|
81
|
-
"major tonality",
|
|
82
|
-
"commonly used western scale",
|
|
83
|
-
],
|
|
84
|
-
pattern: ["whole", "whole", "half", "whole", "whole", "whole", "half"],
|
|
85
|
-
patternShort: ["W", "W", "H", "W", "W", "W", "H"],
|
|
86
|
-
} as const;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Practical Utility Functions
|
|
90
|
-
|
|
91
|
-
Helpers for common tasks like generating note names from a root note and a set
|
|
92
|
-
of intervals. For the full implementation details, refer to the source file.
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
export function getNoteNamesFromRootAndIntervals(
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
rootNote: RootNote,
|
|
98
|
-
intervals: readonly Interval[],
|
|
99
|
-
options: TransformIntervalsOptions = {},
|
|
100
|
-
): NoteName[] {
|
|
101
|
-
// This is a simplified representation for documentation purposes.
|
|
102
|
-
// The actual implementation is in src/utils/note-names.ts
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
```
|
|
3
|
+
A type-safe TypeScript/JavaScript library of music theory data and helpers for
|
|
4
|
+
music apps, education tools, practice tools, and creative coding projects.
|
|
5
|
+
|
|
6
|
+
It includes typed datasets for notes, intervals, scales, modes, chord pitch
|
|
7
|
+
collections, chord progressions, string instrument tunings, note colors, MIDI
|
|
8
|
+
helpers, and naming utilities.
|
|
9
|
+
|
|
10
|
+
## What's Included
|
|
11
|
+
|
|
12
|
+
- **Note collections:** notes, dyads, scales, modes, arpeggios, and chord pitch
|
|
13
|
+
collections, grouped into families such as diatonic modes, pentatonic
|
|
14
|
+
variants, major/minor/dominant variants, harmonic minor modes, melodic minor
|
|
15
|
+
modes, diminished variants, and augmented variants.
|
|
16
|
+
- **Chord progressions:** 4-bar foundational loops, 8-bar loops, and 12-bar
|
|
17
|
+
blues progressions with roman symbols, scale degrees, qualities, and bar
|
|
18
|
+
durations.
|
|
19
|
+
- **Labels and theory primitives:** note names, root notes, intervals, chromatic
|
|
20
|
+
indexes, roman numerals, chord qualities, and conversion helpers.
|
|
21
|
+
- **Application helpers:** note-name generation, interval transforms, chord
|
|
22
|
+
progression resolution, chord spelling, MIDI helpers, note colors, contrast
|
|
23
|
+
helpers, and string instrument tunings.
|
|
24
|
+
- **TypeScript-first API:** exported data, utility functions, and types are
|
|
25
|
+
designed to work well with autocomplete and compile-time checking.
|
|
26
|
+
|
|
27
|
+
For exhaustive data, types, and function signatures, use the
|
|
28
|
+
[JSR API documentation](https://jsr.io/@musodojo/music-theory-data/doc). The
|
|
29
|
+
`tests/` directory also contains practical examples of supported behavior.
|
|
30
|
+
|
|
31
|
+
## Package Registries
|
|
32
|
+
|
|
33
|
+
- [JSR package](https://jsr.io/@musodojo/music-theory-data)
|
|
34
|
+
- [npm package](https://www.npmjs.com/package/@musodojo/music-theory-data)
|
|
106
35
|
|
|
107
36
|
## Installation
|
|
108
37
|
|
|
109
38
|
### Deno / JSR
|
|
110
39
|
|
|
111
|
-
Install the package from the JSR registry:
|
|
112
|
-
|
|
113
40
|
```bash
|
|
114
41
|
deno add jsr:@musodojo/music-theory-data
|
|
115
42
|
```
|
|
116
43
|
|
|
117
|
-
Then import it into your project:
|
|
118
|
-
|
|
119
44
|
```ts
|
|
120
|
-
import * as
|
|
45
|
+
import * as musicTheoryData from "jsr:@musodojo/music-theory-data";
|
|
121
46
|
```
|
|
122
47
|
|
|
123
48
|
### Node.js / npm
|
|
124
49
|
|
|
125
|
-
Install the package from the npm registry:
|
|
126
|
-
|
|
127
50
|
```bash
|
|
128
51
|
npm install @musodojo/music-theory-data
|
|
129
52
|
```
|
|
130
53
|
|
|
131
|
-
Then import it into your project:
|
|
132
|
-
|
|
133
54
|
```ts
|
|
134
|
-
import * as
|
|
55
|
+
import * as musicTheoryData from "@musodojo/music-theory-data";
|
|
135
56
|
```
|
|
136
57
|
|
|
137
|
-
## Usage
|
|
58
|
+
## Usage
|
|
138
59
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
The code below shows how to access and print some of the data.
|
|
60
|
+
### Get Note Names
|
|
142
61
|
|
|
143
62
|
```ts
|
|
144
|
-
import * as
|
|
63
|
+
import * as musicTheoryData from "jsr:@musodojo/music-theory-data";
|
|
145
64
|
|
|
146
|
-
|
|
147
|
-
const notes1 = music_theory_data.getNoteNamesForRootAndNoteCollectionKey(
|
|
65
|
+
const aHarmonicMinor = musicTheoryData.getNoteNamesForRootAndNoteCollectionKey(
|
|
148
66
|
"A",
|
|
149
67
|
"harmonicMinor",
|
|
150
68
|
);
|
|
151
|
-
|
|
69
|
+
|
|
70
|
+
console.log(aHarmonicMinor);
|
|
152
71
|
// ["A", "B", "C", "D", "E", "F", "G♯", "A"]
|
|
153
72
|
|
|
154
|
-
|
|
155
|
-
const notes2 = music_theory_data.getNoteNamesForRootAndNoteCollectionKey(
|
|
73
|
+
const fMajor = musicTheoryData.getNoteNamesForRootAndNoteCollectionKey(
|
|
156
74
|
"F",
|
|
157
75
|
"ionian",
|
|
158
76
|
);
|
|
159
|
-
console.log(notes2);
|
|
160
|
-
// ["F", "G", "A", "B♭", "C", "D", "E", "F"];
|
|
161
77
|
|
|
162
|
-
|
|
163
|
-
|
|
78
|
+
console.log(fMajor);
|
|
79
|
+
// ["F", "G", "A", "B♭", "C", "D", "E", "F"]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Inspect A Note Collection
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import {
|
|
86
|
+
groupedNoteCollections,
|
|
87
|
+
noteCollections,
|
|
88
|
+
} from "jsr:@musodojo/music-theory-data";
|
|
89
|
+
|
|
90
|
+
const ionian = noteCollections.ionian;
|
|
164
91
|
|
|
165
92
|
console.log(ionian.primaryName);
|
|
166
93
|
// "Major"
|
|
@@ -168,170 +95,40 @@ console.log(ionian.primaryName);
|
|
|
168
95
|
console.log(ionian.intervals);
|
|
169
96
|
// ["1", "2", "3", "4", "5", "6", "7", "8"]
|
|
170
97
|
|
|
171
|
-
|
|
172
|
-
console.log(Object.keys(music_theory_data.noteCollections));
|
|
173
|
-
// ["ionian", "dorian", "phrygian", ...]
|
|
174
|
-
|
|
175
|
-
// Log an array of all available Grouped Note Collections Keys
|
|
176
|
-
console.log(Object.keys(music_theory_data.groupedNoteCollections));
|
|
98
|
+
console.log(Object.keys(groupedNoteCollections));
|
|
177
99
|
// ["diatonicModes", "pentatonicVariants", ...]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Each collection includes structured fields such as names, intervals, integer
|
|
103
|
+
notation, type tags, and musical characteristics. See the generated docs or
|
|
104
|
+
source files for complete schemas.
|
|
178
105
|
|
|
179
|
-
|
|
180
|
-
|
|
106
|
+
### Resolve Chord Progressions
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import {
|
|
110
|
+
chordProgressions,
|
|
111
|
+
getChordProgressionChordNames,
|
|
112
|
+
getChordProgressionRomanSymbols,
|
|
113
|
+
getChordProgressionTotalDurationInBars,
|
|
114
|
+
} from "jsr:@musodojo/music-theory-data";
|
|
115
|
+
|
|
116
|
+
const oneSixFourFive = chordProgressions.oneSixFourFive;
|
|
181
117
|
|
|
182
118
|
console.log(oneSixFourFive.chords.map((chord) => chord.romanSymbol));
|
|
183
119
|
// ["I", "vi", "IV", "V"]
|
|
184
120
|
|
|
185
|
-
console.log(oneSixFourFive
|
|
186
|
-
// [
|
|
187
|
-
// { romanSymbol: "I", degree: "1", quality: "M", durationInBars: 1 },
|
|
188
|
-
// { romanSymbol: "vi", degree: "6", quality: "m", durationInBars: 1 },
|
|
189
|
-
// { romanSymbol: "IV", degree: "4", quality: "M", durationInBars: 1 },
|
|
190
|
-
// { romanSymbol: "V", degree: "5", quality: "M", durationInBars: 1 },
|
|
191
|
-
// ]
|
|
192
|
-
|
|
193
|
-
console.log(
|
|
194
|
-
music_theory_data.getChordProgressionRomanSymbols("oneSixFourFive"),
|
|
195
|
-
);
|
|
121
|
+
console.log(getChordProgressionRomanSymbols("oneSixFourFive"));
|
|
196
122
|
// ["I", "vi", "IV", "V"]
|
|
197
123
|
|
|
198
|
-
console.log(
|
|
199
|
-
music_theory_data.getChordProgressionChordNames(
|
|
200
|
-
"C",
|
|
201
|
-
"oneSixFourFive",
|
|
202
|
-
),
|
|
203
|
-
);
|
|
124
|
+
console.log(getChordProgressionChordNames("C", "oneSixFourFive"));
|
|
204
125
|
// ["CM", "Am", "FM", "GM"]
|
|
205
126
|
|
|
206
|
-
console.log(
|
|
207
|
-
music_theory_data.getChordProgressionUniqueChordNames(
|
|
208
|
-
"C",
|
|
209
|
-
"oneFourOneFiveSplitReturn",
|
|
210
|
-
),
|
|
211
|
-
);
|
|
212
|
-
// ["CM", "FM", "GM"]
|
|
213
|
-
|
|
214
|
-
// Chord-change references return one item each time the chord changes in
|
|
215
|
-
// progression.chords. Durations are not expanded here.
|
|
216
|
-
console.log(
|
|
217
|
-
music_theory_data.getChordProgressionChordChangeReferences(
|
|
218
|
-
"C",
|
|
219
|
-
"oneOneFiveFive",
|
|
220
|
-
),
|
|
221
|
-
);
|
|
222
|
-
// [
|
|
223
|
-
// { rootNote: "C", chordName: "CM", noteCollectionKey: "major" },
|
|
224
|
-
// { rootNote: "G", chordName: "GM", noteCollectionKey: "major" },
|
|
225
|
-
// ]
|
|
226
|
-
|
|
227
|
-
// Unique chord references return each distinct chord once, preserving the
|
|
228
|
-
// first-seen order from the chord-change list.
|
|
229
|
-
console.log(
|
|
230
|
-
music_theory_data.getChordProgressionUniqueChordReferences(
|
|
231
|
-
"C",
|
|
232
|
-
"oneFourOneFiveSplitReturn",
|
|
233
|
-
),
|
|
234
|
-
);
|
|
235
|
-
// [
|
|
236
|
-
// { rootNote: "C", chordName: "CM", noteCollectionKey: "major" },
|
|
237
|
-
// { rootNote: "F", chordName: "FM", noteCollectionKey: "major" },
|
|
238
|
-
// { rootNote: "G", chordName: "GM", noteCollectionKey: "major" },
|
|
239
|
-
// ]
|
|
240
|
-
|
|
241
|
-
// Chord references by bar return the song/practice order grouped by bar. A
|
|
242
|
-
// 2-bar chord appears in two bars, and split bars contain multiple references.
|
|
243
|
-
console.log(
|
|
244
|
-
music_theory_data.getChordProgressionChordReferencesByBar(
|
|
245
|
-
"C",
|
|
246
|
-
"oneOneFiveFive",
|
|
247
|
-
),
|
|
248
|
-
);
|
|
249
|
-
// [
|
|
250
|
-
// [{ rootNote: "C", chordName: "CM", noteCollectionKey: "major" }],
|
|
251
|
-
// [{ rootNote: "C", chordName: "CM", noteCollectionKey: "major" }],
|
|
252
|
-
// [{ rootNote: "G", chordName: "GM", noteCollectionKey: "major" }],
|
|
253
|
-
// [{ rootNote: "G", chordName: "GM", noteCollectionKey: "major" }],
|
|
254
|
-
// ]
|
|
255
|
-
|
|
256
|
-
console.log(
|
|
257
|
-
music_theory_data.getChordProgressionChordReferencesByBar(
|
|
258
|
-
"C",
|
|
259
|
-
"oneFourOneFiveSplitReturn",
|
|
260
|
-
)[6],
|
|
261
|
-
);
|
|
262
|
-
// [
|
|
263
|
-
// { rootNote: "C", chordName: "CM", noteCollectionKey: "major" },
|
|
264
|
-
// { rootNote: "G", chordName: "GM", noteCollectionKey: "major" },
|
|
265
|
-
// ]
|
|
266
|
-
|
|
267
|
-
// Song chord references flatten the bar-structured references into one ordered
|
|
268
|
-
// list for apps that want one diagram/card per chord occurrence.
|
|
269
|
-
console.log(
|
|
270
|
-
music_theory_data.getChordProgressionSongChordReferences(
|
|
271
|
-
"C",
|
|
272
|
-
"oneOneFiveFive",
|
|
273
|
-
).map((reference) => reference.chordName),
|
|
274
|
-
);
|
|
275
|
-
// ["CM", "CM", "GM", "GM"]
|
|
276
|
-
|
|
277
|
-
// In Muso Dojo, "Each Chord Once" should import
|
|
278
|
-
// getChordProgressionUniqueChordReferences. "Full Song Order" should import
|
|
279
|
-
// getChordProgressionSongChordReferences, or flatten
|
|
280
|
-
// getChordProgressionChordReferencesByBar locally when bar grouping is needed.
|
|
281
|
-
|
|
282
|
-
console.log(
|
|
283
|
-
music_theory_data.getChordProgressionTotalDurationInBars("twelveBarBlues"),
|
|
284
|
-
);
|
|
285
|
-
// 12
|
|
286
|
-
|
|
287
|
-
console.log(
|
|
288
|
-
music_theory_data.getChordProgressionChordReferencesByBar(
|
|
289
|
-
"C",
|
|
290
|
-
"twelveBarBlues",
|
|
291
|
-
).length,
|
|
292
|
-
);
|
|
127
|
+
console.log(getChordProgressionTotalDurationInBars("twelveBarBlues"));
|
|
293
128
|
// 12
|
|
294
|
-
|
|
295
|
-
console.log(
|
|
296
|
-
music_theory_data.getChordProgressionUniqueChordReferences(
|
|
297
|
-
"C",
|
|
298
|
-
"twelveBarBlues",
|
|
299
|
-
),
|
|
300
|
-
);
|
|
301
|
-
// [
|
|
302
|
-
// { rootNote: "C", chordName: "C7", noteCollectionKey: "dominant7" },
|
|
303
|
-
// { rootNote: "F", chordName: "F7", noteCollectionKey: "dominant7" },
|
|
304
|
-
// { rootNote: "G", chordName: "G7", noteCollectionKey: "dominant7" },
|
|
305
|
-
// ]
|
|
306
|
-
|
|
307
|
-
console.log(music_theory_data.chordProgressionBarGroups);
|
|
308
|
-
// [
|
|
309
|
-
// { totalBars: 4, progressionKeys: ["oneOneFiveFive", ...] },
|
|
310
|
-
// { totalBars: 8, progressionKeys: ["oneFourOneFiveSplitReturn"] },
|
|
311
|
-
// { totalBars: 12, progressionKeys: ["twelveBarBlues", "twelveBarBluesQuickChange"] },
|
|
312
|
-
// ]
|
|
313
|
-
|
|
314
|
-
console.log(music_theory_data.getChordProgressionKeysForTotalBars(12));
|
|
315
|
-
// ["twelveBarBlues", "twelveBarBluesQuickChange"]
|
|
316
129
|
```
|
|
317
130
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
Note color collections use 12 chromatic slots. In absolute mode, each index is a
|
|
321
|
-
pitch class where index `0` is C and index `7` is G. In relative mode, each
|
|
322
|
-
index is measured from a musical root where index `0` is the root and index `7`
|
|
323
|
-
is the fifth.
|
|
324
|
-
|
|
325
|
-
`noteLabelCollections.noteNamesFlat` is the default label set for absolute note
|
|
326
|
-
colors, and `noteLabelCollections.intervalsFlat` is the default label set for
|
|
327
|
-
relative note colors. `ChromaticIndex` is the shared `0`-to-`11` pitch-class
|
|
328
|
-
shape used by chromatic tuples, note labels, root-note integers, and filled
|
|
329
|
-
chromatic interval helpers. `ChromaticMode` is the shared `"absolute"` or
|
|
330
|
-
`"relative"` mode used by note colors and label collections.
|
|
331
|
-
|
|
332
|
-
Chromatic indexes must be integers. Helpers such as `normalizeChromaticIndex`
|
|
333
|
-
wrap negative or large semitone values into the `0`-to-`11` range, but reject
|
|
334
|
-
fractional or non-finite values.
|
|
131
|
+
### Use Note Colors And Chromatic Indexes
|
|
335
132
|
|
|
336
133
|
```ts
|
|
337
134
|
import {
|
|
@@ -344,6 +141,7 @@ const absoluteIndex = getNoteColorIndex({
|
|
|
344
141
|
midi: 67,
|
|
345
142
|
mode: "absolute",
|
|
346
143
|
});
|
|
144
|
+
|
|
347
145
|
console.log(absoluteIndex);
|
|
348
146
|
// 7, the pitch class G
|
|
349
147
|
|
|
@@ -352,6 +150,7 @@ const relativeIndex = getNoteColorIndex({
|
|
|
352
150
|
mode: "relative",
|
|
353
151
|
rootPitchClass: 2,
|
|
354
152
|
});
|
|
153
|
+
|
|
355
154
|
console.log(relativeIndex);
|
|
356
155
|
// 7, A as the fifth above D
|
|
357
156
|
|
|
@@ -359,16 +158,17 @@ console.log(getNoteColorLabels(colorCollections.musoDojoRootAndFifth));
|
|
|
359
158
|
// ["1", "♭2", "2", "♭3", "3", "4", "♭5", "5", "♭6", "6", "♭7", "7"]
|
|
360
159
|
```
|
|
361
160
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
choose their own visual fallback through theme or UI settings.
|
|
365
|
-
|
|
366
|
-
Regular note collection interval arrays remain variable length because chords,
|
|
367
|
-
dyads, arpeggios, and scales have different natural sizes. Helpers that opt into
|
|
368
|
-
`fillChromatic: true` return a fixed 12-slot chromatic tuple.
|
|
161
|
+
Note color collections use 12 chromatic slots. Absolute mode treats index `0` as
|
|
162
|
+
C; relative mode treats index `0` as the chosen musical root.
|
|
369
163
|
|
|
370
164
|
## API Documentation
|
|
371
165
|
|
|
372
|
-
For
|
|
373
|
-
the
|
|
166
|
+
For the full list of available data, types, and utility functions, see the
|
|
374
167
|
**[auto-generated API documentation on JSR](https://jsr.io/@musodojo/music-theory-data/doc)**.
|
|
168
|
+
|
|
169
|
+
## Community & Support
|
|
170
|
+
|
|
171
|
+
- Ask questions or share ideas in
|
|
172
|
+
[GitHub Discussions](https://github.com/conor-dowdall/music-theory-data/discussions).
|
|
173
|
+
- Report bugs or data issues in
|
|
174
|
+
[GitHub Issues](https://github.com/conor-dowdall/music-theory-data/issues).
|
|
@@ -15,8 +15,11 @@ declare const _chordProgressions: {
|
|
|
15
15
|
readonly twelveBarBlues: ChordProgression;
|
|
16
16
|
readonly twelveBarBluesQuickChange: ChordProgression;
|
|
17
17
|
};
|
|
18
|
+
/** A key for one of the built-in chord progression templates. */
|
|
18
19
|
export type ChordProgressionKey = keyof typeof _chordProgressions;
|
|
20
|
+
/** Built-in chord progression templates keyed by progression id. */
|
|
19
21
|
export declare const chordProgressions: Record<ChordProgressionKey, ChordProgression>;
|
|
22
|
+
/** Built-in chord progression keys grouped by total duration in bars. */
|
|
20
23
|
export declare const chordProgressionBarGroups: readonly ChordProgressionBarGroup<ChordProgressionKey>[];
|
|
21
24
|
export {};
|
|
22
25
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EAEzB,MAAM,gCAAgC,CAAC;AAqJxC,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;CAed,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAElE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CACxD,CAAC;AAiBrB,eAAO,MAAM,yBAAyB,EAAE,SAAS,wBAAwB,CACvE,mBAAmB,CACpB,EAM0C,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EAEzB,MAAM,gCAAgC,CAAC;AAqJxC,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;CAed,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAElE,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CACxD,CAAC;AAiBrB,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,EAAE,SAAS,wBAAwB,CACvE,mBAAmB,CACpB,EAM0C,CAAC"}
|
|
@@ -141,6 +141,7 @@ const _chordProgressions = {
|
|
|
141
141
|
twelveBarBlues,
|
|
142
142
|
twelveBarBluesQuickChange,
|
|
143
143
|
};
|
|
144
|
+
/** Built-in chord progression templates keyed by progression id. */
|
|
144
145
|
export const chordProgressions = _chordProgressions;
|
|
145
146
|
const chordProgressionsByTotalBars = Object.entries(chordProgressions)
|
|
146
147
|
.reduce((groups, [key, progression]) => {
|
|
@@ -154,6 +155,7 @@ const chordProgressionsByTotalBars = Object.entries(chordProgressions)
|
|
|
154
155
|
}
|
|
155
156
|
return groups;
|
|
156
157
|
}, new Map());
|
|
158
|
+
/** Built-in chord progression keys grouped by total duration in bars. */
|
|
157
159
|
export const chordProgressionBarGroups = Array.from(chordProgressionsByTotalBars, ([totalBars, progressionKeys]) => ({
|
|
158
160
|
totalBars,
|
|
159
161
|
progressionKeys,
|
|
@@ -3,15 +3,25 @@ declare const _triadChordQualities: readonly ["M", "m", "°", "+"];
|
|
|
3
3
|
declare const _seventhChordQualities: readonly ["M7", "m7", "7", "ø7", "m7♭5", "°7", "m(M7)", "+M7", "M7♯5"];
|
|
4
4
|
declare const _upperCaseRomanNumerals: readonly ["I", "II", "III", "IV", "V", "VI", "VII"];
|
|
5
5
|
declare const _lowerCaseRomanNumerals: readonly ["i", "ii", "iii", "iv", "v", "vi", "vii"];
|
|
6
|
+
/** A supported triad chord quality suffix. */
|
|
6
7
|
export type Triad = (typeof _triadChordQualities)[number];
|
|
8
|
+
/** A supported seventh-chord quality suffix. */
|
|
7
9
|
export type SeventhChord = (typeof _seventhChordQualities)[number];
|
|
10
|
+
/** Any supported chord quality suffix. */
|
|
8
11
|
export type ChordQuality = Triad | SeventhChord;
|
|
12
|
+
/** An uppercase roman numeral for scale degrees one through seven. */
|
|
9
13
|
export type UpperCaseRomanNumeral = (typeof _upperCaseRomanNumerals)[number];
|
|
14
|
+
/** A lowercase roman numeral for scale degrees one through seven. */
|
|
10
15
|
export type LowerCaseRomanNumeral = (typeof _lowerCaseRomanNumerals)[number];
|
|
16
|
+
/** Any supported roman numeral scale-degree symbol. */
|
|
11
17
|
export type RomanNumeral = UpperCaseRomanNumeral | LowerCaseRomanNumeral;
|
|
18
|
+
/** A roman-numeral triad symbol with an optional triad quality suffix. */
|
|
12
19
|
export type RomanTriad = `${RomanNumeral}` | `${RomanNumeral}${Triad}`;
|
|
20
|
+
/** A roman-numeral seventh-chord symbol with a seventh quality suffix. */
|
|
13
21
|
export type RomanSeventhChord = `${RomanNumeral}${SeventhChord}`;
|
|
22
|
+
/** The letter case used when rendering a roman numeral chord symbol. */
|
|
14
23
|
export type RomanNumeralCase = "upper" | "lower";
|
|
24
|
+
/** Rendering metadata for converting a chord quality into roman notation. */
|
|
15
25
|
export interface ChordQualityRomanRendering {
|
|
16
26
|
readonly numeralCase: RomanNumeralCase;
|
|
17
27
|
readonly suffix: string;
|
|
@@ -22,6 +32,7 @@ export declare const triadChordQualities: readonly Triad[];
|
|
|
22
32
|
export declare const seventhChordQualities: readonly SeventhChord[];
|
|
23
33
|
/** The complete set of supported chord suffix qualities. */
|
|
24
34
|
export declare const chordQualities: readonly ChordQuality[];
|
|
35
|
+
/** Maps each supported chord quality to its matching note-collection key. */
|
|
25
36
|
export type ChordQualityNoteCollectionKeyMap = Record<ChordQuality, NoteCollectionKey>;
|
|
26
37
|
/** Note-collection keys for every supported chord quality. */
|
|
27
38
|
export declare const chordQualityNoteCollectionKeys: ChordQualityNoteCollectionKeyMap;
|
|
@@ -43,6 +54,7 @@ export declare const melodicMinorSeventhChords: SeventhChord[];
|
|
|
43
54
|
export declare const upperCaseRomanNumerals: readonly UpperCaseRomanNumeral[];
|
|
44
55
|
/** An array mapping 7 index scale degrees to their corresponding lower-case Roman numerals. */
|
|
45
56
|
export declare const lowerCaseRomanNumerals: readonly LowerCaseRomanNumeral[];
|
|
57
|
+
/** Returns the note-collection key that describes the notes in a chord quality. */
|
|
46
58
|
export declare function getChordQualityNoteCollectionKey(quality: ChordQuality): NoteCollectionKey;
|
|
47
59
|
export {};
|
|
48
60
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chords/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,QAAA,MAAM,oBAAoB,+BAAgC,CAAC;AAE3D,QAAA,MAAM,sBAAsB,wEAUlB,CAAC;AAEX,QAAA,MAAM,uBAAuB,qDAQnB,CAAC;AAEX,QAAA,MAAM,uBAAuB,qDAQnB,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chords/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,QAAA,MAAM,oBAAoB,+BAAgC,CAAC;AAE3D,QAAA,MAAM,sBAAsB,wEAUlB,CAAC;AAEX,QAAA,MAAM,uBAAuB,qDAQnB,CAAC;AAEX,QAAA,MAAM,uBAAuB,qDAQnB,CAAC;AAEX,8CAA8C;AAC9C,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,0CAA0C;AAC1C,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,YAAY,CAAC;AAEhD,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,qEAAqE;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,qBAAqB,GAAG,qBAAqB,CAAC;AAEzE,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,GAAG,YAAY,EAAE,GAAG,GAAG,YAAY,GAAG,KAAK,EAAE,CAAC;AAEvE,0EAA0E;AAC1E,MAAM,MAAM,iBAAiB,GAAG,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC;AAEjE,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAkBD,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,EAAE,SAAS,KAAK,EAAyB,CAAC;AAE1E,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,EAAE,SAAS,YAAY,EACjC,CAAC;AAEzB,4DAA4D;AAC5D,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAGjD,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,gCAAgC,GAAG,MAAM,CACnD,YAAY,EACZ,iBAAiB,CAClB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,8BAA8B,EAAE,gCACZ,CAAC;AAElC,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,EAAE,WAAW,CACnD,YAAY,EACZ,0BAA0B,CAe1B,CAAC;AAEH,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,KAAK,EAQxB,CAAC;AAEX,uGAAuG;AACvG,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAQtC,CAAC;AAEX,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,EAAE,KAAK,EAQ7B,CAAC;AAEX,uGAAuG;AACvG,eAAO,MAAM,0BAA0B,EAAE,YAAY,EAQ3C,CAAC;AAEX,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,EAAE,KAAK,EAQ5B,CAAC;AAEX,sGAAsG;AACtG,eAAO,MAAM,yBAAyB,EAAE,YAAY,EAQ1C,CAAC;AAEX,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,EAAE,SAAS,qBAAqB,EAC1C,CAAC;AAE1B,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,EAAE,SAAS,qBAAqB,EAC1C,CAAC;AAE1B,mFAAmF;AACnF,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,YAAY,GACpB,iBAAiB,CAEnB"}
|
|
@@ -134,6 +134,7 @@ export const melodicMinorSeventhChords = [
|
|
|
134
134
|
export const upperCaseRomanNumerals = _upperCaseRomanNumerals;
|
|
135
135
|
/** An array mapping 7 index scale degrees to their corresponding lower-case Roman numerals. */
|
|
136
136
|
export const lowerCaseRomanNumerals = _lowerCaseRomanNumerals;
|
|
137
|
+
/** Returns the note-collection key that describes the notes in a chord quality. */
|
|
137
138
|
export function getChordQualityNoteCollectionKey(quality) {
|
|
138
139
|
return chordQualityNoteCollectionKeys[quality];
|
|
139
140
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** The number of pitch classes in 12-tone equal-tempered chromatic space. */
|
|
1
2
|
export declare const CHROMATIC_NOTE_COUNT: 12;
|
|
2
3
|
/** A zero-indexed chromatic pitch-class or relative degree slot. */
|
|
3
4
|
export type ChromaticIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
@@ -18,6 +19,7 @@ export type ChromaticTuple<T> = readonly [
|
|
|
18
19
|
T,
|
|
19
20
|
T
|
|
20
21
|
];
|
|
22
|
+
/** The ordered set of all valid chromatic indexes from C/root through B/7. */
|
|
21
23
|
export declare const CHROMATIC_INDEXES: ChromaticTuple<ChromaticIndex>;
|
|
22
24
|
/** A variable-length set of chromatic indexes, such as the pitch classes in a scale or dyad. */
|
|
23
25
|
export type ChromaticIndexSet = readonly ChromaticIndex[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chromatic.d.ts","sourceRoot":"","sources":["../../../src/src/data/chromatic.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,EAAG,EAAW,CAAC;AAEhD,oEAAoE;AACpE,MAAM,MAAM,cAAc,GACtB,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,CAAC;AAEP,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpD,iFAAiF;AACjF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,SAAS;IACvC,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;CACF,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,cAAc,CAanD,CAAC;AAEX,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAAG,SAAS,cAAc,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"chromatic.d.ts","sourceRoot":"","sources":["../../../src/src/data/chromatic.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,EAAG,EAAW,CAAC;AAEhD,oEAAoE;AACpE,MAAM,MAAM,cAAc,GACtB,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,CAAC;AAEP,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpD,iFAAiF;AACjF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,SAAS;IACvC,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;IACD,CAAC;CACF,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,cAAc,CAanD,CAAC;AAEX,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAAG,SAAS,cAAc,EAAE,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type NoteLabelCollectionKey, type NoteLabelGroup } from "../labels/note-label-collections.js";
|
|
2
2
|
import type { ChromaticMode, ChromaticTuple } from "../chromatic.js";
|
|
3
|
+
/** Whether a note color collection uses absolute pitch classes or root-relative degrees. */
|
|
3
4
|
export type NoteColorMode = ChromaticMode;
|
|
5
|
+
/** A single note color value, or `null` when no semantic color is assigned. */
|
|
4
6
|
export type NoteColorValue = string | null;
|
|
7
|
+
/** A fixed 12-slot color tuple for absolute pitch classes or relative degrees. */
|
|
5
8
|
export type NoteColorTuple = ChromaticTuple<NoteColorValue>;
|
|
9
|
+
/** Metadata and color values for a named 12-slot note color collection. */
|
|
6
10
|
export interface NoteColorCollection {
|
|
7
11
|
readonly name: string;
|
|
8
12
|
readonly shortName?: string;
|
|
@@ -11,16 +15,24 @@ export interface NoteColorCollection {
|
|
|
11
15
|
readonly labelCollectionKey?: NoteLabelCollectionKey;
|
|
12
16
|
readonly colors: NoteColorTuple;
|
|
13
17
|
}
|
|
18
|
+
/** Backwards-compatible alias for a single note color value. */
|
|
14
19
|
export type Color = NoteColorValue;
|
|
20
|
+
/** Backwards-compatible alias for a 12-slot note color tuple. */
|
|
15
21
|
export type ColorGroup = NoteColorTuple;
|
|
22
|
+
/** Backwards-compatible alias for a note color collection. */
|
|
16
23
|
export type ColorCollection = NoteColorCollection;
|
|
24
|
+
/** Default label collection keys for absolute and relative note color modes. */
|
|
17
25
|
export type DefaultNoteColorLabelCollectionKeys = Readonly<Record<NoteColorMode, NoteLabelCollectionKey>> & Readonly<{
|
|
18
26
|
absolute: "noteNamesFlat";
|
|
19
27
|
relative: "intervalsFlat";
|
|
20
28
|
}>;
|
|
29
|
+
/** The default note label collection key used for each note color mode. */
|
|
21
30
|
export declare const defaultNoteColorLabelCollectionKeys: DefaultNoteColorLabelCollectionKeys;
|
|
31
|
+
/** Returns the default label collection key for an absolute or relative color mode. */
|
|
22
32
|
export declare function getDefaultNoteColorLabelCollectionKey(mode: NoteColorMode): NoteLabelCollectionKey;
|
|
33
|
+
/** Returns the explicit or default label collection key for a note color collection. */
|
|
23
34
|
export declare function getNoteColorLabelCollectionKey(collection: NoteColorCollection): NoteLabelCollectionKey;
|
|
35
|
+
/** Returns the 12 labels that should be displayed with a note color collection. */
|
|
24
36
|
export declare function getNoteColorLabels(collection: NoteColorCollection): NoteLabelGroup;
|
|
25
37
|
declare const _colorCollections: {
|
|
26
38
|
readonly musoDojo: {
|
|
@@ -56,7 +68,9 @@ declare const _colorCollections: {
|
|
|
56
68
|
readonly colors: readonly ["#E21C48", "#F26622", "#F99D1C", "#FFCC33", "#FFF32B", "#BCD85F", "#62BC47", "#009C95", "#0071BB", "#5E50A1", "#8D5BA6", "#CF3E96"];
|
|
57
69
|
};
|
|
58
70
|
};
|
|
71
|
+
/** A key for one of the built-in note color collections. */
|
|
59
72
|
export type ColorCollectionKey = keyof typeof _colorCollections;
|
|
73
|
+
/** Built-in absolute and relative note color palettes. */
|
|
60
74
|
export declare const colorCollections: Record<ColorCollectionKey, NoteColorCollection>;
|
|
61
75
|
export {};
|
|
62
76
|
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/colors/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/colors/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,cAAc,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAErE,4FAA4F;AAC5F,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;AAE1C,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,IAAI,CAAC;AAE3C,kFAAkF;AAClF,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE5D,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,gEAAgE;AAChE,MAAM,MAAM,KAAK,GAAG,cAAc,CAAC;AAEnC,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AAExC,8DAA8D;AAC9D,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAElD,gFAAgF;AAChF,MAAM,MAAM,mCAAmC,GAC3C,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,GACvD,QAAQ,CAAC;IACT,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC,CAAC;AAEL,2EAA2E;AAC3E,eAAO,MAAM,mCAAmC,EAC9C,mCAGC,CAAC;AAEJ,uFAAuF;AACvF,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,aAAa,GAClB,sBAAsB,CAExB;AAED,wFAAwF;AACxF,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,mBAAmB,GAC9B,sBAAsB,CAMxB;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,mBAAmB,GAC9B,cAAc,CAGhB;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFb,CAAC;AAEX,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAEhE,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,kBAAkB,EAClB,mBAAmB,CACA,CAAC"}
|