@dsebastien/music-notation 0.5.3 → 0.7.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.
@@ -8,6 +8,8 @@
8
8
  * come the D, C, A and G shapes.
9
9
  * - 3NPS: 3 notes per string, starting from the n-th scale degree.
10
10
  * Scales with no pentatonic inside (locrian, harmonic minor…) use 3NPS for their CAGED positions.
11
+ * Major pentatonic positions can be numbered from the relative minor (`numbering: minor`), as many
12
+ * courses do: position 1 is then the relative minor's box 1.
11
13
  */
12
14
  import type { NoteSet } from '../theory/note-set.js';
13
15
  export type PositionSystem = 'box' | 'caged' | '3nps';
@@ -19,8 +21,38 @@ export interface Cell {
19
21
  export declare const CAGED_SHAPES: readonly ["E", "D", "C", "A", "G"];
20
22
  /** How many positions a scale has in a system. */
21
23
  export declare function positionCount(set: NoteSet, system: PositionSystem): number;
22
- /** The notes of position `n` (1-based); null when the scale or position doesn't fit the system. */
23
- export declare function scalePosition(set: NoteSet, tuning: number[], system: PositionSystem, n: number): Cell[] | null;
24
+ /** The highest fret a fretboard can show. */
25
+ export declare const MAX_FRET = 36;
26
+ /** How positions are numbered: from the scale's root (default), or from the relative minor. */
27
+ export type Numbering = 'root' | 'minor';
28
+ /**
29
+ * Where to draw a position and how it's numbered: `within` picks the lowest octave inside those
30
+ * frets (else the lowest); `numbering: 'minor'` counts a major pentatonic's positions from its
31
+ * relative minor.
32
+ */
33
+ export interface PositionOptions {
34
+ within?: [number, number];
35
+ numbering?: Numbering;
36
+ }
37
+ /** The relative minor's root, as the scale spells it (its 5th note: the 6th degree). */
38
+ export declare const relativeMinorOf: (set: NoteSet) => string | undefined;
39
+ /**
40
+ * Reads `numbering:` for a scale's positions. `minor` (or `relative minor`) only applies to major
41
+ * pentatonic boxes and 3NPS positions; anywhere else it's an error that says where it applies.
42
+ */
43
+ export declare function numberingOf(text: string | undefined, set: NoteSet, system: PositionSystem): Numbering;
44
+ /**
45
+ * The notes of position `n` (1-based), in the lowest octave where every note is on the neck (or
46
+ * the lowest one inside `within`); null when the scale or position doesn't fit the system.
47
+ */
48
+ export declare function scalePosition(set: NoteSet, tuning: number[], system: PositionSystem, n: number, options?: PositionOptions): Cell[] | null;
49
+ /**
50
+ * Every position in neck order, position 1 first: the first in its lowest octave, each next one in
51
+ * the lowest octave at or above the previous one (by their lowest frets), or in its own lowest
52
+ * octave when that would go past fret 36. Null for a position that doesn't fit the system.
53
+ * With `numbering: 'minor'`, a major pentatonic starts from its relative minor's box 1.
54
+ */
55
+ export declare function neckPositions(set: NoteSet, tuning: number[], system: PositionSystem, numbering?: Numbering): (Cell[] | null)[];
24
56
  /** Parses `position:` and `shape:` for a scale: the system and the position number. */
25
57
  export declare function positionOf(positionText: string | undefined, shapeText: string | undefined): {
26
58
  system: PositionSystem;
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export type { VoicingLookup } from './voicings/index.js';
21
21
  export { parseChordName, readChord, suggestChords } from './theory/chord-name.js';
22
22
  export { detectChordFromFrets, detectChordFromPitches, type DetectedChord } from './theory/detect.js';
23
23
  export { scaleName, modesOf, scaleTypes, characteristicIntervals, isScaleWithoutRoot } from './theory/scales.js';
24
- export { scalePosition, positionCount, CAGED_SHAPES, type Cell, type PositionSystem } from './fretboard/positions.js';
24
+ export { scalePosition, neckPositions, positionCount, CAGED_SHAPES, MAX_FRET, type Cell, type Numbering, type PositionOptions, type PositionSystem } from './fretboard/positions.js';
25
25
  export { blockFromProperties, instrumentOf, DEFAULT_PROPERTY_NAMES, type PropertyNames, type Instrument } from './blocks/properties.js';
26
26
  export { textTabToAlphaTex } from './convert/text-tab.js';
27
27
  export { chordSheetToChordPro } from './convert/chord-sheet.js';