@musodojo/music-theory-data 16.0.7 → 16.1.1

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 CHANGED
@@ -6,6 +6,19 @@ more.**
6
6
  > **Note:** This library is currently under review for accuracy. Please verify
7
7
  > data before use in a critical application.
8
8
 
9
+ ## Verified Note Collections
10
+
11
+ - ✅ Diatonic Modes
12
+ - 🛠️ Pentatonic Variants
13
+ - 🛠️ Major Variants
14
+ - 🛠️ Minor Variants
15
+ - 🛠️ Dominant Variants
16
+ - ✅ Harmonic Minor Modes
17
+ - 🛠️ Melodic Minor Modes
18
+ - 🛠️ Diminished Variants
19
+ - 🛠️ Augmented Variants
20
+ - 🛠️ Other Note Collections
21
+
9
22
  ## Features
10
23
 
11
24
  - **Rich Data Structures:** Access detailed information for scales, modes,
@@ -47,9 +60,11 @@ Then import it into your project:
47
60
  import * as music_theory_data from "@musodojo/music-theory-data";
48
61
  ```
49
62
 
50
- ## Usage Example
63
+ ## Usage Examples
64
+
65
+ Note: the `tests/` directory contains many useful examples.
51
66
 
52
- Get the notes of a scale or the details of a mode.
67
+ The code below shows how to access and print some of the data.
53
68
 
54
69
  ```ts
55
70
  import * as music_theory_data from "jsr:@musodojo/music-theory-data";
@@ -62,6 +77,11 @@ const notes = music_theory_data.getNoteNamesFromRootAndCollectionKey(
62
77
  console.log(notes);
63
78
  // ["A", "B", "C", "D", "E", "F", "G♯", "A"]
64
79
 
80
+ // Automatically knows whether to use flats or sharps
81
+ notes = music_theory_data.getNoteNamesFromRootAndCollectionKey("F", "ionian");
82
+ console.log(notes);
83
+ // ["F", "G", "A", "B♭", "C", "D", "E", "F"];
84
+
65
85
  // Get the full data structure for the Ionian mode (Major Scale)
66
86
  const ionian = music_theory_data.noteCollections.ionian;
67
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musodojo/music-theory-data",
3
- "version": "16.0.7",
3
+ "version": "16.1.1",
4
4
  "description": "The musician-friendly TypeScript library for modes, scales, chords, and more.",
5
5
  "keywords": [
6
6
  "music",
@@ -95,9 +95,9 @@ const ionianSharp5: ScaleCollection = {
95
95
  "augmented second",
96
96
  "half",
97
97
  "whole",
98
- "whole",
98
+ "half",
99
99
  ],
100
- patternShort: ["W", "W", "H", "A2", "H", "W", "W"],
100
+ patternShort: ["W", "W", "H", "A2", "H", "W", "H"],
101
101
  } as const;
102
102
 
103
103
  const dorianSharp4: ScaleCollection = {
@@ -122,10 +122,10 @@ const dorianSharp4: ScaleCollection = {
122
122
  "augmented second",
123
123
  "half",
124
124
  "whole",
125
- "whole",
126
125
  "half",
126
+ "whole",
127
127
  ],
128
- patternShort: ["W", "H", "A2", "H", "W", "W", "H"],
128
+ patternShort: ["W", "H", "A2", "H", "W", "H", "W"],
129
129
  } as const;
130
130
 
131
131
  const phrygianDominant: ScaleCollection = {
@@ -187,9 +187,9 @@ const lydianSharp2: ScaleCollection = {
187
187
  "half",
188
188
  "whole",
189
189
  "whole",
190
- "whole",
190
+ "half",
191
191
  ],
192
- patternShort: ["A2", "H", "W", "H", "W", "W", "W"],
192
+ patternShort: ["A2", "H", "W", "H", "W", "W", "H"],
193
193
  } as const;
194
194
 
195
195
  const superLocrianDoubleFlat7: ScaleCollection = {
@@ -211,8 +211,16 @@ const superLocrianDoubleFlat7: ScaleCollection = {
211
211
  "altered",
212
212
  "theoretical",
213
213
  ],
214
- pattern: ["half", "whole", "half", "whole", "whole", "half", "whole"],
215
- patternShort: ["H", "W", "H", "W", "W", "H", "W"],
214
+ pattern: [
215
+ "half",
216
+ "whole",
217
+ "half",
218
+ "whole",
219
+ "whole",
220
+ "half",
221
+ "augmented second",
222
+ ],
223
+ patternShort: ["H", "W", "H", "W", "W", "H", "A2"],
216
224
  } as const;
217
225
 
218
226
  export const _harmonicMinorModes = {
@@ -9,6 +9,7 @@ import {
9
9
  simpleToCompoundIntervalMap,
10
10
  simpleToExtensionIntervalMap,
11
11
  } from "../data/labels/note-labels.ts";
12
+ import type { NoteCollection } from "../types/note-collections.d.ts";
12
13
 
13
14
  export function filterOutOctaveIntervals(
14
15
  intervals: readonly Interval[],
@@ -97,3 +98,14 @@ export function getIntervalsFromQualities(
97
98
  return interval ? [interval] : [];
98
99
  });
99
100
  }
101
+
102
+ /**
103
+ * Extracts the interval qualities (e.g., "P1", "M2", "m3") from a NoteCollection.
104
+ * @param collection The NoteCollection object.
105
+ * @returns An array of IntervalQuality strings.
106
+ */
107
+ export function getQualitiesFromNoteCollection(
108
+ collection: NoteCollection,
109
+ ): IntervalQuality[] {
110
+ return getQualitiesFromIntervals(collection.intervals);
111
+ }