@openstand/engine 0.0.0-stage → 0.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.
Files changed (75) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +49 -2
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +20261 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/types/packages/engine/src/backingTrack.d.ts +20 -0
  7. package/dist/types/packages/engine/src/index.d.ts +17 -0
  8. package/dist/types/src/engine/arrange.d.ts +30 -0
  9. package/dist/types/src/engine/bass.d.ts +5 -0
  10. package/dist/types/src/engine/click.d.ts +9 -0
  11. package/dist/types/src/engine/comp.d.ts +8 -0
  12. package/dist/types/src/engine/drums.d.ts +5 -0
  13. package/dist/types/src/engine/events.d.ts +15 -0
  14. package/dist/types/src/engine/keyOrder.d.ts +8 -0
  15. package/dist/types/src/engine/meter.d.ts +9 -0
  16. package/dist/types/src/engine/midiWriter.d.ts +25 -0
  17. package/dist/types/src/engine/timeline.d.ts +61 -0
  18. package/dist/types/src/formats/chartFile.d.ts +4 -0
  19. package/dist/types/src/formats/chordpro.d.ts +2 -0
  20. package/dist/types/src/formats/chordproRead.d.ts +4 -0
  21. package/dist/types/src/formats/ireal.d.ts +24 -0
  22. package/dist/types/src/formats/irealWrite.d.ts +4 -0
  23. package/dist/types/src/formats/musicxml.d.ts +2 -0
  24. package/dist/types/src/formats/musicxmlChords.d.ts +20 -0
  25. package/dist/types/src/formats/musicxmlRead.d.ts +9 -0
  26. package/dist/types/src/formats/xml.d.ts +17 -0
  27. package/dist/types/src/formats/zip.d.ts +10 -0
  28. package/dist/types/src/music/chart.d.ts +50 -0
  29. package/dist/types/src/music/chords.d.ts +24 -0
  30. package/dist/types/src/music/edit.d.ts +20 -0
  31. package/dist/types/src/music/fretboard.d.ts +17 -0
  32. package/dist/types/src/music/meter.d.ts +13 -0
  33. package/dist/types/src/music/notation.d.ts +13 -0
  34. package/dist/types/src/styles/aksak.d.ts +12 -0
  35. package/dist/types/src/styles/compound.d.ts +2 -0
  36. package/dist/types/src/styles/drums.d.ts +33 -0
  37. package/dist/types/src/styles/index.d.ts +4 -0
  38. package/dist/types/src/styles/library/afro-cuban.d.ts +2 -0
  39. package/dist/types/src/styles/library/aksak.d.ts +2 -0
  40. package/dist/types/src/styles/library/bachata.d.ts +2 -0
  41. package/dist/types/src/styles/library/baiao.d.ts +2 -0
  42. package/dist/types/src/styles/library/ballad.d.ts +2 -0
  43. package/dist/types/src/styles/library/bluegrass.d.ts +2 -0
  44. package/dist/types/src/styles/library/bolero.d.ts +2 -0
  45. package/dist/types/src/styles/library/bossa-nova.d.ts +2 -0
  46. package/dist/types/src/styles/library/calypso.d.ts +2 -0
  47. package/dist/types/src/styles/library/cha-cha.d.ts +2 -0
  48. package/dist/types/src/styles/library/choro.d.ts +2 -0
  49. package/dist/types/src/styles/library/country.d.ts +2 -0
  50. package/dist/types/src/styles/library/cumbia.d.ts +2 -0
  51. package/dist/types/src/styles/library/disco.d.ts +2 -0
  52. package/dist/types/src/styles/library/even-eighths.d.ts +2 -0
  53. package/dist/types/src/styles/library/funk.d.ts +2 -0
  54. package/dist/types/src/styles/library/gospel.d.ts +2 -0
  55. package/dist/types/src/styles/library/gypsy-jazz.d.ts +2 -0
  56. package/dist/types/src/styles/library/hip-hop.d.ts +2 -0
  57. package/dist/types/src/styles/library/jazz-waltz.d.ts +2 -0
  58. package/dist/types/src/styles/library/medium-swing.d.ts +2 -0
  59. package/dist/types/src/styles/library/merengue.d.ts +2 -0
  60. package/dist/types/src/styles/library/partido-alto.d.ts +2 -0
  61. package/dist/types/src/styles/library/pop-rock.d.ts +2 -0
  62. package/dist/types/src/styles/library/reggae.d.ts +2 -0
  63. package/dist/types/src/styles/library/rock-12-8.d.ts +2 -0
  64. package/dist/types/src/styles/library/samba.d.ts +2 -0
  65. package/dist/types/src/styles/library/second-line.d.ts +2 -0
  66. package/dist/types/src/styles/library/shuffle.d.ts +2 -0
  67. package/dist/types/src/styles/library/ska.d.ts +2 -0
  68. package/dist/types/src/styles/library/slow-blues.d.ts +2 -0
  69. package/dist/types/src/styles/library/smooth-jazz.d.ts +2 -0
  70. package/dist/types/src/styles/library/soul.d.ts +2 -0
  71. package/dist/types/src/styles/library/swing-two-four.d.ts +2 -0
  72. package/dist/types/src/styles/library/tango.d.ts +2 -0
  73. package/dist/types/src/styles/library/up-tempo-swing.d.ts +2 -0
  74. package/dist/types/src/styles/types.d.ts +66 -0
  75. package/package.json +36 -4
@@ -0,0 +1,20 @@
1
+ import type { PracticeOptions, Timeline } from '../../../src/engine/timeline.js';
2
+ import type { Chart } from '../../../src/music/chart.js';
3
+ import { type StyleDefinition } from '../../../src/styles/index.js';
4
+ export interface BackingTrackInput {
5
+ chart?: Chart;
6
+ ireal?: string;
7
+ style?: string;
8
+ transpose?: number;
9
+ choruses?: number;
10
+ bpm?: number;
11
+ practice?: PracticeOptions;
12
+ }
13
+ export interface BackingTrackResult {
14
+ midi: Uint8Array;
15
+ timeline: Timeline;
16
+ chart: Chart;
17
+ style: StyleDefinition;
18
+ }
19
+ /** Generate a backing-track MIDI file and timeline from a Chart or iReal Pro link. */
20
+ export declare function backingTrack(input: BackingTrackInput): BackingTrackResult;
@@ -0,0 +1,17 @@
1
+ export { backingTrack, type BackingTrackInput, type BackingTrackResult } from './backingTrack.js';
2
+ export { beatsPerBar, chartFromMeasures, evenSplit, isCompound, playbackOrder, type BarChord, type Chart, type ChartBar, type TimeSignature, } from '../../../src/music/chart.js';
3
+ export { groupsFor } from '../../../src/music/meter.js';
4
+ export { chordLabel, chordTones, closeVoicingTones, keyPrefersFlats, noteName, parseChord, rootlessVoicings, spellRoot, transposeChord, type Chord, type Quality, } from '../../../src/music/chords.js';
5
+ export { parseIrealLinks, unknownChords, type IrealPlaylist } from '../../../src/formats/ireal.js';
6
+ export { chartToIrealSong, chartToMusic, irealLink } from '../../../src/formats/irealWrite.js';
7
+ export { chartToFile, parseChartFile, validateChart } from '../../../src/formats/chartFile.js';
8
+ export { chartToChordPro } from '../../../src/formats/chordpro.js';
9
+ export { looksLikeChordPro, parseChordPro } from '../../../src/formats/chordproRead.js';
10
+ export { chartToMusicXml } from '../../../src/formats/musicxml.js';
11
+ export { looksLikeMusicXml, parseMusicXml } from '../../../src/formats/musicxmlRead.js';
12
+ export { mxlToXml } from '../../../src/formats/zip.js';
13
+ export { getStyle, STYLES } from '../../../src/styles/index.js';
14
+ export type { DrumName } from '../../../src/styles/drums.js';
15
+ export type { BassNote, BassPart, BassTone, ByChordLength, CompHit, CompPart, DrumHit, DrumPart, Groove, Position, StyleDefinition, StyleFamily, } from '../../../src/styles/types.js';
16
+ export { arrange, BASE_BPM, CHANNELS, type Arrangement, type Part } from '../../../src/engine/arrange.js';
17
+ export { buildTimeline, chorusKeyOffset, chorusTranspose, countInBeats, countInClicks, practiceOrder, slotAtBeat, type Bar, type Click, type CountInMode, type PracticeOptions, type Slot, type Timeline, } from '../../../src/engine/timeline.js';
@@ -0,0 +1,30 @@
1
+ import type { Chart } from '../music/chart.js';
2
+ import type { StyleDefinition } from '../styles/types.js';
3
+ import { type PracticeOptions, type Timeline } from './timeline.js';
4
+ export declare const PART_REVERB: {
5
+ readonly bass: 20;
6
+ readonly comp: 40;
7
+ readonly drums: 35;
8
+ readonly click: 0;
9
+ };
10
+ export declare const CHANNELS: {
11
+ readonly bass: 0;
12
+ readonly comp: 1;
13
+ readonly drums: 9;
14
+ readonly click: 3;
15
+ };
16
+ export type Part = keyof typeof CHANNELS;
17
+ export declare const BASE_BPM = 120;
18
+ export interface RampOptions {
19
+ bpm: number;
20
+ every: number;
21
+ }
22
+ export interface ArrangeOptions {
23
+ click?: boolean;
24
+ ramp?: RampOptions;
25
+ }
26
+ export interface Arrangement {
27
+ midi: Uint8Array;
28
+ timeline: Timeline;
29
+ }
30
+ export declare function arrange(chart: Chart, style: StyleDefinition, transpose: number, choruses: number, practice?: PracticeOptions, bpm?: number, options?: ArrangeOptions): Arrangement;
@@ -0,0 +1,5 @@
1
+ import type { BassPart, StyleFamily } from '../styles/types.js';
2
+ import { type NoteEvent } from './events.js';
3
+ import type { Slot } from './timeline.js';
4
+ export declare function generateBass(slots: Slot[], part: BassPart, swing: number, compound?: BassPart, family?: StyleFamily, firstChorus?: BassPart): NoteEvent[];
5
+ export declare const BASS_CHANNEL = 0;
@@ -0,0 +1,9 @@
1
+ import { type NoteEvent } from './events.js';
2
+ import { type Timeline } from './timeline.js';
3
+ export declare const CLICK_CHANNEL = 3;
4
+ export declare const CLICK_NOTES: {
5
+ readonly accent: 34;
6
+ readonly beat: 33;
7
+ };
8
+ /** Generates steady metronome clicks for every played bar after the count-in. */
9
+ export declare function generateClicks(timeline: Timeline): NoteEvent[];
@@ -0,0 +1,8 @@
1
+ import type { CompPart, StyleFamily } from '../styles/types.js';
2
+ import { type NoteEvent } from './events.js';
3
+ import type { Slot } from './timeline.js';
4
+ export declare function generateComp(slots: Slot[], part: CompPart, swing: number, countIn: number, compound?: CompPart, family?: StyleFamily, firstChorus?: CompPart): NoteEvent[];
5
+ export declare function pedalChanges(events: NoteEvent[], slots: Slot[]): {
6
+ tick: number;
7
+ value: number;
8
+ }[];
@@ -0,0 +1,5 @@
1
+ import type { DrumPart, StyleFamily } from '../styles/types.js';
2
+ import { type NoteEvent } from './events.js';
3
+ import type { Bar, Click } from './timeline.js';
4
+ export declare const DRUM_CHANNEL = 9;
5
+ export declare function generateDrums(bars: Bar[], part: DrumPart, swing: number, clicks: Click[], compound?: DrumPart, family?: StyleFamily, firstChorus?: DrumPart): NoteEvent[];
@@ -0,0 +1,15 @@
1
+ export declare const PPQ = 480;
2
+ export interface NoteEvent {
3
+ tick: number;
4
+ channel: number;
5
+ note: number;
6
+ velocity: number;
7
+ duration: number;
8
+ }
9
+ export declare const toTicks: (beats: number) => number;
10
+ export declare const rand: (min: number, max: number) => number;
11
+ export declare const chance: (p: number) => boolean;
12
+ export declare const pick: <T>(items: T[]) => T;
13
+ export declare const clampVelocity: (v: number) => number;
14
+ export declare function place(at: number, swing: number): number;
15
+ export declare function humanize(e: NoteEvent, timing: number, velocity: number): NoteEvent;
@@ -0,0 +1,8 @@
1
+ import type { PracticeOptions } from './timeline.js';
2
+ export declare function chorusTranspose(transpose: number, keyStep: number, chorus: number): number;
3
+ /**
4
+ * Returns the chorus transposition in semitones (-5..+6), supporting both fixed keyStep
5
+ * and seeded randomKeys (12 distinct keys per block, starting at 0, no consecutive repeat).
6
+ * With keyEvery > 1 each key lasts that many choruses.
7
+ */
8
+ export declare function chorusKeyOffset(practice: Pick<PracticeOptions, 'keyStep' | 'randomKeys' | 'keyEvery'>, chorus: number, transpose?: number): number;
@@ -0,0 +1,9 @@
1
+ export { isCompound } from '../music/chart.js';
2
+ export declare const PULSE = 1.5;
3
+ export declare function beatMap(source: number, target: number): number[];
4
+ export interface Timed {
5
+ at: number;
6
+ dur: number;
7
+ }
8
+ export declare function remap<T extends Timed>(pattern: T[], source: number, target: number): T[];
9
+ export declare function patternFor<T extends Timed>(patterns: Partial<Record<string, T[][]>>, length: number, compound: boolean, fallback: T): T[];
@@ -0,0 +1,25 @@
1
+ import { type NoteEvent } from './events.js';
2
+ export interface TrackSpec {
3
+ name: string;
4
+ channel: number;
5
+ program: number;
6
+ pan?: number;
7
+ reverb?: number;
8
+ drums?: boolean;
9
+ events: NoteEvent[];
10
+ pedal?: {
11
+ tick: number;
12
+ value: number;
13
+ }[];
14
+ }
15
+ export interface TempoChange {
16
+ tick: number;
17
+ bpm: number;
18
+ }
19
+ export interface ConductorEvent {
20
+ tick: number;
21
+ time?: [beats: number, unit: number];
22
+ lyric?: string;
23
+ marker?: string;
24
+ }
25
+ export declare function writeMidi(bpm: number, tracks: TrackSpec[], tempoChanges?: TempoChange[], conductor?: readonly ConductorEvent[]): Uint8Array;
@@ -0,0 +1,61 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ import { type Chord } from '../music/chords.js';
3
+ import { chorusKeyOffset, chorusTranspose } from './keyOrder.js';
4
+ export interface Click {
5
+ at: number;
6
+ count: number;
7
+ level: 'bar' | 'beat' | 'sub';
8
+ }
9
+ export type CountInMode = 'auto' | 'off' | 1 | 2;
10
+ /** Beat offsets within a bar (simple beats, compound dotted-quarter pulses, or aksak group starts). */
11
+ export declare function barBeatOffsets(beats: number, meter?: {
12
+ compound?: boolean;
13
+ groups?: readonly number[];
14
+ }): number[];
15
+ export declare function countInClicks(chart: Chart, mode?: CountInMode): Click[];
16
+ export declare function countInBeats(chart: Chart, mode?: CountInMode): number;
17
+ export interface Slot {
18
+ chord: Chord;
19
+ start: number;
20
+ beats: number;
21
+ measure: number;
22
+ chorus: number;
23
+ compound?: boolean;
24
+ groups?: number[];
25
+ barOffset?: number;
26
+ sub?: true;
27
+ }
28
+ export interface Bar {
29
+ start: number;
30
+ beats: number;
31
+ measure: number;
32
+ chorus: number;
33
+ isFirst: boolean;
34
+ isLast: boolean;
35
+ compound?: boolean;
36
+ groups?: number[];
37
+ }
38
+ export interface Timeline {
39
+ slots: Slot[];
40
+ bars: Bar[];
41
+ totalBeats: number;
42
+ countIn: number;
43
+ clicks: Click[];
44
+ }
45
+ export type SubMode = 'off' | 'alternate' | 'random';
46
+ export interface PracticeOptions {
47
+ loop?: [from: number, to: number] | null;
48
+ keyStep?: number;
49
+ randomKeys?: {
50
+ seed: number;
51
+ };
52
+ keyEvery?: number;
53
+ subs?: SubMode;
54
+ substitutionSeed?: number;
55
+ countIn?: CountInMode;
56
+ }
57
+ export declare function shouldUseSubstitution(subs: SubMode, chorus: number, measure: number, chordIndex: number, seed?: number): boolean;
58
+ export { chorusKeyOffset, chorusTranspose };
59
+ export declare function practiceOrder(chart: Chart, loop: PracticeOptions['loop']): number[];
60
+ export declare function buildTimeline(chart: Chart, transpose: number, choruses: number, practice?: PracticeOptions): Timeline;
61
+ export declare function slotAtBeat(timeline: Timeline, beat: number): Slot | undefined;
@@ -0,0 +1,4 @@
1
+ import type { Chart } from '../music/chart.js';
2
+ export declare function validateChart(data: unknown): Chart;
3
+ export declare function chartToFile(chart: Chart): string;
4
+ export declare function parseChartFile(text: string): Chart;
@@ -0,0 +1,2 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ export declare function chartToChordPro(chart: Chart, transpose?: number): string;
@@ -0,0 +1,4 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ /** Whether a text looks like ChordPro: a known directive or chords in square brackets. */
3
+ export declare function looksLikeChordPro(text: string): boolean;
4
+ export declare function parseChordPro(text: string): Chart;
@@ -0,0 +1,24 @@
1
+ import { type BarChord, type Chart, type ChartBar, type TimeSignature } from '../music/chart.js';
2
+ export interface IrealPlaylist {
3
+ name: string;
4
+ charts: Chart[];
5
+ }
6
+ export declare const MUSIC_PREFIX = "1r34LbKcu7";
7
+ export declare function pitchClass(name: string): number | null;
8
+ export declare function mapStyle(name: string, time?: TimeSignature): string;
9
+ export declare function swapBlocks(s: string): string;
10
+ export declare function unscramble(s: string): string;
11
+ export declare function normalizeChord(symbol: string): string;
12
+ interface Cell {
13
+ chord?: string | null;
14
+ alt?: string;
15
+ small?: boolean;
16
+ }
17
+ export declare function parseMusic(music: string, time: TimeSignature): {
18
+ bars: ChartBar[];
19
+ time: TimeSignature;
20
+ };
21
+ export declare function durations(cells: Cell[], time: TimeSignature): BarChord[];
22
+ export declare function parseIrealLinks(input: string): IrealPlaylist[];
23
+ export declare function unknownChords(chart: Chart): string[];
24
+ export {};
@@ -0,0 +1,4 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ export declare function chartToMusic(chart: Chart): string;
3
+ export declare function chartToIrealSong(chart: Chart): string;
4
+ export declare function irealLink(charts: Chart[], playlist?: string): string;
@@ -0,0 +1,2 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ export declare function chartToMusicXml(chart: Chart, transpose?: number): string;
@@ -0,0 +1,20 @@
1
+ export interface PitchSpec {
2
+ step: string;
3
+ alter?: number;
4
+ }
5
+ export interface DegreeSpec {
6
+ value: number;
7
+ alter: number;
8
+ type: 'add' | 'alter';
9
+ }
10
+ export interface HarmonySpec {
11
+ root: PitchSpec;
12
+ kind: string;
13
+ text?: string;
14
+ bass?: PitchSpec;
15
+ degrees: DegreeSpec[];
16
+ }
17
+ export declare function escapeXml(text: string): string;
18
+ export declare function pitchSpec(pc: number, keyPc: number): PitchSpec;
19
+ export declare function chordToHarmony(symbol: string | null, keyPc: number, transpose: number): HarmonySpec;
20
+ export declare function renderHarmonyXml(h: HarmonySpec, indent: string): string[];
@@ -0,0 +1,9 @@
1
+ import { type Chart } from '../music/chart.js';
2
+ import { type XmlElement } from './xml.js';
3
+ export declare function looksLikeMusicXml(text: string): boolean;
4
+ /** A <harmony> as a chord symbol in chart notation; null for N.C.; undefined if unreadable. */
5
+ export declare function harmonyToSymbol(h: XmlElement, key?: {
6
+ key: number;
7
+ minor: boolean;
8
+ } | null): string | null | undefined;
9
+ export declare function parseMusicXml(text: string): Chart;
@@ -0,0 +1,17 @@
1
+ export interface XmlElement {
2
+ name: string;
3
+ attrs: Record<string, string>;
4
+ children: XmlNode[];
5
+ }
6
+ export type XmlNode = XmlElement | string;
7
+ export declare function decodeEntities(text: string): string;
8
+ /** Parse an XML document and return its root element. Throws on text that has no root element. */
9
+ export declare function parseXml(text: string): XmlElement;
10
+ /** Child elements, optionally only those with a name. */
11
+ export declare function kids(el: XmlElement | undefined, name?: string): XmlElement[];
12
+ /** The first child element with this name (or along a path of names). */
13
+ export declare function child(el: XmlElement | undefined, ...path: string[]): XmlElement | undefined;
14
+ /** All text inside an element, trimmed. */
15
+ export declare function textOf(el: XmlElement | undefined): string;
16
+ /** Text of a child element (or path), trimmed; '' when missing. */
17
+ export declare function childText(el: XmlElement | undefined, ...path: string[]): string;
@@ -0,0 +1,10 @@
1
+ export interface ZipEntry {
2
+ name: string;
3
+ method: number;
4
+ compressedSize: number;
5
+ offset: number;
6
+ }
7
+ export declare function zipEntries(bytes: Uint8Array): ZipEntry[];
8
+ export declare function readZipEntry(bytes: Uint8Array, entry: ZipEntry): Promise<Uint8Array>;
9
+ /** The MusicXML score inside a compressed .mxl file, as text. */
10
+ export declare function mxlToXml(bytes: Uint8Array): Promise<string>;
@@ -0,0 +1,50 @@
1
+ export type TimeSignature = [beats: number, unit: number];
2
+ export interface BarChord {
3
+ symbol: string | null;
4
+ alt?: string;
5
+ beats: number;
6
+ small?: true;
7
+ }
8
+ export interface ChartBar {
9
+ chords: BarChord[];
10
+ cells: number;
11
+ rowStart?: boolean;
12
+ section?: string;
13
+ time?: TimeSignature;
14
+ groups?: number[];
15
+ repeatStart?: boolean;
16
+ repeatEnd?: boolean;
17
+ repeatTimes?: number;
18
+ ending?: number;
19
+ barline?: 'double' | 'final';
20
+ segno?: boolean;
21
+ coda?: boolean;
22
+ fermata?: boolean;
23
+ directive?: string;
24
+ comment?: string;
25
+ lyrics?: string;
26
+ end?: boolean;
27
+ spacer?: boolean;
28
+ }
29
+ export interface Chart {
30
+ format: 'openstand-chart';
31
+ version: 1;
32
+ title: string;
33
+ composer?: string;
34
+ style: string;
35
+ sourceStyle?: string;
36
+ key: number;
37
+ minor?: boolean;
38
+ bpm: number;
39
+ time: TimeSignature;
40
+ groups?: number[];
41
+ bars: ChartBar[];
42
+ }
43
+ export declare const ROW_CELLS = 16;
44
+ export declare function beatsPerBar([beats, unit]: TimeSignature): number;
45
+ export declare function isCompound([beats, unit]: TimeSignature): boolean;
46
+ export declare function evenSplit(count: number, time: TimeSignature): number[];
47
+ export declare function chartFromMeasures(meta: Omit<Chart, 'format' | 'version' | 'bars' | 'time'> & {
48
+ time?: TimeSignature;
49
+ }, measures: string[][]): Chart;
50
+ export declare function playbackOrder(chart: Chart): number[];
@@ -0,0 +1,24 @@
1
+ export type Quality = 'maj' | 'maj7' | 'maj6' | 'dom7' | 'sus7' | 'min' | 'min7' | 'min6' | 'minMaj7' | 'half' | 'dim7' | 'aug' | 'power' | 'sus2' | 'dimMaj7' | 'maj7sus' | 'augMaj7';
2
+ export interface Chord {
3
+ root: number;
4
+ bass: number;
5
+ quality: Quality;
6
+ tensions: string[];
7
+ suffix: string;
8
+ }
9
+ export declare function parseChord(symbol: string): Chord | null;
10
+ export declare function noteName(pc: number, preferFlats: boolean): string;
11
+ export declare function keyPrefersFlats(keyPc: number): boolean;
12
+ export declare function transposeChord(chord: Chord, semitones: number): Chord;
13
+ export declare function chordLabel(chord: Chord, preferFlats: boolean): string;
14
+ export declare function chordTones(chord: Chord): number[];
15
+ export declare function rootlessVoicings(chord: Chord): [number[], number[]];
16
+ export declare function closeVoicingTones(chord: Chord): number[];
17
+ export declare function spellRoot(pc: number, keyPc: number): string;
18
+ export declare function chordKey(chord: Chord): string;
19
+ export declare function chordSpellLabel(chord: Chord, keyPc: number): string;
20
+ export declare function chordToneData(chord: Chord): {
21
+ preferFlats: boolean;
22
+ toneNames: string[];
23
+ chordKeys: Set<number>;
24
+ };
@@ -0,0 +1,20 @@
1
+ import { type Chart, type ChartBar, type TimeSignature } from './chart.js';
2
+ export declare function emptyChart(): Chart;
3
+ export declare function timeAt(chart: Chart, index: number): TimeSignature;
4
+ export declare function groupsAt(chart: Chart, index: number): number[] | undefined;
5
+ export declare function updateBar(chart: Chart, index: number, patch: Partial<ChartBar>): Chart;
6
+ export declare function insertBar(chart: Chart, index: number): Chart;
7
+ export declare function deleteBar(chart: Chart, index: number): Chart;
8
+ export declare function setTime(chart: Chart, time: TimeSignature): Chart;
9
+ /** Set or clear (undefined) the chart-level eighth-note grouping. */
10
+ export declare function setGroups(chart: Chart, groups: number[] | undefined): Chart;
11
+ /** Change the time signature at `index` (for just that bar or from there on), respreading affected chords. */
12
+ export declare function setBarTime(chart: Chart, index: number, time: TimeSignature | null, onlyThisBar: boolean): Chart;
13
+ /** Change the eighth-note grouping at `index` (for just that bar or from there on). */
14
+ export declare function setBarGroups(chart: Chart, index: number, groups: number[] | undefined, onlyThisBar: boolean): Chart;
15
+ /** Deep-copy bars in the inclusive `[from, to]` range (supports reversed `from > to`). */
16
+ export declare function copyBars(chart: Chart, from: number, to: number): ChartBar[];
17
+ /** Paste `bars` starting at `at`, overwriting existing bars and extending the chart if needed. */
18
+ export declare function pasteBars(chart: Chart, at: number, bars: ChartBar[]): Chart;
19
+ /** Empty bars in `[from, to]`, keeping bar count, layout row starts, and the closing final barline. */
20
+ export declare function clearBars(chart: Chart, from: number, to: number): Chart;
@@ -0,0 +1,17 @@
1
+ import { type Chord } from './chords.js';
2
+ export declare const TUNING: readonly [4, 9, 2, 7, 11, 4];
3
+ export declare const UKULELE_TUNING: readonly [7, 0, 4, 9];
4
+ export interface FretShape {
5
+ frets: (number | null)[];
6
+ baseFret: number;
7
+ }
8
+ export interface FretInstrument {
9
+ tuning: readonly number[];
10
+ midi: readonly number[];
11
+ reentrant?: boolean;
12
+ }
13
+ export declare const GUITAR_INSTRUMENT: FretInstrument;
14
+ export declare const UKULELE_INSTRUMENT: FretInstrument;
15
+ export declare function fretShapes(chord: Chord, instrument: FretInstrument): [FretShape, FretShape];
16
+ export declare function guitarShapes(chord: Chord): [FretShape, FretShape];
17
+ export declare function ukuleleShapes(chord: Chord): [FretShape, FretShape];
@@ -0,0 +1,13 @@
1
+ import { type TimeSignature } from './chart.js';
2
+ export interface GroupingPreset {
3
+ label: string;
4
+ groups?: number[];
5
+ }
6
+ export declare function isValidGroups(time: TimeSignature, groups: unknown): groups is number[];
7
+ /**
8
+ * Effective eighth-note beat grouping for a meter, or undefined when the meter
9
+ * uses simple or compound (dotted-quarter) feel instead.
10
+ */
11
+ export declare function groupsFor(time: TimeSignature, groups?: readonly number[]): number[] | undefined;
12
+ export declare function groupingOptions(time: TimeSignature): GroupingPreset[];
13
+ export declare function sameGroups(a?: readonly number[], b?: readonly number[]): boolean;
@@ -0,0 +1,13 @@
1
+ import { type BarChord, type TimeSignature } from './chart.js';
2
+ export declare function toChartSymbol(input: string): string | null;
3
+ export type BarInput = {
4
+ ok: true;
5
+ chords: BarChord[];
6
+ } | {
7
+ ok: false;
8
+ error: string;
9
+ };
10
+ export declare function parseBarInput(text: string, time: TimeSignature): BarInput;
11
+ /** Keeps `small: true` on edited chords whose symbol at the same index matches the previous bar. */
12
+ export declare function preserveSmall(next: BarChord[], previous: readonly BarChord[]): BarChord[];
13
+ export declare function barToInput(chords: BarChord[], time: TimeSignature): string;
@@ -0,0 +1,12 @@
1
+ import type { BassNote, CompHit, DrumHit, StyleFamily } from './types.js';
2
+ /** Group start positions within a bar, in quarter-note beats. */
3
+ export declare function groupStarts(groups: readonly number[]): number[];
4
+ /** Drum pattern for a grouped bar, keyed by style family and bar position. */
5
+ export declare function aksakDrums(groups: readonly number[], family: StyleFamily, pos?: {
6
+ isFirst?: boolean;
7
+ isLast?: boolean;
8
+ }): DrumHit[];
9
+ /** Bass line on group starts, clipped to [barOffset, barOffset + spanBeats). */
10
+ export declare function aksakBass(groups: readonly number[], _family: StyleFamily, barOffset?: number, spanBeats?: number): BassNote[];
11
+ /** Short comping chords on group starts, clipped to [barOffset, barOffset + spanBeats). */
12
+ export declare function aksakComp(groups: readonly number[], family: StyleFamily, barOffset?: number, spanBeats?: number): CompHit[];
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from './types.js';
2
+ export declare function compoundStyle(style: StyleDefinition): StyleDefinition;
@@ -0,0 +1,33 @@
1
+ export declare const DRUM_NOTES: {
2
+ readonly kick: 36;
3
+ readonly sidestick: 37;
4
+ readonly snare: 38;
5
+ readonly clap: 39;
6
+ readonly snare2: 40;
7
+ readonly tomLow: 45;
8
+ readonly hhClosed: 42;
9
+ readonly hhPedal: 44;
10
+ readonly hhOpen: 46;
11
+ readonly tomMid: 47;
12
+ readonly tomHigh: 50;
13
+ readonly crash: 49;
14
+ readonly ride: 51;
15
+ readonly rideBell: 53;
16
+ readonly tambourine: 54;
17
+ readonly cowbell: 56;
18
+ readonly bongoHigh: 60;
19
+ readonly bongoLow: 61;
20
+ readonly congaMute: 62;
21
+ readonly congaHigh: 63;
22
+ readonly congaLow: 64;
23
+ readonly timbaleHigh: 65;
24
+ readonly timbaleLow: 66;
25
+ readonly cabasa: 69;
26
+ readonly shaker: 70;
27
+ readonly guiroShort: 73;
28
+ readonly guiroLong: 74;
29
+ readonly claves: 75;
30
+ readonly triangleMute: 80;
31
+ readonly triangleOpen: 81;
32
+ };
33
+ export type DrumName = keyof typeof DRUM_NOTES;
@@ -0,0 +1,4 @@
1
+ import type { StyleDefinition } from './types.js';
2
+ export declare const STYLES: StyleDefinition[];
3
+ export declare function getStyle(id: string): StyleDefinition;
4
+ export type { StyleDefinition } from './types.js';
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const afroCuban: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const aksak: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const bachata: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const baiao: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const ballad: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const bluegrass: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const bolero: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const bossaNova: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const calypso: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const chaCha: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const choro: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const country: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const cumbia: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const disco: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const evenEighths: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const funk: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const gospel: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const gypsyJazz: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const hipHop: StyleDefinition;
@@ -0,0 +1,2 @@
1
+ import type { StyleDefinition } from '../types.js';
2
+ export declare const jazzWaltz: StyleDefinition;