@musodojo/music-theory-data 28.0.0 → 29.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.
package/README.md CHANGED
@@ -179,17 +179,22 @@ console.log(Object.keys(music_theory_data.groupedNoteCollections));
179
179
  // Get a chord progression
180
180
  const oneSixFourFive = music_theory_data.chordProgressions.oneSixFourFive;
181
181
 
182
- console.log(oneSixFourFive.primaryName);
183
- // "I | vi | IV | V"
182
+ console.log(oneSixFourFive.chords.map((chord) => chord.romanSymbol));
183
+ // ["I", "vi", "IV", "V"]
184
184
 
185
185
  console.log(oneSixFourFive.chords);
186
186
  // [
187
- // { degree: "1", quality: "M", durationInBars: 1 },
188
- // { degree: "6", quality: "m", durationInBars: 1 },
189
- // { degree: "4", quality: "M", durationInBars: 1 },
190
- // { degree: "5", quality: "M", durationInBars: 1 },
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
191
  // ]
192
192
 
193
+ console.log(
194
+ music_theory_data.getChordProgressionRomanSymbols("oneSixFourFive"),
195
+ );
196
+ // ["I", "vi", "IV", "V"]
197
+
193
198
  console.log(
194
199
  music_theory_data.getChordProgressionChordNames(
195
200
  "C",
@@ -222,6 +227,16 @@ console.log(
222
227
  music_theory_data.getChordProgressionTotalDurationInBars("twelveBarBlues"),
223
228
  );
224
229
  // 12
230
+
231
+ console.log(music_theory_data.chordProgressionBarGroups);
232
+ // [
233
+ // { totalBars: 4, progressionKeys: ["oneOneFiveFive", ...] },
234
+ // { totalBars: 8, progressionKeys: ["oneFourOneFiveSplitReturn"] },
235
+ // { totalBars: 12, progressionKeys: ["twelveBarBlues", "twelveBarBluesQuickChange"] },
236
+ // ]
237
+
238
+ console.log(music_theory_data.getChordProgressionKeysForTotalBars(12));
239
+ // ["twelveBarBlues", "twelveBarBluesQuickChange"]
225
240
  ```
226
241
 
227
242
  ## Note Colors And Chromatic Indexes
@@ -1,4 +1,4 @@
1
- import type { ChordProgression } from "../../types/chord-progressions";
1
+ import type { ChordProgression, ChordProgressionBarGroup } from "../../types/chord-progressions";
2
2
  declare const _chordProgressions: {
3
3
  readonly oneOneFiveFive: ChordProgression;
4
4
  readonly oneOneFiveFiveDominant7: ChordProgression;
@@ -17,5 +17,6 @@ declare const _chordProgressions: {
17
17
  };
18
18
  export type ChordProgressionKey = keyof typeof _chordProgressions;
19
19
  export declare const chordProgressions: Record<ChordProgressionKey, ChordProgression>;
20
+ export declare const chordProgressionBarGroups: readonly ChordProgressionBarGroup<ChordProgressionKey>[];
20
21
  export {};
21
22
  //# 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,EAEjB,MAAM,gCAAgC,CAAC;AA+JxC,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"}
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,139 +1,128 @@
1
- function chord(degree, quality, durationInBars) {
1
+ function chord(romanSymbol, degree, quality, durationInBars) {
2
2
  return {
3
+ romanSymbol,
3
4
  degree,
4
5
  quality,
5
6
  durationInBars,
6
7
  };
7
8
  }
8
9
  const oneOneFiveFive = {
9
- primaryName: "I | I | V | V",
10
10
  chords: [
11
- chord("1", "M", 2),
12
- chord("5", "M", 2),
11
+ chord("I", "1", "M", 2),
12
+ chord("V", "5", "M", 2),
13
13
  ],
14
14
  };
15
15
  const oneOneFiveFiveDominant7 = {
16
- primaryName: "I | I | V | V7",
17
16
  chords: [
18
- chord("1", "M", 2),
19
- chord("5", "M", 1),
20
- chord("5", "7", 1),
17
+ chord("I", "1", "M", 2),
18
+ chord("V", "5", "M", 1),
19
+ chord("V7", "5", "7", 1),
21
20
  ],
22
21
  };
23
22
  const oneOneFourFour = {
24
- primaryName: "I | I | IV | IV",
25
23
  chords: [
26
- chord("1", "M", 2),
27
- chord("4", "M", 2),
24
+ chord("I", "1", "M", 2),
25
+ chord("IV", "4", "M", 2),
28
26
  ],
29
27
  };
30
28
  const oneOneFourFive = {
31
- primaryName: "I | I | IV | V",
32
29
  chords: [
33
- chord("1", "M", 2),
34
- chord("4", "M", 1),
35
- chord("5", "M", 1),
30
+ chord("I", "1", "M", 2),
31
+ chord("IV", "4", "M", 1),
32
+ chord("V", "5", "M", 1),
36
33
  ],
37
34
  };
38
35
  const oneFourOneFive = {
39
- primaryName: "I | IV | I | V",
40
36
  chords: [
41
- chord("1", "M", 1),
42
- chord("4", "M", 1),
43
- chord("1", "M", 1),
44
- chord("5", "M", 1),
37
+ chord("I", "1", "M", 1),
38
+ chord("IV", "4", "M", 1),
39
+ chord("I", "1", "M", 1),
40
+ chord("V", "5", "M", 1),
45
41
  ],
46
42
  };
47
43
  const oneSixFourFive = {
48
- primaryName: "I | vi | IV | V",
49
44
  chords: [
50
- chord("1", "M", 1),
51
- chord("6", "m", 1),
52
- chord("4", "M", 1),
53
- chord("5", "M", 1),
45
+ chord("I", "1", "M", 1),
46
+ chord("vi", "6", "m", 1),
47
+ chord("IV", "4", "M", 1),
48
+ chord("V", "5", "M", 1),
54
49
  ],
55
50
  };
56
51
  const oneFiveSixFour = {
57
- primaryName: "I | V | vi | IV",
58
52
  chords: [
59
- chord("1", "M", 1),
60
- chord("5", "M", 1),
61
- chord("6", "m", 1),
62
- chord("4", "M", 1),
53
+ chord("I", "1", "M", 1),
54
+ chord("V", "5", "M", 1),
55
+ chord("vi", "6", "m", 1),
56
+ chord("IV", "4", "M", 1),
63
57
  ],
64
58
  };
65
59
  const oneSixTwoFive = {
66
- primaryName: "I | vi | ii | V",
67
60
  chords: [
68
- chord("1", "M", 1),
69
- chord("6", "m", 1),
70
- chord("2", "m", 1),
71
- chord("5", "M", 1),
61
+ chord("I", "1", "M", 1),
62
+ chord("vi", "6", "m", 1),
63
+ chord("ii", "2", "m", 1),
64
+ chord("V", "5", "M", 1),
72
65
  ],
73
66
  };
74
67
  const sixTwoFiveOne = {
75
- primaryName: "vi | ii | V | I",
76
68
  chords: [
77
- chord("6", "m", 1),
78
- chord("2", "m", 1),
79
- chord("5", "M", 1),
80
- chord("1", "M", 1),
69
+ chord("vi", "6", "m", 1),
70
+ chord("ii", "2", "m", 1),
71
+ chord("V", "5", "M", 1),
72
+ chord("I", "1", "M", 1),
81
73
  ],
82
74
  };
83
75
  const majorTwoFiveOne = {
84
- primaryName: "iim7 | V7 | Imaj7 | Imaj7",
85
76
  chords: [
86
- chord("2", "m7", 1),
87
- chord("5", "7", 1),
88
- chord("1", "M7", 2),
77
+ chord("iim7", "2", "m7", 1),
78
+ chord("V7", "5", "7", 1),
79
+ chord("IM7", "1", "M7", 2),
89
80
  ],
90
81
  };
91
82
  const minorTwoFiveOne = {
92
- primaryName: "iiø7 | V7 | i | i",
93
83
  chords: [
94
- chord("2", "ø7", 1),
95
- chord("5", "7", 1),
96
- chord("1", "m", 2),
84
+ chord("iiø7", "2", "ø7", 1),
85
+ chord("V7", "5", "7", 1),
86
+ chord("i", "1", "m", 2),
97
87
  ],
98
88
  };
99
89
  const oneFourOneFiveSplitReturn = {
100
- primaryName: "I | IV | I | V | I | IV | I V | I",
101
90
  chords: [
102
- chord("1", "M", 1),
103
- chord("4", "M", 1),
104
- chord("1", "M", 1),
105
- chord("5", "M", 1),
106
- chord("1", "M", 1),
107
- chord("4", "M", 1),
108
- chord("1", "M", 0.5),
109
- chord("5", "M", 0.5),
110
- chord("1", "M", 1),
91
+ chord("I", "1", "M", 1),
92
+ chord("IV", "4", "M", 1),
93
+ chord("I", "1", "M", 1),
94
+ chord("V", "5", "M", 1),
95
+ chord("I", "1", "M", 1),
96
+ chord("IV", "4", "M", 1),
97
+ chord("I", "1", "M", 0.5),
98
+ chord("V", "5", "M", 0.5),
99
+ chord("I", "1", "M", 1),
111
100
  ],
112
101
  };
113
102
  const twelveBarBlues = {
114
- primaryName: "12 Bar Blues",
103
+ commonName: "12 Bar Blues",
115
104
  chords: [
116
- chord("1", "7", 4),
117
- chord("4", "7", 2),
118
- chord("1", "7", 2),
119
- chord("5", "7", 1),
120
- chord("4", "7", 1),
121
- chord("1", "7", 1),
122
- chord("5", "7", 1),
105
+ chord("I7", "1", "7", 4),
106
+ chord("IV7", "4", "7", 2),
107
+ chord("I7", "1", "7", 2),
108
+ chord("V7", "5", "7", 1),
109
+ chord("IV7", "4", "7", 1),
110
+ chord("I7", "1", "7", 1),
111
+ chord("V7", "5", "7", 1),
123
112
  ],
124
113
  };
125
114
  const twelveBarBluesQuickChange = {
126
- primaryName: "12 Bar Blues Quick Change",
115
+ commonName: "12 Bar Blues Quick Change",
127
116
  chords: [
128
- chord("1", "7", 1),
129
- chord("4", "7", 1),
130
- chord("1", "7", 2),
131
- chord("4", "7", 2),
132
- chord("1", "7", 2),
133
- chord("5", "7", 1),
134
- chord("4", "7", 1),
135
- chord("1", "7", 1),
136
- chord("5", "7", 1),
117
+ chord("I7", "1", "7", 1),
118
+ chord("IV7", "4", "7", 1),
119
+ chord("I7", "1", "7", 2),
120
+ chord("IV7", "4", "7", 2),
121
+ chord("I7", "1", "7", 2),
122
+ chord("V7", "5", "7", 1),
123
+ chord("IV7", "4", "7", 1),
124
+ chord("I7", "1", "7", 1),
125
+ chord("V7", "5", "7", 1),
137
126
  ],
138
127
  };
139
128
  const _chordProgressions = {
@@ -153,3 +142,19 @@ const _chordProgressions = {
153
142
  twelveBarBluesQuickChange,
154
143
  };
155
144
  export const chordProgressions = _chordProgressions;
145
+ const chordProgressionsByTotalBars = Object.entries(chordProgressions)
146
+ .reduce((groups, [key, progression]) => {
147
+ const totalBars = progression.chords.reduce((total, chord) => total + chord.durationInBars, 0);
148
+ const progressionKeys = groups.get(totalBars);
149
+ if (progressionKeys) {
150
+ progressionKeys.push(key);
151
+ }
152
+ else {
153
+ groups.set(totalBars, [key]);
154
+ }
155
+ return groups;
156
+ }, new Map());
157
+ export const chordProgressionBarGroups = Array.from(chordProgressionsByTotalBars, ([totalBars, progressionKeys]) => ({
158
+ totalBars,
159
+ progressionKeys,
160
+ })).sort((a, b) => a.totalBars - b.totalBars);
@@ -9,6 +9,8 @@ export interface ChordProgressionChordReference {
9
9
  }
10
10
  export declare function isValidChordProgressionKey(key: string): key is ChordProgressionKey;
11
11
  export declare function getChordProgressionChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
12
+ export declare function getChordProgressionRomanSymbols(progressionOrKey: ChordProgression | ChordProgressionKey): string[];
13
+ export declare function getChordProgressionKeysForTotalBars(totalBars: number): ChordProgressionKey[];
12
14
  export declare function getChordProgressionUniqueChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
13
15
  export declare function getChordProgressionChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
14
16
  export declare function getChordProgressionUniqueChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
@@ -1 +1 @@
1
- {"version":3,"file":"chord-progressions.d.ts","sourceRoot":"","sources":["../../../src/src/utils/chord-progressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAMzE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;CAC/C;AAED,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,GAAG,IAAI,mBAAmB,CAE5B;AASD,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,EAAE,CAYV;AAED,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,EAAE,CAIV;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,8BAA8B,EAAE,CAmBlC;AAED,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,8BAA8B,EAAE,CAkBlC;AAED,wBAAgB,sCAAsC,CACpD,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,CAQR"}
1
+ {"version":3,"file":"chord-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AE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,CAQR"}
@@ -1,4 +1,4 @@
1
- import { chordProgressions, } from "../data/chord-progressions/mod.js";
1
+ import { chordProgressionBarGroups, chordProgressions, } from "../data/chord-progressions/mod.js";
2
2
  import { getChordQualityNoteCollectionKey } from "../data/chords/mod.js";
3
3
  import { getNoteNamesForRootAndIntervals, normalizeRootNoteString, } from "./note-names.js";
4
4
  export function isValidChordProgressionKey(key) {
@@ -16,6 +16,16 @@ export function getChordProgressionChordNames(rootNote, progressionOrKey) {
16
16
  const noteNames = getNoteNamesForRootAndIntervals(rootNote, progression.chords.map((chord) => chord.degree));
17
17
  return progression.chords.map((chord, index) => noteNames[index] + chord.quality);
18
18
  }
19
+ export function getChordProgressionRomanSymbols(progressionOrKey) {
20
+ const progression = resolveProgression(progressionOrKey);
21
+ if (!progression)
22
+ return [];
23
+ return progression.chords.map((chord) => chord.romanSymbol);
24
+ }
25
+ export function getChordProgressionKeysForTotalBars(totalBars) {
26
+ return chordProgressionBarGroups.find((group) => group.totalBars === totalBars)
27
+ ?.progressionKeys.slice() ?? [];
28
+ }
19
29
  export function getChordProgressionUniqueChordNames(rootNote, progressionOrKey) {
20
30
  return Array.from(new Set(getChordProgressionChordNames(rootNote, progressionOrKey)));
21
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musodojo/music-theory-data",
3
- "version": "28.0.0",
3
+ "version": "29.0.0",
4
4
  "description": "The musician-friendly TypeScript library for scales, modes, chords, and arpeggios.",
5
5
  "keywords": [
6
6
  "music",
@@ -1,4 +1,4 @@
1
- import type { ChordProgression } from "../../types/chord-progressions";
1
+ import type { ChordProgression, ChordProgressionBarGroup } from "../../types/chord-progressions";
2
2
  declare const _chordProgressions: {
3
3
  readonly oneOneFiveFive: ChordProgression;
4
4
  readonly oneOneFiveFiveDominant7: ChordProgression;
@@ -17,5 +17,6 @@ declare const _chordProgressions: {
17
17
  };
18
18
  export type ChordProgressionKey = keyof typeof _chordProgressions;
19
19
  export declare const chordProgressions: Record<ChordProgressionKey, ChordProgression>;
20
+ export declare const chordProgressionBarGroups: readonly ChordProgressionBarGroup<ChordProgressionKey>[];
20
21
  export {};
21
22
  //# 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,EAEjB,MAAM,gCAAgC,CAAC;AA+JxC,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"}
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,142 +1,131 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chordProgressions = void 0;
4
- function chord(degree, quality, durationInBars) {
3
+ exports.chordProgressionBarGroups = exports.chordProgressions = void 0;
4
+ function chord(romanSymbol, degree, quality, durationInBars) {
5
5
  return {
6
+ romanSymbol,
6
7
  degree,
7
8
  quality,
8
9
  durationInBars,
9
10
  };
10
11
  }
11
12
  const oneOneFiveFive = {
12
- primaryName: "I | I | V | V",
13
13
  chords: [
14
- chord("1", "M", 2),
15
- chord("5", "M", 2),
14
+ chord("I", "1", "M", 2),
15
+ chord("V", "5", "M", 2),
16
16
  ],
17
17
  };
18
18
  const oneOneFiveFiveDominant7 = {
19
- primaryName: "I | I | V | V7",
20
19
  chords: [
21
- chord("1", "M", 2),
22
- chord("5", "M", 1),
23
- chord("5", "7", 1),
20
+ chord("I", "1", "M", 2),
21
+ chord("V", "5", "M", 1),
22
+ chord("V7", "5", "7", 1),
24
23
  ],
25
24
  };
26
25
  const oneOneFourFour = {
27
- primaryName: "I | I | IV | IV",
28
26
  chords: [
29
- chord("1", "M", 2),
30
- chord("4", "M", 2),
27
+ chord("I", "1", "M", 2),
28
+ chord("IV", "4", "M", 2),
31
29
  ],
32
30
  };
33
31
  const oneOneFourFive = {
34
- primaryName: "I | I | IV | V",
35
32
  chords: [
36
- chord("1", "M", 2),
37
- chord("4", "M", 1),
38
- chord("5", "M", 1),
33
+ chord("I", "1", "M", 2),
34
+ chord("IV", "4", "M", 1),
35
+ chord("V", "5", "M", 1),
39
36
  ],
40
37
  };
41
38
  const oneFourOneFive = {
42
- primaryName: "I | IV | I | V",
43
39
  chords: [
44
- chord("1", "M", 1),
45
- chord("4", "M", 1),
46
- chord("1", "M", 1),
47
- chord("5", "M", 1),
40
+ chord("I", "1", "M", 1),
41
+ chord("IV", "4", "M", 1),
42
+ chord("I", "1", "M", 1),
43
+ chord("V", "5", "M", 1),
48
44
  ],
49
45
  };
50
46
  const oneSixFourFive = {
51
- primaryName: "I | vi | IV | V",
52
47
  chords: [
53
- chord("1", "M", 1),
54
- chord("6", "m", 1),
55
- chord("4", "M", 1),
56
- chord("5", "M", 1),
48
+ chord("I", "1", "M", 1),
49
+ chord("vi", "6", "m", 1),
50
+ chord("IV", "4", "M", 1),
51
+ chord("V", "5", "M", 1),
57
52
  ],
58
53
  };
59
54
  const oneFiveSixFour = {
60
- primaryName: "I | V | vi | IV",
61
55
  chords: [
62
- chord("1", "M", 1),
63
- chord("5", "M", 1),
64
- chord("6", "m", 1),
65
- chord("4", "M", 1),
56
+ chord("I", "1", "M", 1),
57
+ chord("V", "5", "M", 1),
58
+ chord("vi", "6", "m", 1),
59
+ chord("IV", "4", "M", 1),
66
60
  ],
67
61
  };
68
62
  const oneSixTwoFive = {
69
- primaryName: "I | vi | ii | V",
70
63
  chords: [
71
- chord("1", "M", 1),
72
- chord("6", "m", 1),
73
- chord("2", "m", 1),
74
- chord("5", "M", 1),
64
+ chord("I", "1", "M", 1),
65
+ chord("vi", "6", "m", 1),
66
+ chord("ii", "2", "m", 1),
67
+ chord("V", "5", "M", 1),
75
68
  ],
76
69
  };
77
70
  const sixTwoFiveOne = {
78
- primaryName: "vi | ii | V | I",
79
71
  chords: [
80
- chord("6", "m", 1),
81
- chord("2", "m", 1),
82
- chord("5", "M", 1),
83
- chord("1", "M", 1),
72
+ chord("vi", "6", "m", 1),
73
+ chord("ii", "2", "m", 1),
74
+ chord("V", "5", "M", 1),
75
+ chord("I", "1", "M", 1),
84
76
  ],
85
77
  };
86
78
  const majorTwoFiveOne = {
87
- primaryName: "iim7 | V7 | Imaj7 | Imaj7",
88
79
  chords: [
89
- chord("2", "m7", 1),
90
- chord("5", "7", 1),
91
- chord("1", "M7", 2),
80
+ chord("iim7", "2", "m7", 1),
81
+ chord("V7", "5", "7", 1),
82
+ chord("IM7", "1", "M7", 2),
92
83
  ],
93
84
  };
94
85
  const minorTwoFiveOne = {
95
- primaryName: "iiø7 | V7 | i | i",
96
86
  chords: [
97
- chord("2", "ø7", 1),
98
- chord("5", "7", 1),
99
- chord("1", "m", 2),
87
+ chord("iiø7", "2", "ø7", 1),
88
+ chord("V7", "5", "7", 1),
89
+ chord("i", "1", "m", 2),
100
90
  ],
101
91
  };
102
92
  const oneFourOneFiveSplitReturn = {
103
- primaryName: "I | IV | I | V | I | IV | I V | I",
104
93
  chords: [
105
- chord("1", "M", 1),
106
- chord("4", "M", 1),
107
- chord("1", "M", 1),
108
- chord("5", "M", 1),
109
- chord("1", "M", 1),
110
- chord("4", "M", 1),
111
- chord("1", "M", 0.5),
112
- chord("5", "M", 0.5),
113
- chord("1", "M", 1),
94
+ chord("I", "1", "M", 1),
95
+ chord("IV", "4", "M", 1),
96
+ chord("I", "1", "M", 1),
97
+ chord("V", "5", "M", 1),
98
+ chord("I", "1", "M", 1),
99
+ chord("IV", "4", "M", 1),
100
+ chord("I", "1", "M", 0.5),
101
+ chord("V", "5", "M", 0.5),
102
+ chord("I", "1", "M", 1),
114
103
  ],
115
104
  };
116
105
  const twelveBarBlues = {
117
- primaryName: "12 Bar Blues",
106
+ commonName: "12 Bar Blues",
118
107
  chords: [
119
- chord("1", "7", 4),
120
- chord("4", "7", 2),
121
- chord("1", "7", 2),
122
- chord("5", "7", 1),
123
- chord("4", "7", 1),
124
- chord("1", "7", 1),
125
- chord("5", "7", 1),
108
+ chord("I7", "1", "7", 4),
109
+ chord("IV7", "4", "7", 2),
110
+ chord("I7", "1", "7", 2),
111
+ chord("V7", "5", "7", 1),
112
+ chord("IV7", "4", "7", 1),
113
+ chord("I7", "1", "7", 1),
114
+ chord("V7", "5", "7", 1),
126
115
  ],
127
116
  };
128
117
  const twelveBarBluesQuickChange = {
129
- primaryName: "12 Bar Blues Quick Change",
118
+ commonName: "12 Bar Blues Quick Change",
130
119
  chords: [
131
- chord("1", "7", 1),
132
- chord("4", "7", 1),
133
- chord("1", "7", 2),
134
- chord("4", "7", 2),
135
- chord("1", "7", 2),
136
- chord("5", "7", 1),
137
- chord("4", "7", 1),
138
- chord("1", "7", 1),
139
- chord("5", "7", 1),
120
+ chord("I7", "1", "7", 1),
121
+ chord("IV7", "4", "7", 1),
122
+ chord("I7", "1", "7", 2),
123
+ chord("IV7", "4", "7", 2),
124
+ chord("I7", "1", "7", 2),
125
+ chord("V7", "5", "7", 1),
126
+ chord("IV7", "4", "7", 1),
127
+ chord("I7", "1", "7", 1),
128
+ chord("V7", "5", "7", 1),
140
129
  ],
141
130
  };
142
131
  const _chordProgressions = {
@@ -156,3 +145,19 @@ const _chordProgressions = {
156
145
  twelveBarBluesQuickChange,
157
146
  };
158
147
  exports.chordProgressions = _chordProgressions;
148
+ const chordProgressionsByTotalBars = Object.entries(exports.chordProgressions)
149
+ .reduce((groups, [key, progression]) => {
150
+ const totalBars = progression.chords.reduce((total, chord) => total + chord.durationInBars, 0);
151
+ const progressionKeys = groups.get(totalBars);
152
+ if (progressionKeys) {
153
+ progressionKeys.push(key);
154
+ }
155
+ else {
156
+ groups.set(totalBars, [key]);
157
+ }
158
+ return groups;
159
+ }, new Map());
160
+ exports.chordProgressionBarGroups = Array.from(chordProgressionsByTotalBars, ([totalBars, progressionKeys]) => ({
161
+ totalBars,
162
+ progressionKeys,
163
+ })).sort((a, b) => a.totalBars - b.totalBars);
@@ -9,6 +9,8 @@ export interface ChordProgressionChordReference {
9
9
  }
10
10
  export declare function isValidChordProgressionKey(key: string): key is ChordProgressionKey;
11
11
  export declare function getChordProgressionChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
12
+ export declare function getChordProgressionRomanSymbols(progressionOrKey: ChordProgression | ChordProgressionKey): string[];
13
+ export declare function getChordProgressionKeysForTotalBars(totalBars: number): ChordProgressionKey[];
12
14
  export declare function getChordProgressionUniqueChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
13
15
  export declare function getChordProgressionChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
14
16
  export declare function getChordProgressionUniqueChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
@@ -1 +1 @@
1
- {"version":3,"file":"chord-progressions.d.ts","sourceRoot":"","sources":["../../../src/src/utils/chord-progressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE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C9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAMzE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;CAC/C;AAED,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,GAAG,IAAI,mBAAmB,CAE5B;AASD,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,EAAE,CAYV;AAED,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,EAAE,CAKV;AAED,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,MAAM,GAChB,mBAAmB,EAAE,CAKvB;AAED,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,EAAE,CAIV;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,8BAA8B,EAAE,CAmBlC;AAED,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,8BAA8B,EAAE,CAkBlC;AAED,wBAAgB,sCAAsC,CACpD,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,CAQR"}
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isValidChordProgressionKey = isValidChordProgressionKey;
4
4
  exports.getChordProgressionChordNames = getChordProgressionChordNames;
5
+ exports.getChordProgressionRomanSymbols = getChordProgressionRomanSymbols;
6
+ exports.getChordProgressionKeysForTotalBars = getChordProgressionKeysForTotalBars;
5
7
  exports.getChordProgressionUniqueChordNames = getChordProgressionUniqueChordNames;
6
8
  exports.getChordProgressionChordReferences = getChordProgressionChordReferences;
7
9
  exports.getChordProgressionUniqueChordReferences = getChordProgressionUniqueChordReferences;
@@ -24,6 +26,16 @@ function getChordProgressionChordNames(rootNote, progressionOrKey) {
24
26
  const noteNames = (0, note_names_js_1.getNoteNamesForRootAndIntervals)(rootNote, progression.chords.map((chord) => chord.degree));
25
27
  return progression.chords.map((chord, index) => noteNames[index] + chord.quality);
26
28
  }
29
+ function getChordProgressionRomanSymbols(progressionOrKey) {
30
+ const progression = resolveProgression(progressionOrKey);
31
+ if (!progression)
32
+ return [];
33
+ return progression.chords.map((chord) => chord.romanSymbol);
34
+ }
35
+ function getChordProgressionKeysForTotalBars(totalBars) {
36
+ return mod_js_1.chordProgressionBarGroups.find((group) => group.totalBars === totalBars)
37
+ ?.progressionKeys.slice() ?? [];
38
+ }
27
39
  function getChordProgressionUniqueChordNames(rootNote, progressionOrKey) {
28
40
  return Array.from(new Set(getChordProgressionChordNames(rootNote, progressionOrKey)));
29
41
  }