@musodojo/music-theory-data 31.1.0 → 33.0.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 (95) hide show
  1. package/README.md +58 -7
  2. package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/build_message.d.ts.map +1 -1
  3. package/{script/deps/jsr.io/@std/internal/1.0.13 → esm/deps/jsr.io/@std/internal/1.0.14}/diff.d.ts.map +1 -1
  4. package/{script/deps/jsr.io/@std/internal/1.0.13 → esm/deps/jsr.io/@std/internal/1.0.14}/diff_str.d.ts.map +1 -1
  5. package/{script/deps/jsr.io/@std/internal/1.0.13 → esm/deps/jsr.io/@std/internal/1.0.14}/format.d.ts.map +1 -1
  6. package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/styles.d.ts.map +1 -1
  7. package/esm/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/types.d.ts.map +1 -1
  8. package/esm/src/data/chord-progressions/mod.d.ts +28 -16
  9. package/esm/src/data/chord-progressions/mod.d.ts.map +1 -1
  10. package/esm/src/data/chord-progressions/mod.js +180 -65
  11. package/esm/src/data/chords/mod.d.ts +26 -1
  12. package/esm/src/data/chords/mod.d.ts.map +1 -1
  13. package/esm/src/data/chords/mod.js +70 -1
  14. package/esm/src/data/labels/mod.d.ts +1 -0
  15. package/esm/src/data/labels/mod.d.ts.map +1 -1
  16. package/esm/src/data/labels/mod.js +1 -0
  17. package/esm/src/data/labels/note-label-collections.d.ts +1 -25
  18. package/esm/src/data/labels/note-label-collections.d.ts.map +1 -1
  19. package/esm/src/data/labels/note-label-collections.js +1 -77
  20. package/esm/src/data/labels/note-labels.d.ts +1 -1
  21. package/esm/src/data/labels/note-labels.d.ts.map +1 -1
  22. package/esm/src/data/labels/solfege.d.ts +33 -0
  23. package/esm/src/data/labels/solfege.d.ts.map +1 -0
  24. package/esm/src/data/labels/solfege.js +165 -0
  25. package/esm/src/data/note-collections/augmented-variants.d.ts.map +1 -1
  26. package/esm/src/data/note-collections/augmented-variants.js +3 -2
  27. package/esm/src/data/note-collections/mod.d.ts +15 -0
  28. package/esm/src/data/note-collections/mod.d.ts.map +1 -1
  29. package/esm/src/data/note-collections/mod.js +2 -2
  30. package/esm/src/utils/chord-progressions.d.ts +22 -5
  31. package/esm/src/utils/chord-progressions.d.ts.map +1 -1
  32. package/esm/src/utils/chord-progressions.js +70 -7
  33. package/esm/src/utils/chords.d.ts +7 -1
  34. package/esm/src/utils/chords.d.ts.map +1 -1
  35. package/esm/src/utils/chords.js +18 -1
  36. package/esm/src/utils/conversion-registry.d.ts +40 -20
  37. package/esm/src/utils/conversion-registry.d.ts.map +1 -1
  38. package/esm/src/utils/conversion-registry.js +95 -25
  39. package/esm/src/utils/intervals.d.ts +3 -0
  40. package/esm/src/utils/intervals.d.ts.map +1 -1
  41. package/esm/src/utils/intervals.js +23 -0
  42. package/esm/src/utils/midi.d.ts +7 -0
  43. package/esm/src/utils/midi.d.ts.map +1 -1
  44. package/esm/src/utils/midi.js +16 -0
  45. package/esm/src/utils/note-collections.d.ts +9 -1
  46. package/esm/src/utils/note-collections.d.ts.map +1 -1
  47. package/esm/src/utils/note-collections.js +22 -0
  48. package/esm/tests/solfege.test.d.ts.map +1 -0
  49. package/package.json +1 -1
  50. package/script/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/build_message.d.ts.map +1 -1
  51. package/{esm/deps/jsr.io/@std/internal/1.0.13 → script/deps/jsr.io/@std/internal/1.0.14}/diff.d.ts.map +1 -1
  52. package/{esm/deps/jsr.io/@std/internal/1.0.13 → script/deps/jsr.io/@std/internal/1.0.14}/diff_str.d.ts.map +1 -1
  53. package/{esm/deps/jsr.io/@std/internal/1.0.13 → script/deps/jsr.io/@std/internal/1.0.14}/format.d.ts.map +1 -1
  54. package/script/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/styles.d.ts.map +1 -1
  55. package/script/deps/jsr.io/@std/internal/{1.0.13 → 1.0.14}/types.d.ts.map +1 -1
  56. package/script/src/data/chord-progressions/mod.d.ts +28 -16
  57. package/script/src/data/chord-progressions/mod.d.ts.map +1 -1
  58. package/script/src/data/chord-progressions/mod.js +181 -66
  59. package/script/src/data/chords/mod.d.ts +26 -1
  60. package/script/src/data/chords/mod.d.ts.map +1 -1
  61. package/script/src/data/chords/mod.js +75 -2
  62. package/script/src/data/labels/mod.d.ts +1 -0
  63. package/script/src/data/labels/mod.d.ts.map +1 -1
  64. package/script/src/data/labels/mod.js +1 -0
  65. package/script/src/data/labels/note-label-collections.d.ts +1 -25
  66. package/script/src/data/labels/note-label-collections.d.ts.map +1 -1
  67. package/script/src/data/labels/note-label-collections.js +1 -77
  68. package/script/src/data/labels/note-labels.d.ts +1 -1
  69. package/script/src/data/labels/note-labels.d.ts.map +1 -1
  70. package/script/src/data/labels/solfege.d.ts +33 -0
  71. package/script/src/data/labels/solfege.d.ts.map +1 -0
  72. package/script/src/data/labels/solfege.js +173 -0
  73. package/script/src/data/note-collections/augmented-variants.d.ts.map +1 -1
  74. package/script/src/data/note-collections/augmented-variants.js +3 -2
  75. package/script/src/data/note-collections/mod.d.ts +15 -0
  76. package/script/src/data/note-collections/mod.d.ts.map +1 -1
  77. package/script/src/utils/chord-progressions.d.ts +22 -5
  78. package/script/src/utils/chord-progressions.d.ts.map +1 -1
  79. package/script/src/utils/chord-progressions.js +72 -5
  80. package/script/src/utils/chords.d.ts +7 -1
  81. package/script/src/utils/chords.d.ts.map +1 -1
  82. package/script/src/utils/chords.js +19 -0
  83. package/script/src/utils/conversion-registry.d.ts +40 -20
  84. package/script/src/utils/conversion-registry.d.ts.map +1 -1
  85. package/script/src/utils/conversion-registry.js +98 -26
  86. package/script/src/utils/intervals.d.ts +3 -0
  87. package/script/src/utils/intervals.d.ts.map +1 -1
  88. package/script/src/utils/intervals.js +26 -0
  89. package/script/src/utils/midi.d.ts +7 -0
  90. package/script/src/utils/midi.d.ts.map +1 -1
  91. package/script/src/utils/midi.js +19 -0
  92. package/script/src/utils/note-collections.d.ts +9 -1
  93. package/script/src/utils/note-collections.d.ts.map +1 -1
  94. package/script/src/utils/note-collections.js +25 -0
  95. package/script/tests/solfege.test.d.ts.map +1 -0
@@ -1,5 +1,6 @@
1
1
  import { type NoteCollectionKey } from "../data/note-collections/mod.js";
2
- import type { Interval } from "../data/labels/note-labels.js";
2
+ import type { ChromaticIndex } from "../data/chromatic.js";
3
+ import { type Interval } from "../data/labels/note-labels.js";
3
4
  import type { CollectionCategory, NoteCollection } from "../types/note-collections";
4
5
  /**
5
6
  * Checks if a given string is a valid `NoteCollectionKey`.
@@ -7,6 +8,13 @@ import type { CollectionCategory, NoteCollection } from "../types/note-collectio
7
8
  * @returns `true` if the key is a valid `NoteCollectionKey`, `false` otherwise.
8
9
  */
9
10
  export declare function isValidNoteCollectionKey(key: string): key is NoteCollectionKey;
11
+ export interface GetNoteCollectionPitchClassesParams {
12
+ rootNote: string;
13
+ noteCollectionKey: NoteCollectionKey | string;
14
+ }
15
+ export declare function getNoteCollectionPitchClasses({ rootNote: rawRootNote, noteCollectionKey, }: GetNoteCollectionPitchClassesParams): ReadonlySet<ChromaticIndex> | undefined;
16
+ export declare const noteCollectionDisplayNames: ReadonlyMap<string, string>;
17
+ export declare function getNoteCollectionDisplayName(noteCollectionKey: NoteCollectionKey | string): string;
10
18
  /** Search options for finding a note collection. */
11
19
  export interface SearchOptions {
12
20
  /** A text string to search against collection names, aliases, and characteristics. */
@@ -1 +1 @@
1
- {"version":3,"file":"note-collections.d.ts","sourceRoot":"","sources":["../../../src/src/utils/note-collections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,GACV,GAAG,IAAI,iBAAiB,CAE1B;AAoDD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,gFAAgF;IAChF,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,GACrB,cAAc,EAAE,CAmGlB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,SAAS,CAE5B"}
1
+ {"version":3,"file":"note-collections.d.ts","sourceRoot":"","sources":["../../../src/src/utils/note-collections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,KAAK,QAAQ,EAEd,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAInC;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,GACV,GAAG,IAAI,iBAAiB,CAE1B;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,CAAC;CAC/C;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EAAE,WAAW,EACrB,iBAAiB,GAClB,EAAE,mCAAmC,GAClC,WAAW,CAAC,cAAc,CAAC,GAC3B,SAAS,CAeZ;AAED,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAKlE,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,iBAAiB,EAAE,iBAAiB,GAAG,MAAM,GAC5C,MAAM,CAER;AAoDD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,gFAAgF;IAChF,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,aAAa,GACrB,cAAc,EAAE,CAmGlB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,SAAS,CAE5B"}
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noteCollectionDisplayNames = void 0;
3
4
  exports.isValidNoteCollectionKey = isValidNoteCollectionKey;
5
+ exports.getNoteCollectionPitchClasses = getNoteCollectionPitchClasses;
6
+ exports.getNoteCollectionDisplayName = getNoteCollectionDisplayName;
4
7
  exports.searchNoteCollections = searchNoteCollections;
5
8
  exports.findNoteCollection = findNoteCollection;
6
9
  const mod_js_1 = require("../data/note-collections/mod.js");
10
+ const note_labels_js_1 = require("../data/labels/note-labels.js");
11
+ const chromatic_js_1 = require("./chromatic.js");
12
+ const note_names_js_1 = require("./note-names.js");
7
13
  /**
8
14
  * Checks if a given string is a valid `NoteCollectionKey`.
9
15
  * @param key The string to check.
@@ -12,6 +18,25 @@ const mod_js_1 = require("../data/note-collections/mod.js");
12
18
  function isValidNoteCollectionKey(key) {
13
19
  return Object.prototype.hasOwnProperty.call(mod_js_1.noteCollections, key);
14
20
  }
21
+ function getNoteCollectionPitchClasses({ rootNote: rawRootNote, noteCollectionKey, }) {
22
+ const rootNote = (0, note_names_js_1.normalizeRootNoteString)(rawRootNote);
23
+ if (!rootNote || !isValidNoteCollectionKey(noteCollectionKey)) {
24
+ return undefined;
25
+ }
26
+ const rootInteger = note_labels_js_1.rootNoteToIntegerMap.get(rootNote);
27
+ if (rootInteger === undefined)
28
+ return undefined;
29
+ const collection = mod_js_1.noteCollections[noteCollectionKey];
30
+ const pitchClasses = collection.integers.map((interval) => (0, chromatic_js_1.normalizeChromaticIndex)(rootInteger + interval));
31
+ return new Set(pitchClasses);
32
+ }
33
+ exports.noteCollectionDisplayNames = new Map(Object.entries(mod_js_1.noteCollections).map(([collectionKey, collection]) => [
34
+ collectionKey,
35
+ collection.primaryName,
36
+ ]));
37
+ function getNoteCollectionDisplayName(noteCollectionKey) {
38
+ return exports.noteCollectionDisplayNames.get(noteCollectionKey) ?? noteCollectionKey;
39
+ }
15
40
  const normalizationMap = new Map();
16
41
  const aliasSets = {
17
42
  "♭": ["b", "flat"],
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solfege.test.d.ts","sourceRoot":"","sources":["../../src/tests/solfege.test.ts"],"names":[],"mappings":""}