@musodojo/music-theory-data 27.0.0 → 28.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 (58) hide show
  1. package/README.md +42 -12
  2. package/esm/src/data/chord-progressions/mod.d.ts +19 -64
  3. package/esm/src/data/chord-progressions/mod.d.ts.map +1 -1
  4. package/esm/src/data/chord-progressions/mod.js +149 -65
  5. package/esm/src/data/chords/mod.d.ts +5 -0
  6. package/esm/src/data/chords/mod.d.ts.map +1 -1
  7. package/esm/src/data/chords/mod.js +20 -0
  8. package/esm/src/data/note-collections/augmented-variants.d.ts +1 -0
  9. package/esm/src/data/note-collections/augmented-variants.d.ts.map +1 -1
  10. package/esm/src/data/note-collections/augmented-variants.js +25 -0
  11. package/esm/src/data/note-collections/mod.d.ts +2 -1
  12. package/esm/src/data/note-collections/mod.d.ts.map +1 -1
  13. package/esm/src/mod.d.ts +1 -1
  14. package/esm/src/mod.js +1 -1
  15. package/esm/src/utils/chord-progressions.d.ts +14 -16
  16. package/esm/src/utils/chord-progressions.d.ts.map +1 -1
  17. package/esm/src/utils/chord-progressions.js +49 -105
  18. package/package.json +1 -1
  19. package/script/src/data/chord-progressions/mod.d.ts +19 -64
  20. package/script/src/data/chord-progressions/mod.d.ts.map +1 -1
  21. package/script/src/data/chord-progressions/mod.js +150 -70
  22. package/script/src/data/chords/mod.d.ts +5 -0
  23. package/script/src/data/chords/mod.d.ts.map +1 -1
  24. package/script/src/data/chords/mod.js +22 -1
  25. package/script/src/data/note-collections/augmented-variants.d.ts +1 -0
  26. package/script/src/data/note-collections/augmented-variants.d.ts.map +1 -1
  27. package/script/src/data/note-collections/augmented-variants.js +25 -0
  28. package/script/src/data/note-collections/mod.d.ts +2 -1
  29. package/script/src/data/note-collections/mod.d.ts.map +1 -1
  30. package/script/src/mod.d.ts +1 -1
  31. package/script/src/mod.js +1 -1
  32. package/script/src/utils/chord-progressions.d.ts +14 -16
  33. package/script/src/utils/chord-progressions.d.ts.map +1 -1
  34. package/script/src/utils/chord-progressions.js +51 -108
  35. package/esm/src/data/chord-progressions/basic.d.ts +0 -10
  36. package/esm/src/data/chord-progressions/basic.d.ts.map +0 -1
  37. package/esm/src/data/chord-progressions/basic.js +0 -164
  38. package/esm/src/data/chord-progressions/blues.d.ts +0 -5
  39. package/esm/src/data/chord-progressions/blues.d.ts.map +0 -1
  40. package/esm/src/data/chord-progressions/blues.js +0 -30
  41. package/esm/src/data/chord-progressions/jazz.d.ts +0 -8
  42. package/esm/src/data/chord-progressions/jazz.d.ts.map +0 -1
  43. package/esm/src/data/chord-progressions/jazz.js +0 -143
  44. package/esm/src/data/chord-progressions/pop.d.ts +0 -6
  45. package/esm/src/data/chord-progressions/pop.d.ts.map +0 -1
  46. package/esm/src/data/chord-progressions/pop.js +0 -42
  47. package/script/src/data/chord-progressions/basic.d.ts +0 -10
  48. package/script/src/data/chord-progressions/basic.d.ts.map +0 -1
  49. package/script/src/data/chord-progressions/basic.js +0 -167
  50. package/script/src/data/chord-progressions/blues.d.ts +0 -5
  51. package/script/src/data/chord-progressions/blues.d.ts.map +0 -1
  52. package/script/src/data/chord-progressions/blues.js +0 -33
  53. package/script/src/data/chord-progressions/jazz.d.ts +0 -8
  54. package/script/src/data/chord-progressions/jazz.d.ts.map +0 -1
  55. package/script/src/data/chord-progressions/jazz.js +0 -146
  56. package/script/src/data/chord-progressions/pop.d.ts +0 -6
  57. package/script/src/data/chord-progressions/pop.d.ts.map +0 -1
  58. package/script/src/data/chord-progressions/pop.js +0 -45
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/data/note-collections/mod.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,E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AAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,oIAAoI;AACpI,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWlB,CAAC;AAEX,0HAA0H;AAC1H,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,eAAe,CAAC;AAE7D,qIAAqI;AACrI,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAWzB,CAAC;AAEX,0GAA0G;AAC1G,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAEzE,sHAAsH;AACtH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAC/C,sBAAsB,EACtB;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAkDO,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A comprehensive library of music theory data, including notes, dyads, scales, chord pitch collections, and chord progression templates.
2
+ * A comprehensive library of music theory data, including notes, dyads, scales, chord pitch collections, and chord progressions.
3
3
  *
4
4
  * This package provides a collection of datasets and utility functions
5
5
  * to work with fundamental concepts of music theory. It's designed to be
package/script/src/mod.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /**
18
- * A comprehensive library of music theory data, including notes, dyads, scales, chord pitch collections, and chord progression templates.
18
+ * A comprehensive library of music theory data, including notes, dyads, scales, chord pitch collections, and chord progressions.
19
19
  *
20
20
  * This package provides a collection of datasets and utility functions
21
21
  * to work with fundamental concepts of music theory. It's designed to be
@@ -1,18 +1,16 @@
1
- import { type ChordProgressionTemplateKey } from "../data/chord-progressions/mod.js";
2
- import type { ChordProgressionTemplate, ChordProgressionTemplateCategory, ChordProgressionTemplateType } from "../types/chord-progressions";
3
- import type { ChordQuality } from "../types/chords";
4
- import type { Interval, RootNote } from "../data/labels/note-labels.js";
5
- export interface ChordProgressionTemplateSearchOptions {
6
- query?: string;
7
- category?: ChordProgressionTemplateCategory;
8
- templateType?: ChordProgressionTemplateType;
9
- type?: string;
1
+ import { type ChordProgressionKey } from "../data/chord-progressions/mod.js";
2
+ import type { ChordProgression } from "../types/chord-progressions";
3
+ import type { RootNote } from "../data/labels/note-labels.js";
4
+ import type { NoteCollectionKey } from "../data/note-collections/mod.js";
5
+ export interface ChordProgressionChordReference {
6
+ readonly rootNote: RootNote;
7
+ readonly chordName: string;
8
+ readonly noteCollectionKey: NoteCollectionKey;
10
9
  }
11
- export declare function isValidChordProgressionTemplateKey(key: string): key is ChordProgressionTemplateKey;
12
- export declare function searchChordProgressionTemplates(options?: ChordProgressionTemplateSearchOptions): ChordProgressionTemplate[];
13
- export declare function findChordProgressionTemplate(options?: ChordProgressionTemplateSearchOptions): ChordProgressionTemplate | undefined;
14
- export declare function getRomanNumeralForIntervalAndChordQuality(interval: Interval, quality: ChordQuality): string | undefined;
15
- export declare function getChordProgressionTemplateDegreeNames(templateOrKey: ChordProgressionTemplate | ChordProgressionTemplateKey): string[];
16
- export declare function getChordProgressionTemplateRomanNames(templateOrKey: ChordProgressionTemplate | ChordProgressionTemplateKey): string[];
17
- export declare function getChordProgressionTemplateChordNames(rootNote: RootNote, templateOrKey: ChordProgressionTemplate | ChordProgressionTemplateKey): string[];
10
+ export declare function isValidChordProgressionKey(key: string): key is ChordProgressionKey;
11
+ export declare function getChordProgressionChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
12
+ export declare function getChordProgressionUniqueChordNames(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): string[];
13
+ export declare function getChordProgressionChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
14
+ export declare function getChordProgressionUniqueChordReferences(rootNote: RootNote, progressionOrKey: ChordProgression | ChordProgressionKey): ChordProgressionChordReference[];
15
+ export declare function getChordProgressionTotalDurationInBars(progressionOrKey: ChordProgression | ChordProgressionKey): number;
18
16
  //# sourceMappingURL=chord-progressions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chord-progressions.d.ts","sourceRoot":"","sources":["../../../src/src/utils/chord-progressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,gCAAgC,EAEhC,4BAA4B,EAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAMxE,MAAM,WAAW,qCAAqC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,gCAAgC,CAAC;IAC5C,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,kCAAkC,CAChD,GAAG,EAAE,MAAM,GACV,GAAG,IAAI,2BAA2B,CAEpC;AAiCD,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,qCAA0C,GAClD,wBAAwB,EAAE,CA6D5B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,qCAA0C,GAClD,wBAAwB,GAAG,SAAS,CAEtC;AASD,wBAAgB,yCAAyC,CACvD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,YAAY,GACpB,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,sCAAsC,CACpD,aAAa,EAAE,wBAAwB,GAAG,2BAA2B,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GAAG,mBAAmB,GACvD,8BAA8B,EAAE,CAkBlC;AAED,wBAAgB,sCAAsC,CACpD,gBAAgB,EAAE,gBAAgB,GAAG,mBAAmB,GACvD,MAAM,CAQR"}
@@ -1,120 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidChordProgressionTemplateKey = isValidChordProgressionTemplateKey;
4
- exports.searchChordProgressionTemplates = searchChordProgressionTemplates;
5
- exports.findChordProgressionTemplate = findChordProgressionTemplate;
6
- exports.getRomanNumeralForIntervalAndChordQuality = getRomanNumeralForIntervalAndChordQuality;
7
- exports.getChordProgressionTemplateDegreeNames = getChordProgressionTemplateDegreeNames;
8
- exports.getChordProgressionTemplateRomanNames = getChordProgressionTemplateRomanNames;
9
- exports.getChordProgressionTemplateChordNames = getChordProgressionTemplateChordNames;
3
+ exports.isValidChordProgressionKey = isValidChordProgressionKey;
4
+ exports.getChordProgressionChordNames = getChordProgressionChordNames;
5
+ exports.getChordProgressionUniqueChordNames = getChordProgressionUniqueChordNames;
6
+ exports.getChordProgressionChordReferences = getChordProgressionChordReferences;
7
+ exports.getChordProgressionUniqueChordReferences = getChordProgressionUniqueChordReferences;
8
+ exports.getChordProgressionTotalDurationInBars = getChordProgressionTotalDurationInBars;
10
9
  const mod_js_1 = require("../data/chord-progressions/mod.js");
11
- const chords_js_1 = require("./chords.js");
10
+ const mod_js_2 = require("../data/chords/mod.js");
12
11
  const note_names_js_1 = require("./note-names.js");
13
- const INTERVAL_REGEX = /^([𝄫♭♮♯𝄪]*)([1-7])$/;
14
- function isValidChordProgressionTemplateKey(key) {
15
- return Object.prototype.hasOwnProperty.call(mod_js_1.chordProgressionTemplates, key);
12
+ function isValidChordProgressionKey(key) {
13
+ return Object.prototype.hasOwnProperty.call(mod_js_1.chordProgressions, key);
16
14
  }
17
- function flattenTemplateSteps(template) {
18
- return template.sections.flatMap((section) => section.chords);
15
+ function resolveProgression(progressionOrKey) {
16
+ if (typeof progressionOrKey !== "string")
17
+ return progressionOrKey;
18
+ return mod_js_1.chordProgressions[progressionOrKey];
19
19
  }
20
- function normalizeSearchTerm(str) {
21
- return str
22
- .trim()
23
- .replaceAll("-", " ")
24
- .replace(/\s+/g, " ")
25
- .toLowerCase();
26
- }
27
- function getSearchableTemplateText(template) {
28
- return [
29
- template.primaryName,
30
- template.templateType,
31
- template.category,
32
- ...template.names,
33
- ...template.type,
34
- ...template.characteristics,
35
- ...getChordProgressionTemplateDegreeNames(template),
36
- ...getChordProgressionTemplateRomanNames(template),
37
- ]
38
- .map(normalizeSearchTerm)
39
- .join(" ");
40
- }
41
- function searchChordProgressionTemplates(options = {}) {
42
- const { query, category, templateType, type } = options;
43
- let candidates = Object.values(mod_js_1.chordProgressionTemplates);
44
- if (category) {
45
- candidates = candidates.filter((template) => template.category === category);
46
- }
47
- if (templateType) {
48
- candidates = candidates.filter((template) => template.templateType === templateType);
49
- }
50
- if (type) {
51
- const normalizedType = normalizeSearchTerm(type);
52
- candidates = candidates.filter((template) => template.type.map(normalizeSearchTerm).includes(normalizedType));
53
- }
54
- if (!query)
55
- return candidates;
56
- const normalizedQuery = normalizeSearchTerm(query);
57
- if (!normalizedQuery)
58
- return candidates;
59
- const queryWords = normalizedQuery.split(" ");
60
- const textFilteredCandidates = candidates.filter((template) => {
61
- const searchableText = getSearchableTemplateText(template);
62
- return queryWords.every((word) => searchableText.includes(word));
63
- });
64
- const prioritizedResults = new Set();
65
- const passes = [
66
- (template) => normalizeSearchTerm(template.primaryName) === normalizedQuery,
67
- (template) => template.names.some((name) => normalizeSearchTerm(name) === normalizedQuery),
68
- (template) => normalizeSearchTerm(template.primaryName).startsWith(normalizedQuery),
69
- (template) => template.names.some((name) => normalizeSearchTerm(name).startsWith(normalizedQuery)),
70
- ];
71
- for (const pass of passes) {
72
- for (const template of textFilteredCandidates) {
73
- if (pass(template))
74
- prioritizedResults.add(template);
75
- }
76
- }
77
- for (const template of textFilteredCandidates) {
78
- prioritizedResults.add(template);
79
- }
80
- return Array.from(prioritizedResults);
81
- }
82
- function findChordProgressionTemplate(options = {}) {
83
- return searchChordProgressionTemplates(options)[0];
84
- }
85
- function resolveTemplate(templateOrKey) {
86
- if (typeof templateOrKey !== "string")
87
- return templateOrKey;
88
- return mod_js_1.chordProgressionTemplates[templateOrKey];
89
- }
90
- function getRomanNumeralForIntervalAndChordQuality(interval, quality) {
91
- const match = interval.match(INTERVAL_REGEX);
92
- if (!match)
93
- return undefined;
94
- const [, accidental, intervalNumber] = match;
95
- const roman = (0, chords_js_1.getRomanNumeralForScaleIndexAndChordQuality)(Number(intervalNumber) - 1, quality);
96
- return roman === undefined ? undefined : accidental + roman;
97
- }
98
- function getChordProgressionTemplateDegreeNames(templateOrKey) {
99
- const template = resolveTemplate(templateOrKey);
100
- if (!template)
20
+ function getChordProgressionChordNames(rootNote, progressionOrKey) {
21
+ const progression = resolveProgression(progressionOrKey);
22
+ if (!progression)
101
23
  return [];
102
- return flattenTemplateSteps(template).map((step) => step.interval + step.quality);
24
+ const noteNames = (0, note_names_js_1.getNoteNamesForRootAndIntervals)(rootNote, progression.chords.map((chord) => chord.degree));
25
+ return progression.chords.map((chord, index) => noteNames[index] + chord.quality);
103
26
  }
104
- function getChordProgressionTemplateRomanNames(templateOrKey) {
105
- const template = resolveTemplate(templateOrKey);
106
- if (!template)
27
+ function getChordProgressionUniqueChordNames(rootNote, progressionOrKey) {
28
+ return Array.from(new Set(getChordProgressionChordNames(rootNote, progressionOrKey)));
29
+ }
30
+ function getChordProgressionChordReferences(rootNote, progressionOrKey) {
31
+ const progression = resolveProgression(progressionOrKey);
32
+ if (!progression)
107
33
  return [];
108
- return flattenTemplateSteps(template).flatMap((step) => {
109
- const roman = getRomanNumeralForIntervalAndChordQuality(step.interval, step.quality);
110
- return roman ? [roman] : [];
34
+ const chordRootNotes = (0, note_names_js_1.getNoteNamesForRootAndIntervals)(rootNote, progression.chords.map((chord) => chord.degree)).map((noteName) => (0, note_names_js_1.normalizeRootNoteString)(noteName));
35
+ return progression.chords.flatMap((chord, index) => {
36
+ const chordRootNote = chordRootNotes[index];
37
+ if (!chordRootNote)
38
+ return [];
39
+ return [{
40
+ rootNote: chordRootNote,
41
+ chordName: chordRootNote + chord.quality,
42
+ noteCollectionKey: (0, mod_js_2.getChordQualityNoteCollectionKey)(chord.quality),
43
+ }];
111
44
  });
112
45
  }
113
- function getChordProgressionTemplateChordNames(rootNote, templateOrKey) {
114
- const template = resolveTemplate(templateOrKey);
115
- if (!template)
116
- return [];
117
- const steps = flattenTemplateSteps(template);
118
- const noteNames = (0, note_names_js_1.getNoteNamesForRootAndIntervals)(rootNote, steps.map((step) => step.interval));
119
- return noteNames.map((noteName, i) => noteName + steps[i].quality);
46
+ function getChordProgressionUniqueChordReferences(rootNote, progressionOrKey) {
47
+ const uniqueReferences = [];
48
+ const seen = new Set();
49
+ for (const reference of getChordProgressionChordReferences(rootNote, progressionOrKey)) {
50
+ const key = `${reference.rootNote}:${reference.noteCollectionKey}:${reference.chordName}`;
51
+ if (seen.has(key))
52
+ continue;
53
+ seen.add(key);
54
+ uniqueReferences.push(reference);
55
+ }
56
+ return uniqueReferences;
57
+ }
58
+ function getChordProgressionTotalDurationInBars(progressionOrKey) {
59
+ const progression = resolveProgression(progressionOrKey);
60
+ if (!progression)
61
+ return 0;
62
+ return progression.chords.reduce((total, chord) => total + chord.durationInBars, 0);
120
63
  }
@@ -1,10 +0,0 @@
1
- import type { ChordProgressionTemplate } from "../../types/chord-progressions";
2
- export declare const basicChordProgressionTemplates: {
3
- readonly oneFourFive: ChordProgressionTemplate;
4
- readonly oneFive: ChordProgressionTemplate;
5
- readonly oneFour: ChordProgressionTemplate;
6
- readonly oneOneFiveFive: ChordProgressionTemplate;
7
- readonly oneOneFiveFiveSeven: ChordProgressionTemplate;
8
- readonly oneFourOneFive: ChordProgressionTemplate;
9
- };
10
- //# sourceMappingURL=basic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/basic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAoK/E,eAAO,MAAM,8BAA8B;;;;;;;CAOjC,CAAC"}
@@ -1,164 +0,0 @@
1
- const oneFourFive = {
2
- templateType: "formula",
3
- category: "basic",
4
- primaryName: "I IV V",
5
- names: ["I IV V", "One Four Five", "1 4 5"],
6
- type: ["basic", "formula", "major key", "three chord", "beginner"],
7
- characteristics: [
8
- "simple",
9
- "foundational",
10
- "common",
11
- "beginner friendly",
12
- "tonic subdominant dominant",
13
- ],
14
- sections: [
15
- {
16
- name: "Main",
17
- chords: [
18
- { interval: "1", quality: "M", noteCollectionKey: "major" },
19
- { interval: "4", quality: "M", noteCollectionKey: "major" },
20
- { interval: "5", quality: "M", noteCollectionKey: "major" },
21
- ],
22
- },
23
- ],
24
- };
25
- const oneFive = {
26
- templateType: "formula",
27
- category: "basic",
28
- primaryName: "I V",
29
- names: ["I V", "One Five", "1 5"],
30
- type: ["basic", "formula", "major key", "two chord", "beginner"],
31
- characteristics: [
32
- "simple",
33
- "foundational",
34
- "common",
35
- "beginner friendly",
36
- "tonic dominant",
37
- ],
38
- sections: [
39
- {
40
- name: "Main",
41
- chords: [
42
- { interval: "1", quality: "M", noteCollectionKey: "major" },
43
- { interval: "5", quality: "M", noteCollectionKey: "major" },
44
- ],
45
- },
46
- ],
47
- };
48
- const oneFour = {
49
- templateType: "formula",
50
- category: "basic",
51
- primaryName: "I IV",
52
- names: ["I IV", "One Four", "1 4"],
53
- type: ["basic", "formula", "major key", "two chord", "beginner"],
54
- characteristics: [
55
- "simple",
56
- "foundational",
57
- "common",
58
- "beginner friendly",
59
- "tonic subdominant",
60
- ],
61
- sections: [
62
- {
63
- name: "Main",
64
- chords: [
65
- { interval: "1", quality: "M", noteCollectionKey: "major" },
66
- { interval: "4", quality: "M", noteCollectionKey: "major" },
67
- ],
68
- },
69
- ],
70
- };
71
- const oneOneFiveFive = {
72
- templateType: "loop",
73
- category: "basic",
74
- primaryName: "I I V V",
75
- names: ["I I V V", "One One Five Five", "1 1 5 5", "Tonic Dominant Loop"],
76
- type: ["basic", "loop", "major key", "tonic dominant", "beginner"],
77
- characteristics: [
78
- "simple",
79
- "playable",
80
- "stable",
81
- "beginner friendly",
82
- "practice loop",
83
- ],
84
- sections: [
85
- {
86
- name: "Main",
87
- chords: [
88
- { interval: "1", quality: "M", noteCollectionKey: "major" },
89
- { interval: "1", quality: "M", noteCollectionKey: "major" },
90
- { interval: "5", quality: "M", noteCollectionKey: "major" },
91
- { interval: "5", quality: "M", noteCollectionKey: "major" },
92
- ],
93
- },
94
- ],
95
- };
96
- const oneOneFiveFiveSeven = {
97
- templateType: "loop",
98
- category: "basic",
99
- primaryName: "I I V V7",
100
- names: [
101
- "I I V V7",
102
- "One One Five Five-Seven",
103
- "Tonic Dominant Seventh Loop",
104
- ],
105
- type: [
106
- "basic",
107
- "loop",
108
- "major key",
109
- "tonic dominant",
110
- "turnaround",
111
- "beginner",
112
- ],
113
- characteristics: [
114
- "simple",
115
- "playable",
116
- "resolving",
117
- "beginner friendly",
118
- "practice loop",
119
- ],
120
- sections: [
121
- {
122
- name: "Main",
123
- chords: [
124
- { interval: "1", quality: "M", noteCollectionKey: "major" },
125
- { interval: "1", quality: "M", noteCollectionKey: "major" },
126
- { interval: "5", quality: "M", noteCollectionKey: "major" },
127
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
128
- ],
129
- },
130
- ],
131
- };
132
- const oneFourOneFive = {
133
- templateType: "loop",
134
- category: "basic",
135
- primaryName: "I IV I V",
136
- names: ["I IV I V", "One Four One Five", "1 4 1 5"],
137
- type: ["basic", "loop", "major key", "three chord", "beginner"],
138
- characteristics: [
139
- "simple",
140
- "playable",
141
- "balanced",
142
- "beginner friendly",
143
- "practice loop",
144
- ],
145
- sections: [
146
- {
147
- name: "Main",
148
- chords: [
149
- { interval: "1", quality: "M", noteCollectionKey: "major" },
150
- { interval: "4", quality: "M", noteCollectionKey: "major" },
151
- { interval: "1", quality: "M", noteCollectionKey: "major" },
152
- { interval: "5", quality: "M", noteCollectionKey: "major" },
153
- ],
154
- },
155
- ],
156
- };
157
- export const basicChordProgressionTemplates = {
158
- oneFourFive,
159
- oneFive,
160
- oneFour,
161
- oneOneFiveFive,
162
- oneOneFiveFiveSeven,
163
- oneFourOneFive,
164
- };
@@ -1,5 +0,0 @@
1
- import type { ChordProgressionTemplate } from "../../types/chord-progressions";
2
- export declare const bluesChordProgressionTemplates: {
3
- readonly twelveBarBlues: ChordProgressionTemplate;
4
- };
5
- //# sourceMappingURL=blues.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blues.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/blues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AA8B/E,eAAO,MAAM,8BAA8B;;CAEjC,CAAC"}
@@ -1,30 +0,0 @@
1
- const twelveBarBlues = {
2
- templateType: "form",
3
- category: "blues",
4
- primaryName: "Twelve Bar Blues",
5
- names: ["Twelve Bar Blues", "12 Bar Blues", "I7 IV7 V7 Blues"],
6
- type: ["blues", "form", "dominant seventh", "twelve bar", "beginner"],
7
- characteristics: ["foundational", "cyclical", "common", "blues"],
8
- sections: [
9
- {
10
- name: "Main",
11
- chords: [
12
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
13
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
14
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
15
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
16
- { interval: "4", quality: "7", noteCollectionKey: "dominant7" },
17
- { interval: "4", quality: "7", noteCollectionKey: "dominant7" },
18
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
19
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
20
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
21
- { interval: "4", quality: "7", noteCollectionKey: "dominant7" },
22
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
23
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
24
- ],
25
- },
26
- ],
27
- };
28
- export const bluesChordProgressionTemplates = {
29
- twelveBarBlues,
30
- };
@@ -1,8 +0,0 @@
1
- import type { ChordProgressionTemplate } from "../../types/chord-progressions";
2
- export declare const jazzChordProgressionTemplates: {
3
- readonly twoFiveOneMajor: ChordProgressionTemplate;
4
- readonly minorTwoFiveOne: ChordProgressionTemplate;
5
- readonly rhythmChanges: ChordProgressionTemplate;
6
- readonly jazzBluesBasic: ChordProgressionTemplate;
7
- };
8
- //# sourceMappingURL=jazz.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jazz.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/jazz.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AA+I/E,eAAO,MAAM,6BAA6B;;;;;CAKhC,CAAC"}
@@ -1,143 +0,0 @@
1
- const twoFiveOneMajor = {
2
- templateType: "formula",
3
- category: "jazz",
4
- primaryName: "iim7 V7 IM7",
5
- names: [
6
- "iim7 V7 IM7",
7
- "ii V I",
8
- "Two Five One",
9
- "Major Two Five One",
10
- "2 5 1",
11
- ],
12
- type: ["jazz", "formula", "major key", "cadence", "seventh chords"],
13
- characteristics: ["functional", "resolving", "foundational", "jazz"],
14
- sections: [
15
- {
16
- name: "Main",
17
- chords: [
18
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
19
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
20
- { interval: "1", quality: "M7", noteCollectionKey: "major7" },
21
- ],
22
- },
23
- ],
24
- };
25
- const minorTwoFiveOne = {
26
- templateType: "formula",
27
- category: "jazz",
28
- primaryName: "iiø7 V7 i",
29
- names: ["iiø7 V7 i", "iiø V i", "Minor Two Five One", "2 5 1 minor"],
30
- type: ["jazz", "formula", "minor key", "cadence", "seventh chords"],
31
- characteristics: ["functional", "minor", "resolving", "jazz"],
32
- sections: [
33
- {
34
- name: "Main",
35
- chords: [
36
- { interval: "2", quality: "ø7", noteCollectionKey: "halfDiminished7" },
37
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
38
- { interval: "1", quality: "m", noteCollectionKey: "minor" },
39
- ],
40
- },
41
- ],
42
- };
43
- const rhythmChanges = {
44
- templateType: "form",
45
- category: "jazz",
46
- primaryName: "Rhythm Changes",
47
- names: ["Rhythm Changes", "AABA Rhythm Changes", "Rhythm Changes Form"],
48
- type: ["jazz", "form", "major key", "turnaround", "AABA"],
49
- characteristics: [
50
- "cyclical",
51
- "functional",
52
- "jazz",
53
- "standard",
54
- "song form",
55
- ],
56
- sections: [
57
- {
58
- name: "A1",
59
- chords: [
60
- { interval: "1", quality: "M7", noteCollectionKey: "major7" },
61
- { interval: "6", quality: "m7", noteCollectionKey: "minor7" },
62
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
63
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
64
- { interval: "3", quality: "m7", noteCollectionKey: "minor7" },
65
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
66
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
67
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
68
- ],
69
- },
70
- {
71
- name: "A2",
72
- chords: [
73
- { interval: "1", quality: "M7", noteCollectionKey: "major7" },
74
- { interval: "6", quality: "m7", noteCollectionKey: "minor7" },
75
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
76
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
77
- { interval: "3", quality: "m7", noteCollectionKey: "minor7" },
78
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
79
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
80
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
81
- ],
82
- },
83
- {
84
- name: "B",
85
- chords: [
86
- { interval: "3", quality: "7", noteCollectionKey: "dominant7" },
87
- { interval: "3", quality: "7", noteCollectionKey: "dominant7" },
88
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
89
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
90
- { interval: "2", quality: "7", noteCollectionKey: "dominant7" },
91
- { interval: "2", quality: "7", noteCollectionKey: "dominant7" },
92
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
93
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
94
- ],
95
- },
96
- {
97
- name: "A3",
98
- chords: [
99
- { interval: "1", quality: "M7", noteCollectionKey: "major7" },
100
- { interval: "6", quality: "m7", noteCollectionKey: "minor7" },
101
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
102
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
103
- { interval: "3", quality: "m7", noteCollectionKey: "minor7" },
104
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
105
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
106
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
107
- ],
108
- },
109
- ],
110
- };
111
- const jazzBluesBasic = {
112
- templateType: "form",
113
- category: "jazz",
114
- primaryName: "Jazz Blues Basic",
115
- names: ["Jazz Blues Basic", "Jazz Blues"],
116
- type: ["jazz", "blues", "form", "dominant seventh", "turnaround"],
117
- characteristics: ["functional", "blues", "jazz", "cyclical"],
118
- sections: [
119
- {
120
- name: "Main",
121
- chords: [
122
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
123
- { interval: "4", quality: "7", noteCollectionKey: "dominant7" },
124
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
125
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
126
- { interval: "4", quality: "7", noteCollectionKey: "dominant7" },
127
- { interval: "♯4", quality: "°7", noteCollectionKey: "diminished7" },
128
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
129
- { interval: "6", quality: "7", noteCollectionKey: "dominant7" },
130
- { interval: "2", quality: "m7", noteCollectionKey: "minor7" },
131
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
132
- { interval: "1", quality: "7", noteCollectionKey: "dominant7" },
133
- { interval: "5", quality: "7", noteCollectionKey: "dominant7" },
134
- ],
135
- },
136
- ],
137
- };
138
- export const jazzChordProgressionTemplates = {
139
- twoFiveOneMajor,
140
- minorTwoFiveOne,
141
- rhythmChanges,
142
- jazzBluesBasic,
143
- };
@@ -1,6 +0,0 @@
1
- import type { ChordProgressionTemplate } from "../../types/chord-progressions";
2
- export declare const popChordProgressionTemplates: {
3
- readonly dooWop: ChordProgressionTemplate;
4
- readonly axisProgression: ChordProgressionTemplate;
5
- };
6
- //# sourceMappingURL=pop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pop.d.ts","sourceRoot":"","sources":["../../../../src/src/data/chord-progressions/pop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AA0C/E,eAAO,MAAM,4BAA4B;;;CAG/B,CAAC"}