@musodojo/music-theory-data 16.0.7 → 16.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 CHANGED
@@ -49,7 +49,7 @@ import * as music_theory_data from "@musodojo/music-theory-data";
49
49
 
50
50
  ## Usage Example
51
51
 
52
- Get the notes of a scale or the details of a mode.
52
+ The `tests/` directory contains many useful examples.
53
53
 
54
54
  ```ts
55
55
  import * as music_theory_data from "jsr:@musodojo/music-theory-data";
@@ -62,6 +62,11 @@ const notes = music_theory_data.getNoteNamesFromRootAndCollectionKey(
62
62
  console.log(notes);
63
63
  // ["A", "B", "C", "D", "E", "F", "G♯", "A"]
64
64
 
65
+ // Automatically knows whether to use flats or sharps
66
+ notes = music_theory_data.getNoteNamesFromRootAndCollectionKey("F", "ionian");
67
+ console.log(notes);
68
+ // ["F", "G", "A", "B♭", "C", "D", "E", "F"];
69
+
65
70
  // Get the full data structure for the Ionian mode (Major Scale)
66
71
  const ionian = music_theory_data.noteCollections.ionian;
67
72
 
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.0",
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
+ }