@musodojo/music-theory-data 25.0.0 → 26.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.
Files changed (45) hide show
  1. package/esm/src/utils/chords.d.ts +19 -7
  2. package/esm/src/utils/chords.d.ts.map +1 -1
  3. package/esm/src/utils/chords.js +51 -16
  4. package/esm/src/utils/conversion-registry.d.ts +41 -0
  5. package/esm/src/utils/conversion-registry.d.ts.map +1 -0
  6. package/esm/src/utils/conversion-registry.js +71 -0
  7. package/esm/src/utils/intervals.d.ts +36 -4
  8. package/esm/src/utils/intervals.d.ts.map +1 -1
  9. package/esm/src/utils/intervals.js +62 -1
  10. package/esm/src/utils/mod.d.ts +1 -0
  11. package/esm/src/utils/mod.d.ts.map +1 -1
  12. package/esm/src/utils/mod.js +1 -0
  13. package/esm/src/utils/note-names.d.ts +2 -2
  14. package/esm/src/utils/note-names.d.ts.map +1 -1
  15. package/esm/src/utils/qualities.d.ts +3 -3
  16. package/esm/src/utils/qualities.d.ts.map +1 -1
  17. package/esm/tests/conversion-registry.test.d.ts.map +1 -0
  18. package/esm/tests/intervals.test.d.ts.map +1 -0
  19. package/esm/tests/note-collections.test.d.ts.map +1 -0
  20. package/package.json +1 -1
  21. package/script/src/utils/chords.d.ts +19 -7
  22. package/script/src/utils/chords.d.ts.map +1 -1
  23. package/script/src/utils/chords.js +53 -16
  24. package/script/src/utils/conversion-registry.d.ts +41 -0
  25. package/script/src/utils/conversion-registry.d.ts.map +1 -0
  26. package/script/src/utils/conversion-registry.js +74 -0
  27. package/script/src/utils/intervals.d.ts +36 -4
  28. package/script/src/utils/intervals.d.ts.map +1 -1
  29. package/script/src/utils/intervals.js +64 -0
  30. package/script/src/utils/mod.d.ts +1 -0
  31. package/script/src/utils/mod.d.ts.map +1 -1
  32. package/script/src/utils/mod.js +1 -0
  33. package/script/src/utils/note-names.d.ts +2 -2
  34. package/script/src/utils/note-names.d.ts.map +1 -1
  35. package/script/src/utils/qualities.d.ts +3 -3
  36. package/script/src/utils/qualities.d.ts.map +1 -1
  37. package/script/tests/conversion-registry.test.d.ts.map +1 -0
  38. package/script/tests/intervals.test.d.ts.map +1 -0
  39. package/script/tests/note-collections.test.d.ts.map +1 -0
  40. package/esm/tests/get-intervals-for-note-collection.test.d.ts.map +0 -1
  41. package/esm/tests/search-note-collections.test.d.ts.map +0 -1
  42. package/esm/tests/transform-intervals.test.d.ts.map +0 -1
  43. package/script/tests/get-intervals-for-note-collection.test.d.ts.map +0 -1
  44. package/script/tests/search-note-collections.test.d.ts.map +0 -1
  45. package/script/tests/transform-intervals.test.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { type NoteCollectionKey } from "../data/note-collections/mod.js";
2
2
  import type { RomanSeventhChord, RomanTriad, SeventhChord, Triad } from "../types/chords";
3
- import { type TransformIntervalsOptions } from "./intervals.js";
3
+ import { type NoteCollectionKeyTransformOptions, type RootAndNoteCollectionKeyTransformOptions } from "./intervals.js";
4
4
  import { type RootNote } from "../data/labels/note-labels.js";
5
5
  /**
6
6
  * Converts standard triad qualities (e.g., "M", "m") into their corresponding Roman numeral representations
@@ -21,27 +21,39 @@ export declare function getRomanSeventhChords(sevenths: SeventhChord[]): RomanSe
21
21
  /**
22
22
  * Retrieves the triads for a given note collection key.
23
23
  */
24
- export declare function getTriadsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (Triad | undefined)[];
24
+ export declare function getTriadsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): (Triad | undefined)[];
25
25
  /**
26
26
  * Retrieves the seventh chords for a given note collection key.
27
27
  */
28
- export declare function getSeventhChordsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (SeventhChord | undefined)[];
28
+ export declare function getSeventhChordsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): (SeventhChord | undefined)[];
29
29
  /**
30
30
  * Retrieves the Roman numeral triads for a given note collection key.
31
31
  */
32
- export declare function getRomanTriadsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (RomanTriad | undefined)[];
32
+ export declare function getRomanTriadsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): (RomanTriad | undefined)[];
33
33
  /**
34
34
  * Retrieves the Roman numeral seventh chords for a given note collection key.
35
35
  */
36
- export declare function getRomanSeventhChordsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (RomanSeventhChord | undefined)[];
36
+ export declare function getRomanSeventhChordsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): (RomanSeventhChord | undefined)[];
37
37
  /**
38
38
  * Retrieves the triads with prepended note names for a given root note and note collection key.
39
39
  * Example: ["CM", "Dm", "Em", "FM", "GM", "Am", "B°"]
40
40
  */
41
- export declare function getTriadsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (string | undefined)[];
41
+ export declare function getTriadsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): (string | undefined)[];
42
42
  /**
43
43
  * Retrieves the seventh chords with prepended note names for a given root note and note collection key.
44
44
  * Example: ["CM7", "Dm7", "Em7", "FM7", "G7", "Am7", "Bø7"]
45
45
  */
46
- export declare function getSeventhChordsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): (string | undefined)[];
46
+ export declare function getSeventhChordsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): (string | undefined)[];
47
+ /**
48
+ * Retrieves the Roman numeral triads for a given root note and note collection key.
49
+ * This is particularly useful when options.fillChromatic is true, as it positions the chords
50
+ * at their correct absolute pitch degrees.
51
+ */
52
+ export declare function getRomanTriadsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): (RomanTriad | undefined)[];
53
+ /**
54
+ * Retrieves the Roman numeral seventh chords for a given root note and note collection key.
55
+ * This is particularly useful when options.fillChromatic is true, as it positions the chords
56
+ * at their correct absolute pitch degrees.
57
+ */
58
+ export declare function getRomanSeventhChordsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): (RomanSeventhChord | undefined)[];
47
59
  //# sourceMappingURL=chords.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chords.d.ts","sourceRoot":"","sources":["../../../src/src/utils/chords.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,KAAK,EACN,MAAM,iBAAiB,CAAC;AAkBzB,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,CAgB5D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,YAAY,EAAE,GACvB,iBAAiB,EAAE,CA0BrB;AAoKD;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,kBAAkB,CAAM,GAChE,CAAC,KAAK,GAAG,SAAS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iB,EAAE,iBAAiB,EACpC,OAAO,GAAE,wCAA6C,GACrD,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,CAY5B;AAED;;;;GAIG;AACH,wBAAgB,gDAAgD,CAC9D,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,wCAA6C,GACrD,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,CAYnC"}
@@ -126,22 +126,31 @@ function getModeData(modeKey) {
126
126
  * @template T The underlying chord type extracted automatically from ModeData (e.g., `Triad` or `SeventhChord`).
127
127
  * @template U The final returned array type. If `transformRoman` is provided, this represents the Roman numeral type (e.g., `RomanTriad`). If no transformation is applied, `U` defaults to `T`.
128
128
  */
129
- function getChordsForNoteCollection(noteCollectionKey, options, extractChords, transformRoman) {
129
+ function getChordsForNoteCollectionKey(noteCollectionKey, options, extractChords, transformRoman, rootOptions) {
130
130
  // 1. Verify that the requested note collection exists.
131
131
  const collection = noteCollections[noteCollectionKey];
132
132
  if (!collection)
133
133
  return [];
134
- const { rotateRight, rotateToRootInteger0, rootNoteInteger, fillChromatic } = options;
134
+ const { rotateRight, fillChromatic } = options;
135
+ const { rotateToRootInteger0, rootNoteInteger } = rootOptions ?? {};
135
136
  // Helper function to apply requested rotations after the chord array is cleanly generated.
136
- const applyRotations = (chordsArray) => {
137
+ const applyRotations = (chordsArray, isChromatic) => {
137
138
  let result = chordsArray;
138
139
  // If fillChromatic is true, the array represents the 12 absolute semitones (where index 0 = the root note relative to itself).
139
- if (fillChromatic) {
140
+ if (isChromatic) {
140
141
  if (rotateToRootInteger0 && rootNoteInteger !== undefined) {
141
142
  // Shift the array so that the absolute root note (rootNoteInteger) sits at index 0.
142
143
  result = rotateArrayRight(result, rootNoteInteger);
143
144
  }
144
145
  }
146
+ else {
147
+ // NOTE: When fillChromatic is false, rotateToRootInteger0 doesn't make geometric sense
148
+ // because the array isn't guaranteed to be 12 elements. But if the user explicitly provided it
149
+ // we should simply shift the array elements by `rootNoteInteger` positions to satisfy the API.
150
+ if (rotateToRootInteger0 && rootNoteInteger !== undefined) {
151
+ result = rotateArrayRight(result, rootNoteInteger);
152
+ }
153
+ }
145
154
  // Apply any explicit arbitrary rightward rotations requested by the user.
146
155
  if (rotateRight !== undefined) {
147
156
  result = rotateArrayRight(result, rotateRight);
@@ -160,10 +169,10 @@ function getChordsForNoteCollection(noteCollectionKey, options, extractChords, t
160
169
  : rotatedChords;
161
170
  // 2c. If requested, map the sequential chord list into a 12-semitone chromatic sparse array.
162
171
  if (fillChromatic) {
163
- return applyRotations(getChromaticArray(processedChords, data.intervals));
172
+ return applyRotations(getChromaticArray(processedChords, data.intervals), true);
164
173
  }
165
174
  // 2d. Otherwise, return the sequentially packed list.
166
- return applyRotations(processedChords);
175
+ return applyRotations(processedChords, false);
167
176
  }
168
177
  // 3. If the collection is NOT a primary mode (e.g., a custom scale like Minor Pentatonic),
169
178
  // we cannot look up predefined chords. Instead, we fall back to its "most Similar Scale".
@@ -186,33 +195,33 @@ function getChordsForNoteCollection(noteCollectionKey, options, extractChords, t
186
195
  .filter((chord) => chord !== undefined);
187
196
  // 3c. Format and return just like step 2.
188
197
  if (fillChromatic) {
189
- return applyRotations(getChromaticArray(collectionChords, collection.intervals));
198
+ return applyRotations(getChromaticArray(collectionChords, collection.intervals), true);
190
199
  }
191
- return applyRotations(collectionChords);
200
+ return applyRotations(collectionChords, false);
192
201
  }
193
202
  /**
194
203
  * Retrieves the triads for a given note collection key.
195
204
  */
196
205
  export function getTriadsForNoteCollectionKey(noteCollectionKey, options = {}) {
197
- return getChordsForNoteCollection(noteCollectionKey, options, (data) => data.triads);
206
+ return getChordsForNoteCollectionKey(noteCollectionKey, options, (data) => data.triads);
198
207
  }
199
208
  /**
200
209
  * Retrieves the seventh chords for a given note collection key.
201
210
  */
202
211
  export function getSeventhChordsForNoteCollectionKey(noteCollectionKey, options = {}) {
203
- return getChordsForNoteCollection(noteCollectionKey, options, (data) => data.sevenths);
212
+ return getChordsForNoteCollectionKey(noteCollectionKey, options, (data) => data.sevenths);
204
213
  }
205
214
  /**
206
215
  * Retrieves the Roman numeral triads for a given note collection key.
207
216
  */
208
217
  export function getRomanTriadsForNoteCollectionKey(noteCollectionKey, options = {}) {
209
- return getChordsForNoteCollection(noteCollectionKey, options, (data) => data.triads, getRomanTriads);
218
+ return getChordsForNoteCollectionKey(noteCollectionKey, options, (data) => data.triads, getRomanTriads);
210
219
  }
211
220
  /**
212
221
  * Retrieves the Roman numeral seventh chords for a given note collection key.
213
222
  */
214
223
  export function getRomanSeventhChordsForNoteCollectionKey(noteCollectionKey, options = {}) {
215
- return getChordsForNoteCollection(noteCollectionKey, options, (data) => data.sevenths, getRomanSeventhChords);
224
+ return getChordsForNoteCollectionKey(noteCollectionKey, options, (data) => data.sevenths, getRomanSeventhChords);
216
225
  }
217
226
  /**
218
227
  * Retrieves the triads with prepended note names for a given root note and note collection key.
@@ -220,9 +229,10 @@ export function getRomanSeventhChordsForNoteCollectionKey(noteCollectionKey, opt
220
229
  */
221
230
  export function getTriadsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
222
231
  const noteNames = getNoteNamesForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options);
223
- const chords = getTriadsForNoteCollectionKey(noteCollectionKey, {
224
- ...options,
232
+ const { rotateToRootInteger0, ...restOptions } = options;
233
+ const chords = getChordsForNoteCollectionKey(noteCollectionKey, restOptions, (data) => data.triads, undefined, {
225
234
  rootNoteInteger: noteNameToIntegerMap.get(rootNote),
235
+ rotateToRootInteger0,
226
236
  });
227
237
  return chords.map((chord, i) => {
228
238
  if (chord === undefined)
@@ -236,9 +246,10 @@ export function getTriadsForRootAndNoteCollectionKey(rootNote, noteCollectionKey
236
246
  */
237
247
  export function getSeventhChordsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
238
248
  const noteNames = getNoteNamesForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options);
239
- const chords = getSeventhChordsForNoteCollectionKey(noteCollectionKey, {
240
- ...options,
249
+ const { rotateToRootInteger0, ...restOptions } = options;
250
+ const chords = getChordsForNoteCollectionKey(noteCollectionKey, restOptions, (data) => data.sevenths, undefined, {
241
251
  rootNoteInteger: noteNameToIntegerMap.get(rootNote),
252
+ rotateToRootInteger0,
242
253
  });
243
254
  return chords.map((chord, i) => {
244
255
  if (chord === undefined)
@@ -246,3 +257,27 @@ export function getSeventhChordsForRootAndNoteCollectionKey(rootNote, noteCollec
246
257
  return noteNames[i] + chord;
247
258
  });
248
259
  }
260
+ /**
261
+ * Retrieves the Roman numeral triads for a given root note and note collection key.
262
+ * This is particularly useful when options.fillChromatic is true, as it positions the chords
263
+ * at their correct absolute pitch degrees.
264
+ */
265
+ export function getRomanTriadsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
266
+ const { rotateToRootInteger0, ...restOptions } = options;
267
+ return getChordsForNoteCollectionKey(noteCollectionKey, restOptions, (data) => data.triads, getRomanTriads, {
268
+ rootNoteInteger: noteNameToIntegerMap.get(rootNote),
269
+ rotateToRootInteger0,
270
+ });
271
+ }
272
+ /**
273
+ * Retrieves the Roman numeral seventh chords for a given root note and note collection key.
274
+ * This is particularly useful when options.fillChromatic is true, as it positions the chords
275
+ * at their correct absolute pitch degrees.
276
+ */
277
+ export function getRomanSeventhChordsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
278
+ const { rotateToRootInteger0, ...restOptions } = options;
279
+ return getChordsForNoteCollectionKey(noteCollectionKey, restOptions, (data) => data.sevenths, getRomanSeventhChords, {
280
+ rootNoteInteger: noteNameToIntegerMap.get(rootNote),
281
+ rotateToRootInteger0,
282
+ });
283
+ }
@@ -0,0 +1,41 @@
1
+ import type { RootNote } from "../data/labels/note-labels.js";
2
+ import type { NoteCollectionKey } from "../data/note-collections/mod.js";
3
+ import type { Interval } from "../data/labels/note-labels.js";
4
+ import type { RomanSeventhChord, RomanTriad } from "../types/chords";
5
+ import type { NoteName } from "../data/labels/note-labels.js";
6
+ /**
7
+ * Options specifically tailored for robust Conversion Registry UI usage.
8
+ * Requires `fillChromatic: true` and `rotateToRootInteger0: true` to ensure
9
+ * all returned arrays are 12 elements long and uniformly anchored to C=0,
10
+ * making them easy to align in a UI like a fretboard.
11
+ */
12
+ export interface ConversionRegistryOptions {
13
+ fillChromatic: true;
14
+ rotateToRootInteger0: true;
15
+ rotateRight?: number;
16
+ }
17
+ /**
18
+ * A generic function signature for all registry entries.
19
+ */
20
+ export type ConversionFunction<T> = (rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options: ConversionRegistryOptions) => (T | undefined)[];
21
+ export interface ConversionRegistryEntry<T> {
22
+ id: string;
23
+ name: string;
24
+ shortName: string;
25
+ description: string;
26
+ example: string;
27
+ get: ConversionFunction<T>;
28
+ }
29
+ export declare const conversions: {
30
+ rootAndNoteCollection: {
31
+ noteNames: ConversionRegistryEntry<NoteName | string>;
32
+ intervals: ConversionRegistryEntry<Interval>;
33
+ extensions: ConversionRegistryEntry<Interval>;
34
+ compoundIntervals: ConversionRegistryEntry<Interval>;
35
+ triads: ConversionRegistryEntry<string>;
36
+ seventhChords: ConversionRegistryEntry<string>;
37
+ romanTriads: ConversionRegistryEntry<RomanTriad>;
38
+ romanSeventhChords: ConversionRegistryEntry<RomanSeventhChord>;
39
+ };
40
+ };
41
+ //# sourceMappingURL=conversion-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-registry.d.ts","sourceRoot":"","sources":["../../../src/src/utils/conversion-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAc9D;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,IAAI,CAAC;IACpB,oBAAoB,EAAE,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAClC,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,yBAAyB,KAC/B,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;AAEvB,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW;;mBAWf,uBAAuB,CAAC,QAAQ,GAAG,MAAM,CAAC;mBAU1C,uBAAuB,CAAC,QAAQ,CAAC;oBAUjC,uBAAuB,CAAC,QAAQ,CAAC;2BAUjC,uBAAuB,CAAC,QAAQ,CAAC;gBAUjC,uBAAuB,CAAC,MAAM,CAAC;uBAU/B,uBAAuB,CAAC,MAAM,CAAC;qBAU/B,uBAAuB,CAAC,UAAU,CAAC;4BAUnC,uBAAuB,CAAC,iBAAiB,CAAC;;CAElD,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { getNoteNamesForRootAndNoteCollectionKey } from "./note-names.js";
2
+ import { getCompoundIntervalsForRootAndNoteCollectionKey, getExtensionsForRootAndNoteCollectionKey, getIntervalsForRootAndNoteCollectionKey, } from "./intervals.js";
3
+ import { getRomanSeventhChordsForRootAndNoteCollectionKey, getRomanTriadsForRootAndNoteCollectionKey, getSeventhChordsForRootAndNoteCollectionKey, getTriadsForRootAndNoteCollectionKey, } from "./chords.js";
4
+ export const conversions = {
5
+ rootAndNoteCollection: {
6
+ noteNames: {
7
+ id: "note-names",
8
+ name: "Note Names",
9
+ shortName: "Notes",
10
+ description: "Returns the specific note names (e.g., 'C', 'E♭', 'G') for the root and collection.",
11
+ example: "C, E♭, G",
12
+ get: (root, key, opts) => getNoteNamesForRootAndNoteCollectionKey(root, key, opts),
13
+ },
14
+ intervals: {
15
+ id: "intervals",
16
+ name: "Intervals",
17
+ shortName: "Intervals",
18
+ description: "Returns the relative intervals (e.g., '1', '♭3', '5') for the collection.",
19
+ example: "1, ♭3, 5",
20
+ get: (root, key, opts) => getIntervalsForRootAndNoteCollectionKey(root, key, opts),
21
+ },
22
+ extensions: {
23
+ id: "extensions",
24
+ name: "Extensions",
25
+ shortName: "Extensions",
26
+ description: "Returns intervals with simple intervals converted to extensions where applicable (e.g., '2' becomes '9').",
27
+ example: "9, ♯11, ♭13",
28
+ get: (root, key, opts) => getExtensionsForRootAndNoteCollectionKey(root, key, opts),
29
+ },
30
+ compoundIntervals: {
31
+ id: "compound-intervals",
32
+ name: "Compound Intervals",
33
+ shortName: "Compound",
34
+ description: "Returns intervals converted to their compound equivalents (e.g., '3' becomes '10').",
35
+ example: "10, 12, 14",
36
+ get: (root, key, opts) => getCompoundIntervalsForRootAndNoteCollectionKey(root, key, opts),
37
+ },
38
+ triads: {
39
+ id: "triads",
40
+ name: "Triads",
41
+ shortName: "Triads",
42
+ description: "Returns the triads with prepended note names (e.g., 'Cm', 'E♭M', 'GM').",
43
+ example: "Cm, E♭M, GM",
44
+ get: (root, key, opts) => getTriadsForRootAndNoteCollectionKey(root, key, opts),
45
+ },
46
+ seventhChords: {
47
+ id: "seventh-chords",
48
+ name: "Seventh Chords",
49
+ shortName: "Sevenths",
50
+ description: "Returns the seventh chords with prepended note names (e.g., 'Cm7', 'E♭M7', 'GM7').",
51
+ example: "Cm7, E♭M7, GM7",
52
+ get: (root, key, opts) => getSeventhChordsForRootAndNoteCollectionKey(root, key, opts),
53
+ },
54
+ romanTriads: {
55
+ id: "roman-triads",
56
+ name: "Roman Numeral Triads",
57
+ shortName: "Roman Triads",
58
+ description: "Returns the Roman numeral representation of the triads (e.g., 'I', 'ii', 'iii').",
59
+ example: "I, ii, iii",
60
+ get: (root, key, opts) => getRomanTriadsForRootAndNoteCollectionKey(root, key, opts),
61
+ },
62
+ romanSeventhChords: {
63
+ id: "roman-seventh-chords",
64
+ name: "Roman Numeral Seventh Chords",
65
+ shortName: "Roman Sevenths",
66
+ description: "Returns the Roman numeral representation of the seventh chords (e.g., 'I7', 'ii7', 'iii7').",
67
+ example: "I7, ii7, iii7",
68
+ get: (root, key, opts) => getRomanSeventhChordsForRootAndNoteCollectionKey(root, key, opts),
69
+ },
70
+ },
71
+ };
@@ -1,4 +1,4 @@
1
- import { type CompoundInterval, type Interval, type IntervalQuality, type SimpleInterval } from "../data/labels/note-labels.js";
1
+ import { type CompoundInterval, type Interval, type IntervalQuality, type RootNote, type SimpleInterval } from "../data/labels/note-labels.js";
2
2
  import { type NoteCollectionKey } from "../data/note-collections/mod.js";
3
3
  /**
4
4
  * Removes octave intervals (such as "8" or "♮8") from a given list of intervals.
@@ -110,6 +110,8 @@ export type TransformIntervalsOptions = {
110
110
  rootNoteInteger?: never;
111
111
  rotateToRootInteger0?: never;
112
112
  });
113
+ export type NoteCollectionKeyTransformOptions = Pick<TransformIntervalsOptions, "intervalTransformation" | "filterOutOctave" | "shouldSort" | "rotateRight" | "fillChromatic">;
114
+ export type RootAndNoteCollectionKeyTransformOptions = Pick<TransformIntervalsOptions, "intervalTransformation" | "filterOutOctave" | "shouldSort" | "rotateRight" | "fillChromatic" | "rootNoteInteger" | "rotateToRootInteger0">;
113
115
  export declare function transformIntervals(intervals: readonly Interval[], options?: TransformIntervalsOptions): Interval[];
114
116
  /**
115
117
  * Retrieves the base intervals associated with a given set of interval qualities.
@@ -126,7 +128,7 @@ export declare function getIntervalsForQualities(qualities: readonly IntervalQua
126
128
  * @param options Optional parameter for interval transformations.
127
129
  * @returns An array of intervals.
128
130
  */
129
- export declare function getIntervalsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale" | "rootNoteInteger" | "rotateToRootInteger0">): Interval[];
131
+ export declare function getIntervalsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): Interval[];
130
132
  /**
131
133
  * Retrieves an array of extended intervals for a given note collection key.
132
134
  * All simple intervals are transformed to their extension equivalents where applicable (e.g. 2 -> 9).
@@ -135,7 +137,7 @@ export declare function getIntervalsForNoteCollectionKey(noteCollectionKey: Note
135
137
  * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
136
138
  * @returns An array of extended intervals.
137
139
  */
138
- export declare function getExtensionsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale" | "rootNoteInteger" | "rotateToRootInteger0" | "intervalTransformation">): Interval[];
140
+ export declare function getExtensionsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<NoteCollectionKeyTransformOptions, "intervalTransformation">): Interval[];
139
141
  /**
140
142
  * Retrieves an array of compound intervals for a given note collection key.
141
143
  * All simple intervals are transformed to their compound equivalents where applicable (e.g. 2 -> 9, 3 -> 10).
@@ -144,5 +146,35 @@ export declare function getExtensionsForNoteCollectionKey(noteCollectionKey: Not
144
146
  * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
145
147
  * @returns An array of compound intervals.
146
148
  */
147
- export declare function getCompoundIntervalsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale" | "rootNoteInteger" | "rotateToRootInteger0" | "intervalTransformation">): Interval[];
149
+ export declare function getCompoundIntervalsForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<NoteCollectionKeyTransformOptions, "intervalTransformation">): Interval[];
150
+ /**
151
+ * Retrieves an array of intervals for a given root note and note collection key.
152
+ * Can optionally fill chromatically.
153
+ *
154
+ * @param rootNote The root note to base the intervals on.
155
+ * @param noteCollectionKey The key representing the note collection.
156
+ * @param options Optional parameter for interval transformations.
157
+ * @returns An array of intervals.
158
+ */
159
+ export declare function getIntervalsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): Interval[];
160
+ /**
161
+ * Retrieves an array of extended intervals for a given root note and note collection key.
162
+ * All simple intervals are transformed to their extension equivalents where applicable (e.g. 2 -> 9).
163
+ *
164
+ * @param rootNote The root note to base the intervals on.
165
+ * @param noteCollectionKey The key representing the note collection.
166
+ * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
167
+ * @returns An array of extended intervals.
168
+ */
169
+ export declare function getExtensionsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: Omit<RootAndNoteCollectionKeyTransformOptions, "intervalTransformation">): Interval[];
170
+ /**
171
+ * Retrieves an array of compound intervals for a given root note and note collection key.
172
+ * All simple intervals are transformed to their compound equivalents where applicable (e.g. 2 -> 9, 3 -> 10).
173
+ *
174
+ * @param rootNote The root note to base the intervals on.
175
+ * @param noteCollectionKey The key representing the note collection.
176
+ * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
177
+ * @returns An array of compound intervals.
178
+ */
179
+ export declare function getCompoundIntervalsForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: Omit<RootAndNoteCollectionKeyTransformOptions, "intervalTransformation">): Interval[];
148
180
  //# sourceMappingURL=intervals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intervals.d.ts","sourceRoot":"","sources":["../../../src/src/utils/intervals.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EAGrB,KAAK,QAAQ,EACb,KAAK,eAAe,EAGpB,KAAK,cAAc,EAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,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AiB,EACpC,OAAO,GAAE,iCAAsC,GAC9C,QAAQ,EAAE,CAiBZ;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAC/C,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CACX,iCAAiC,EACjC,wBAAwB,CACpB,GACL,QAAQ,EAAE,CAMZ;AAED;;;;;;;GAOG;AACH,wBAAgB,wCAAwC,CACtD,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CACX,iCAAiC,EACjC,wBAAwB,CACpB,GACL,QAAQ,EAAE,CAMZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,wCAA6C,GACrD,QAAQ,EAAE,CAqBZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CACX,wCAAwC,EACxC,wBAAwB,CACpB,GACL,QAAQ,EAAE,CAMZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,+CAA+C,CAC7D,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CACX,wCAAwC,EACxC,wBAAwB,CACpB,GACL,QAAQ,EAAE,CAMZ"}
@@ -1,4 +1,4 @@
1
- import { compoundToSimpleIntervalMap, extensionToSimpleIntervalMap, intervalQualityToIntervalMap, intervalToIntegerMap, simpleToCompoundIntervalMap, simpleToExtensionIntervalMap, } from "../data/labels/note-labels.js";
1
+ import { compoundToSimpleIntervalMap, extensionToSimpleIntervalMap, intervalQualityToIntervalMap, intervalToIntegerMap, noteNameToIntegerMap, simpleToCompoundIntervalMap, simpleToExtensionIntervalMap, } from "../data/labels/note-labels.js";
2
2
  import { noteCollections, } from "../data/note-collections/mod.js";
3
3
  import { noteLabelCollections } from "../data/labels/note-label-collections.js";
4
4
  import { rotateArrayRight } from "./rotate-array.js";
@@ -273,3 +273,64 @@ export function getCompoundIntervalsForNoteCollectionKey(noteCollectionKey, opti
273
273
  intervalTransformation: "simpleToCompound",
274
274
  });
275
275
  }
276
+ /**
277
+ * Retrieves an array of intervals for a given root note and note collection key.
278
+ * Can optionally fill chromatically.
279
+ *
280
+ * @param rootNote The root note to base the intervals on.
281
+ * @param noteCollectionKey The key representing the note collection.
282
+ * @param options Optional parameter for interval transformations.
283
+ * @returns An array of intervals.
284
+ */
285
+ export function getIntervalsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
286
+ if (!isValidNoteCollectionKey(noteCollectionKey))
287
+ return [];
288
+ const collection = noteCollections[noteCollectionKey];
289
+ const mostSimilarScale = collection.mostSimilarScale;
290
+ const finalOptions = options.fillChromatic &&
291
+ mostSimilarScale &&
292
+ mostSimilarScale !== noteCollectionKey
293
+ ? {
294
+ ...options,
295
+ fillChromatic: true,
296
+ mostSimilarScale: mostSimilarScale,
297
+ rootNoteInteger: noteNameToIntegerMap.get(rootNote),
298
+ }
299
+ : {
300
+ ...options,
301
+ rootNoteInteger: noteNameToIntegerMap.get(rootNote),
302
+ };
303
+ return transformIntervals(collection.intervals, finalOptions);
304
+ }
305
+ /**
306
+ * Retrieves an array of extended intervals for a given root note and note collection key.
307
+ * All simple intervals are transformed to their extension equivalents where applicable (e.g. 2 -> 9).
308
+ *
309
+ * @param rootNote The root note to base the intervals on.
310
+ * @param noteCollectionKey The key representing the note collection.
311
+ * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
312
+ * @returns An array of extended intervals.
313
+ */
314
+ export function getExtensionsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
315
+ return getIntervalsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, {
316
+ filterOutOctave: true,
317
+ ...options,
318
+ intervalTransformation: "simpleToExtension",
319
+ });
320
+ }
321
+ /**
322
+ * Retrieves an array of compound intervals for a given root note and note collection key.
323
+ * All simple intervals are transformed to their compound equivalents where applicable (e.g. 2 -> 9, 3 -> 10).
324
+ *
325
+ * @param rootNote The root note to base the intervals on.
326
+ * @param noteCollectionKey The key representing the note collection.
327
+ * @param options Optional parameter for interval transformations (intervalTransformation is overridden).
328
+ * @returns An array of compound intervals.
329
+ */
330
+ export function getCompoundIntervalsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, options = {}) {
331
+ return getIntervalsForRootAndNoteCollectionKey(rootNote, noteCollectionKey, {
332
+ filterOutOctave: true,
333
+ ...options,
334
+ intervalTransformation: "simpleToCompound",
335
+ });
336
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./colors.js";
2
2
  export * from "./chords.js";
3
+ export * from "./conversion-registry.js";
3
4
  export * from "./intervals.js";
4
5
  export * from "./midi-note-sequences.js";
5
6
  export * from "./midi.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/utils/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/utils/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./colors.js";
2
2
  export * from "./chords.js";
3
+ export * from "./conversion-registry.js";
3
4
  export * from "./intervals.js";
4
5
  export * from "./midi-note-sequences.js";
5
6
  export * from "./midi.js";
@@ -1,6 +1,6 @@
1
1
  import { type Interval, type NoteName, type RootNote, type RootNoteInteger } from "../data/labels/note-labels.js";
2
2
  import { type NoteCollectionKey } from "../data/note-collections/mod.js";
3
- import { type TransformIntervalsOptions } from "./intervals.js";
3
+ import { type RootAndNoteCollectionKeyTransformOptions, type TransformIntervalsOptions } from "./intervals.js";
4
4
  /**
5
5
  * Parses a string and returns a canonical `NoteName` if the string is a valid note name.
6
6
  * This is useful for handling user input that may use ASCII characters like 'b' and '#',
@@ -58,5 +58,5 @@ export declare function getNoteNamesForRootAndIntervals(rootNote: RootNote, inte
58
58
  * @param options Optional settings for interval transformations or output formatting.
59
59
  * @returns An array of computed note names.
60
60
  */
61
- export declare function getNoteNamesForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): NoteName[];
61
+ export declare function getNoteNamesForRootAndNoteCollectionKey(rootNote: RootNote, noteCollectionKey: NoteCollectionKey, options?: RootAndNoteCollectionKeyTransformOptions): NoteName[];
62
62
  //# sourceMappingURL=note-names.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"note-names.d.ts","sourceRoot":"","sources":["../../../src/src/utils/note-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAIb,KAAK,QAAQ,EAGb,KAAK,QAAQ,EACb,KAAK,eAAe,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAQxB;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA2B1E;AAED;;;;;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,GACvB,QAAQ,EAAE,CAIZ;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAQ1E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,QAAQ,EAAE,CAIZ;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,GACf,eAAe,GAAG,SAAS,CAI7B;AA4CD;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,OAAO,GAAE,yBAA8B,GACtC,QAAQ,EAAE,CA+BZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,wCAA6C,GACrD,QAAQ,EAAE,CAqBZ"}
@@ -1,7 +1,7 @@
1
1
  import { type Interval, type IntervalQuality } from "../data/labels/note-labels.js";
2
2
  import { type NoteCollectionKey } from "../data/note-collections/mod.js";
3
3
  import type { NoteCollection } from "../types/note-collections";
4
- import { type TransformIntervalsOptions } from "./intervals.js";
4
+ import { type NoteCollectionKeyTransformOptions, type TransformIntervalsOptions } from "./intervals.js";
5
5
  /**
6
6
  * Calculates an array of specific interval qualities given an array of intervals.
7
7
  * Supports filling chromatic passing notes and other transformations via options.
@@ -19,7 +19,7 @@ export declare function getQualitiesForIntervals(intervals: readonly Interval[],
19
19
  * @param options Optional settings for interval transformations or output formatting.
20
20
  * @returns An array of computed interval qualities.
21
21
  */
22
- export declare function getQualitiesForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): IntervalQuality[];
22
+ export declare function getQualitiesForNoteCollectionKey(noteCollectionKey: NoteCollectionKey, options?: NoteCollectionKeyTransformOptions): IntervalQuality[];
23
23
  /**
24
24
  * Extracts the interval qualities (e.g., "P1", "M2", "m3") from a NoteCollection.
25
25
  * Automatically inherits contextual hint data (like `mostSimilarScale`) from the collection.
@@ -27,5 +27,5 @@ export declare function getQualitiesForNoteCollectionKey(noteCollectionKey: Note
27
27
  * @param options Optional settings for interval transformations or output formatting.
28
28
  * @returns An array of IntervalQuality strings.
29
29
  */
30
- export declare function getQualitiesForNoteCollection(collection: NoteCollection, options?: Omit<TransformIntervalsOptions, "mostSimilarScale">): IntervalQuality[];
30
+ export declare function getQualitiesForNoteCollection(collection: NoteCollection, options?: NoteCollectionKeyTransformOptions): IntervalQuality[];
31
31
  //# sourceMappingURL=qualities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qualities.d.ts","sourceRoot":"","sources":["../../../src/src/utils/qualities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,OAAO,GAAE,yBAA8B,GACtC,eAAe,EAAE,CASnB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,kBAAkB,CAAM,GAChE,eAAe,EAAE,CAKnB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,kBAAkB,CAAM,GAChE,eAAe,EAAE,CAanB"}
1
+ {"version":3,"file":"qualities.d.ts","sourceRoot":"","sources":["../../../src/src/utils/qualities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EAErB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,iCAAiC,EAEtC,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,OAAO,GAAE,yBAA8B,GACtC,eAAe,EAAE,CASnB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,iCAAsC,GAC9C,eAAe,EAAE,CAKnB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,cAAc,EAC1B,OAAO,GAAE,iCAAsC,GAC9C,eAAe,EAAE,CAanB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-registry.test.d.ts","sourceRoot":"","sources":["../../src/tests/conversion-registry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intervals.test.d.ts","sourceRoot":"","sources":["../../src/tests/intervals.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note-collections.test.d.ts","sourceRoot":"","sources":["../../src/tests/note-collections.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musodojo/music-theory-data",
3
- "version": "25.0.0",
3
+ "version": "26.1.0",
4
4
  "description": "The musician-friendly TypeScript library for scales, modes, chords, and arpeggios.",
5
5
  "keywords": [
6
6
  "music",