@dsebastien/music-notation 0.12.0 → 0.13.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.
@@ -0,0 +1,57 @@
1
+ import { type MusicalKey } from './keys.js';
2
+ import { type HarmonicFunction } from './numerals.js';
3
+ export declare const HARMONIZE_KINDS: readonly ["triads", "sevenths", "sus", "power"];
4
+ export type HarmonizeKind = (typeof HARMONIZE_KINDS)[number];
5
+ export interface HarmonizeOptions {
6
+ /** `triads` (default), `sevenths`, `sus` (sus4, else sus2), `power` (root and fifth). */
7
+ kind?: HarmonizeKind;
8
+ }
9
+ export interface HarmonyScale {
10
+ /** "A harmonic minor", "D dorian", "G major". */
11
+ name: string;
12
+ /** The scale's notes, as tonal spells them (G# harmonic minor's 7th is F##). */
13
+ notes: string[];
14
+ /**
15
+ * The key its numerals are written in: the key itself for major, minor and the modes, else
16
+ * the major or minor key of the scale's third (A harmonic minor: A minor).
17
+ */
18
+ key: MusicalKey;
19
+ }
20
+ export interface HarmonizedChord {
21
+ /** 1 to 7. */
22
+ degree: number;
23
+ /** The scale note it is built on. */
24
+ note: string;
25
+ /** "AmMaj7", "Fsus2", "E5". */
26
+ symbol: string;
27
+ /** "imaj7", "#viø7", "bVII", "I5". */
28
+ numeral: string;
29
+ /** "1mmaj⁷", "#6ø⁷". */
30
+ nashville: string;
31
+ function: HarmonicFunction;
32
+ }
33
+ export interface Harmonized extends HarmonyScale {
34
+ kind: HarmonizeKind;
35
+ chords: HarmonizedChord[];
36
+ /** Degrees without a chord of this kind (sus or power chords need a perfect fifth). */
37
+ skipped: {
38
+ degree: number;
39
+ note: string;
40
+ reason: string;
41
+ }[];
42
+ }
43
+ /**
44
+ * A scale to harmonize: a key (`G`, `Em`, `F# minor`, `D dorian`) or any 7-note scale tonal knows
45
+ * (`A harmonic minor`, `C melodic minor`, `A natural minor`, `C phrygian dominant`). An error
46
+ * says why it can't be one.
47
+ */
48
+ export declare function readHarmonyScale(text: string): HarmonyScale | {
49
+ error: string;
50
+ };
51
+ /**
52
+ * The chords of a 7-note scale, one per degree (see the module comment for numerals). Functions:
53
+ * the chord's function in `key` when it is tonic, subdominant or dominant, else by degree (major
54
+ * T S T S D T D, minor T S T S D S D), so a melodic minor's IV7 is a subdominant, not a secondary
55
+ * dominant. Null when the scale or the kind doesn't read.
56
+ */
57
+ export declare function harmonize(scale: string, options?: HarmonizeOptions): Harmonized | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsebastien/music-notation",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Chord diagrams, piano keyboards, fretboards and ChordPro charts rendered as SVG and HTML, with no framework. Works in Obsidian, on Obsidian Publish and on any web page.",
5
5
  "author": {
6
6
  "name": "Sébastien Dubois",