musicxml-io 0.7.1 → 0.7.2
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/dist/{chunk-F6GPX6VW.js → chunk-CHMV7XWY.js} +259 -83
- package/dist/{chunk-67F7TX3I.mjs → chunk-IM3FS32Q.mjs} +1 -1
- package/dist/{chunk-HQEOMBJX.js → chunk-S5MWUJU2.js} +23 -23
- package/dist/{chunk-MA2TPIIG.mjs → chunk-VQUFSGB5.mjs} +191 -15
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +160 -156
- package/dist/index.mjs +42 -38
- package/dist/operations/index.js +3 -3
- package/dist/operations/index.mjs +2 -2
- package/dist/query/index.d.mts +53 -2
- package/dist/query/index.d.ts +53 -2
- package/dist/query/index.js +2 -2
- package/dist/query/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -127,10 +127,11 @@ import {
|
|
|
127
127
|
validateTiesAcrossMeasures,
|
|
128
128
|
validateTuplets,
|
|
129
129
|
validateVoiceStaff
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-IM3FS32Q.mjs";
|
|
131
131
|
import {
|
|
132
132
|
STEPS,
|
|
133
133
|
STEP_SEMITONES,
|
|
134
|
+
bpmToUsPerQuarter,
|
|
134
135
|
buildGridTimeline,
|
|
135
136
|
buildTimingSidecar,
|
|
136
137
|
buildVoiceToStaffMap,
|
|
@@ -217,7 +218,7 @@ import {
|
|
|
217
218
|
pitchToSemitone,
|
|
218
219
|
scoresEqual,
|
|
219
220
|
withAbsolutePositions
|
|
220
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-VQUFSGB5.mjs";
|
|
221
222
|
|
|
222
223
|
// src/importers/musicxml.ts
|
|
223
224
|
import { parse as txmlParse } from "txml";
|
|
@@ -6510,7 +6511,13 @@ function buildMidiTracks(score, options) {
|
|
|
6510
6511
|
const tracks = [];
|
|
6511
6512
|
const sequence = generatePlaybackSequence(score);
|
|
6512
6513
|
const measureOrder = sequence.map((m) => m.measureIndex);
|
|
6513
|
-
const grid = buildGridTimeline(score, ticksPerQuarterNote, sequence
|
|
6514
|
+
const grid = buildGridTimeline(score, ticksPerQuarterNote, sequence, {
|
|
6515
|
+
defaultTempo,
|
|
6516
|
+
fermataHoldMultiplier: options.fermataHoldMultiplier,
|
|
6517
|
+
caesuraSeconds: options.caesuraSeconds,
|
|
6518
|
+
breathSeconds: options.breathSeconds,
|
|
6519
|
+
tempoRampSteps: options.tempoRampSteps
|
|
6520
|
+
});
|
|
6514
6521
|
tracks.push(createConductorTrack(score, defaultTempo, grid));
|
|
6515
6522
|
const scoreParts = score.partList.filter((entry) => entry.type === "score-part");
|
|
6516
6523
|
for (let partIndex = 0; partIndex < score.parts.length; partIndex++) {
|
|
@@ -6550,48 +6557,45 @@ function pitchToMidiNote(pitch, chromaticTranspose = 0) {
|
|
|
6550
6557
|
return baseMidi + chromaticTranspose;
|
|
6551
6558
|
}
|
|
6552
6559
|
function createConductorTrack(score, defaultTempo, grid) {
|
|
6553
|
-
const
|
|
6554
|
-
const
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
const pushTempo = (deltaTick, bpm) => {
|
|
6558
|
-
const usPerQuarter = Math.round(6e7 / bpm);
|
|
6559
|
-
events.push(
|
|
6560
|
-
...writeVariableLength(deltaTick),
|
|
6561
|
-
255,
|
|
6562
|
-
81,
|
|
6563
|
-
3,
|
|
6564
|
-
usPerQuarter >> 16 & 255,
|
|
6565
|
-
usPerQuarter >> 8 & 255,
|
|
6566
|
-
usPerQuarter & 255
|
|
6567
|
-
);
|
|
6560
|
+
const metaEvents = [];
|
|
6561
|
+
const tempoBytes = (bpm) => {
|
|
6562
|
+
const us = bpmToUsPerQuarter(bpm);
|
|
6563
|
+
return [255, 81, 3, us >> 16 & 255, us >> 8 & 255, us & 255];
|
|
6568
6564
|
};
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6565
|
+
const tempoEvents = [...grid.tempoEvents].sort((a, b) => a.tick - b.tick);
|
|
6566
|
+
const startBpm = tempoEvents.length > 0 && tempoEvents[0].tick === 0 ? tempoEvents[0].bpm : defaultTempo;
|
|
6567
|
+
metaEvents.push({ tick: 0, order: 0, bytes: tempoBytes(startBpm) });
|
|
6568
|
+
let lastBpm = startBpm;
|
|
6569
|
+
for (const ev of tempoEvents) {
|
|
6570
|
+
if (ev.tick === 0) continue;
|
|
6571
|
+
if (ev.bpm === lastBpm) continue;
|
|
6572
|
+
metaEvents.push({ tick: ev.tick, order: 0, bytes: tempoBytes(ev.bpm) });
|
|
6573
|
+
lastBpm = ev.bpm;
|
|
6574
|
+
}
|
|
6575
|
+
const part = score.parts.length > 0 ? score.parts[0] : void 0;
|
|
6576
|
+
if (part) {
|
|
6577
|
+
let lastSig = null;
|
|
6578
|
+
for (const m of grid.measures) {
|
|
6579
|
+
const time = part.measures[m.measureIndex]?.attributes?.time;
|
|
6580
|
+
if (!time) continue;
|
|
6573
6581
|
const numerator = parseInt(time.beats, 10) || 4;
|
|
6574
6582
|
const denominator = Math.log2(time.beatType);
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
denominator,
|
|
6582
|
-
|
|
6583
|
-
8
|
|
6584
|
-
);
|
|
6583
|
+
const sig = `${numerator}/${denominator}`;
|
|
6584
|
+
if (sig === lastSig) continue;
|
|
6585
|
+
lastSig = sig;
|
|
6586
|
+
metaEvents.push({
|
|
6587
|
+
tick: m.startTick,
|
|
6588
|
+
order: 1,
|
|
6589
|
+
bytes: [255, 88, 4, numerator, denominator, 24, 8]
|
|
6590
|
+
});
|
|
6585
6591
|
}
|
|
6586
6592
|
}
|
|
6593
|
+
metaEvents.sort((a, b) => a.tick - b.tick || a.order - b.order);
|
|
6594
|
+
const events = [];
|
|
6587
6595
|
let lastTick = 0;
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
if (ev.tick === 0) continue;
|
|
6591
|
-
if (ev.bpm === lastBpm) continue;
|
|
6592
|
-
pushTempo(ev.tick - lastTick, ev.bpm);
|
|
6596
|
+
for (const ev of metaEvents) {
|
|
6597
|
+
events.push(...writeVariableLength(ev.tick - lastTick), ...ev.bytes);
|
|
6593
6598
|
lastTick = ev.tick;
|
|
6594
|
-
lastBpm = ev.bpm;
|
|
6595
6599
|
}
|
|
6596
6600
|
events.push(...writeVariableLength(0), 255, 47, 0);
|
|
6597
6601
|
return new Uint8Array(events);
|
package/dist/operations/index.js
CHANGED
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
var
|
|
109
|
-
require('../chunk-
|
|
108
|
+
var _chunkS5MWUJU2js = require('../chunk-S5MWUJU2.js');
|
|
109
|
+
require('../chunk-CHMV7XWY.js');
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
@@ -214,4 +214,4 @@ require('../chunk-F6GPX6VW.js');
|
|
|
214
214
|
|
|
215
215
|
|
|
216
216
|
|
|
217
|
-
exports.addArticulation =
|
|
217
|
+
exports.addArticulation = _chunkS5MWUJU2js.addArticulation; exports.addBeam = _chunkS5MWUJU2js.addBeam; exports.addBowing = _chunkS5MWUJU2js.addBowing; exports.addBreathMark = _chunkS5MWUJU2js.addBreathMark; exports.addCaesura = _chunkS5MWUJU2js.addCaesura; exports.addChord = _chunkS5MWUJU2js.addChord; exports.addChordNote = _chunkS5MWUJU2js.addChordNote; exports.addChordNoteChecked = _chunkS5MWUJU2js.addChordNoteChecked; exports.addChordSymbol = _chunkS5MWUJU2js.addChordSymbol; exports.addCoda = _chunkS5MWUJU2js.addCoda; exports.addDaCapo = _chunkS5MWUJU2js.addDaCapo; exports.addDalSegno = _chunkS5MWUJU2js.addDalSegno; exports.addDynamics = _chunkS5MWUJU2js.addDynamics; exports.addEnding = _chunkS5MWUJU2js.addEnding; exports.addFermata = _chunkS5MWUJU2js.addFermata; exports.addFine = _chunkS5MWUJU2js.addFine; exports.addFingering = _chunkS5MWUJU2js.addFingering; exports.addGraceNote = _chunkS5MWUJU2js.addGraceNote; exports.addHarmony = _chunkS5MWUJU2js.addHarmony; exports.addLyric = _chunkS5MWUJU2js.addLyric; exports.addNote = _chunkS5MWUJU2js.addNote; exports.addNoteChecked = _chunkS5MWUJU2js.addNoteChecked; exports.addOctaveShift = _chunkS5MWUJU2js.addOctaveShift; exports.addOrnament = _chunkS5MWUJU2js.addOrnament; exports.addPart = _chunkS5MWUJU2js.addPart; exports.addPedal = _chunkS5MWUJU2js.addPedal; exports.addRehearsalMark = _chunkS5MWUJU2js.addRehearsalMark; exports.addRepeat = _chunkS5MWUJU2js.addRepeat; exports.addRepeatBarline = _chunkS5MWUJU2js.addRepeatBarline; exports.addSegno = _chunkS5MWUJU2js.addSegno; exports.addSlur = _chunkS5MWUJU2js.addSlur; exports.addStringNumber = _chunkS5MWUJU2js.addStringNumber; exports.addTempo = _chunkS5MWUJU2js.addTempo; exports.addText = _chunkS5MWUJU2js.addText; exports.addTextDirection = _chunkS5MWUJU2js.addTextDirection; exports.addTie = _chunkS5MWUJU2js.addTie; exports.addToCoda = _chunkS5MWUJU2js.addToCoda; exports.addVoice = _chunkS5MWUJU2js.addVoice; exports.addWedge = _chunkS5MWUJU2js.addWedge; exports.autoBeam = _chunkS5MWUJU2js.autoBeam; exports.changeBarline = _chunkS5MWUJU2js.changeBarline; exports.changeClef = _chunkS5MWUJU2js.changeClef; exports.changeKey = _chunkS5MWUJU2js.changeKey; exports.changeNoteDuration = _chunkS5MWUJU2js.changeNoteDuration; exports.changeTime = _chunkS5MWUJU2js.changeTime; exports.convertToGrace = _chunkS5MWUJU2js.convertToGrace; exports.copyNotes = _chunkS5MWUJU2js.copyNotes; exports.copyNotesMultiMeasure = _chunkS5MWUJU2js.copyNotesMultiMeasure; exports.createTuplet = _chunkS5MWUJU2js.createTuplet; exports.cutNotes = _chunkS5MWUJU2js.cutNotes; exports.deleteMeasure = _chunkS5MWUJU2js.deleteMeasure; exports.deleteNote = _chunkS5MWUJU2js.deleteNote; exports.deleteNoteChecked = _chunkS5MWUJU2js.deleteNoteChecked; exports.duplicatePart = _chunkS5MWUJU2js.duplicatePart; exports.insertClefChange = _chunkS5MWUJU2js.insertClefChange; exports.insertMeasure = _chunkS5MWUJU2js.insertMeasure; exports.insertNote = _chunkS5MWUJU2js.insertNote; exports.lowerAccidental = _chunkS5MWUJU2js.lowerAccidental; exports.modifyDynamics = _chunkS5MWUJU2js.modifyDynamics; exports.modifyNoteDuration = _chunkS5MWUJU2js.modifyNoteDuration; exports.modifyNoteDurationChecked = _chunkS5MWUJU2js.modifyNoteDurationChecked; exports.modifyNotePitch = _chunkS5MWUJU2js.modifyNotePitch; exports.modifyNotePitchChecked = _chunkS5MWUJU2js.modifyNotePitchChecked; exports.modifyTempo = _chunkS5MWUJU2js.modifyTempo; exports.moveNoteToStaff = _chunkS5MWUJU2js.moveNoteToStaff; exports.pasteNotes = _chunkS5MWUJU2js.pasteNotes; exports.pasteNotesMultiMeasure = _chunkS5MWUJU2js.pasteNotesMultiMeasure; exports.raiseAccidental = _chunkS5MWUJU2js.raiseAccidental; exports.removeArticulation = _chunkS5MWUJU2js.removeArticulation; exports.removeBeam = _chunkS5MWUJU2js.removeBeam; exports.removeBowing = _chunkS5MWUJU2js.removeBowing; exports.removeBreathMark = _chunkS5MWUJU2js.removeBreathMark; exports.removeCaesura = _chunkS5MWUJU2js.removeCaesura; exports.removeChordSymbol = _chunkS5MWUJU2js.removeChordSymbol; exports.removeDynamics = _chunkS5MWUJU2js.removeDynamics; exports.removeEnding = _chunkS5MWUJU2js.removeEnding; exports.removeFermata = _chunkS5MWUJU2js.removeFermata; exports.removeFingering = _chunkS5MWUJU2js.removeFingering; exports.removeGraceNote = _chunkS5MWUJU2js.removeGraceNote; exports.removeHarmony = _chunkS5MWUJU2js.removeHarmony; exports.removeLyric = _chunkS5MWUJU2js.removeLyric; exports.removeNote = _chunkS5MWUJU2js.removeNote; exports.removeOctaveShift = _chunkS5MWUJU2js.removeOctaveShift; exports.removeOrnament = _chunkS5MWUJU2js.removeOrnament; exports.removePart = _chunkS5MWUJU2js.removePart; exports.removePedal = _chunkS5MWUJU2js.removePedal; exports.removeRepeat = _chunkS5MWUJU2js.removeRepeat; exports.removeRepeatBarline = _chunkS5MWUJU2js.removeRepeatBarline; exports.removeSlur = _chunkS5MWUJU2js.removeSlur; exports.removeStringNumber = _chunkS5MWUJU2js.removeStringNumber; exports.removeTempo = _chunkS5MWUJU2js.removeTempo; exports.removeTie = _chunkS5MWUJU2js.removeTie; exports.removeTuplet = _chunkS5MWUJU2js.removeTuplet; exports.removeWedge = _chunkS5MWUJU2js.removeWedge; exports.setBarline = _chunkS5MWUJU2js.setBarline; exports.setBeaming = _chunkS5MWUJU2js.setBeaming; exports.setNotePitch = _chunkS5MWUJU2js.setNotePitch; exports.setNotePitchBySemitone = _chunkS5MWUJU2js.setNotePitchBySemitone; exports.setStaves = _chunkS5MWUJU2js.setStaves; exports.shiftNotePitch = _chunkS5MWUJU2js.shiftNotePitch; exports.stopOctaveShift = _chunkS5MWUJU2js.stopOctaveShift; exports.transpose = _chunkS5MWUJU2js.transpose; exports.transposeChecked = _chunkS5MWUJU2js.transposeChecked; exports.updateChordSymbol = _chunkS5MWUJU2js.updateChordSymbol; exports.updateHarmony = _chunkS5MWUJU2js.updateHarmony; exports.updateLyric = _chunkS5MWUJU2js.updateLyric;
|
|
@@ -105,8 +105,8 @@ import {
|
|
|
105
105
|
updateChordSymbol,
|
|
106
106
|
updateHarmony,
|
|
107
107
|
updateLyric
|
|
108
|
-
} from "../chunk-
|
|
109
|
-
import "../chunk-
|
|
108
|
+
} from "../chunk-IM3FS32Q.mjs";
|
|
109
|
+
import "../chunk-VQUFSGB5.mjs";
|
|
110
110
|
export {
|
|
111
111
|
addArticulation,
|
|
112
112
|
addBeam,
|
package/dist/query/index.d.mts
CHANGED
|
@@ -17,8 +17,42 @@ import { S as Score, f as Part, M as Measure, N as NoteEntry, V as VoiceGroup, q
|
|
|
17
17
|
* which shares this exact timeline computation.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Expressive-timing options shared by the MIDI exporter and the timeline query.
|
|
22
|
+
*
|
|
23
|
+
* These shape the TEMPO map only — never note durations. The whole module
|
|
24
|
+
* follows "method A": notated tick lengths (and therefore `quarterPos`) are the
|
|
25
|
+
* score's, and every expressive change in elapsed time is carried by tempo
|
|
26
|
+
* (`set_tempo`). This keeps `tick ÷ tpqn` exactly equal to the musical quarter
|
|
27
|
+
* position so the sidecar maps with zero drift.
|
|
28
|
+
*/
|
|
29
|
+
interface ExpressionOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Fermata hold factor: a fermata note/rest's tick span is stretched in
|
|
32
|
+
* elapsed time by this factor by dividing the prevailing BPM over the span
|
|
33
|
+
* (e.g. 2 → the span plays at half BPM, lasting twice as long). The note's
|
|
34
|
+
* tick length and `quarterPos` are unchanged. `1` disables. Default `1.75`.
|
|
35
|
+
*/
|
|
36
|
+
fermataHoldMultiplier?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Seconds of extra time a caesura ("railroad tracks") inserts, modelled as a
|
|
39
|
+
* tempo dip over the tail of the note carrying it (no tick is added).
|
|
40
|
+
* Default `0.4`. `0` disables.
|
|
41
|
+
*/
|
|
42
|
+
caesuraSeconds?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Seconds of extra time a breath mark inserts, modelled like a caesura but
|
|
45
|
+
* shorter. Default `0.25`. `0` disables.
|
|
46
|
+
*/
|
|
47
|
+
breathSeconds?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Number of discrete `set_tempo` steps used to approximate a rit./accel.
|
|
50
|
+
* tempo ramp between two tempo anchors. Higher = smoother. Default `12`.
|
|
51
|
+
*/
|
|
52
|
+
tempoRampSteps?: number;
|
|
53
|
+
}
|
|
20
54
|
/** Options controlling the rendered timeline. */
|
|
21
|
-
interface TimingMapOptions {
|
|
55
|
+
interface TimingMapOptions extends ExpressionOptions {
|
|
22
56
|
/**
|
|
23
57
|
* Ticks per quarter note (default: 480). Only affects internal tick rounding;
|
|
24
58
|
* `midiSec`/`quarterPos` are otherwise independent of it.
|
|
@@ -63,6 +97,23 @@ interface TimingSidecar {
|
|
|
63
97
|
ticksPerQuarterNote: number;
|
|
64
98
|
/** Breakpoints, sorted ascending and monotone by `midiSec`. */
|
|
65
99
|
breakpoints: TimingBreakpoint[];
|
|
100
|
+
/**
|
|
101
|
+
* Expressive-timing regions (fermatas, caesuras, breaths, rit./accel.). An
|
|
102
|
+
* aligner can relax its time constraints inside these spans, since the human
|
|
103
|
+
* performance is free to depart most from the grid there. Sorted by
|
|
104
|
+
* `fromMidiSec`. Omitted entirely when there are none.
|
|
105
|
+
*/
|
|
106
|
+
expressions?: ExpressionHint[];
|
|
107
|
+
}
|
|
108
|
+
/** The kind of expressive timing a span represents. */
|
|
109
|
+
type ExpressionKind = 'fermata' | 'caesura' | 'breath' | 'rit' | 'accel';
|
|
110
|
+
/** A time region (in MIDI seconds) carrying expressive tempo change. */
|
|
111
|
+
interface ExpressionHint {
|
|
112
|
+
type: ExpressionKind;
|
|
113
|
+
/** Start of the region in MIDI seconds. */
|
|
114
|
+
fromMidiSec: number;
|
|
115
|
+
/** End of the region in MIDI seconds. */
|
|
116
|
+
toMidiSec: number;
|
|
66
117
|
}
|
|
67
118
|
/**
|
|
68
119
|
* Generate the playback timeline (MIDI seconds ↔ conceptual musical position)
|
|
@@ -619,4 +670,4 @@ declare function countNotes(score: Score): number;
|
|
|
619
670
|
*/
|
|
620
671
|
declare function scoresEqual(a: Score, b: Score): boolean;
|
|
621
672
|
|
|
622
|
-
export { type FindNotesFilter, type NormalizedPositionOptions, type PitchRange, type PlaybackControls, type PlaybackMeasure, type RoundtripMetrics, type TimingBreakpoint, type TimingMapOptions, type TimingSidecar, type VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions };
|
|
673
|
+
export { type ExpressionHint, type ExpressionKind, type ExpressionOptions, type FindNotesFilter, type NormalizedPositionOptions, type PitchRange, type PlaybackControls, type PlaybackMeasure, type RoundtripMetrics, type TimingBreakpoint, type TimingMapOptions, type TimingSidecar, type VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions };
|
package/dist/query/index.d.ts
CHANGED
|
@@ -17,8 +17,42 @@ import { S as Score, f as Part, M as Measure, N as NoteEntry, V as VoiceGroup, q
|
|
|
17
17
|
* which shares this exact timeline computation.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Expressive-timing options shared by the MIDI exporter and the timeline query.
|
|
22
|
+
*
|
|
23
|
+
* These shape the TEMPO map only — never note durations. The whole module
|
|
24
|
+
* follows "method A": notated tick lengths (and therefore `quarterPos`) are the
|
|
25
|
+
* score's, and every expressive change in elapsed time is carried by tempo
|
|
26
|
+
* (`set_tempo`). This keeps `tick ÷ tpqn` exactly equal to the musical quarter
|
|
27
|
+
* position so the sidecar maps with zero drift.
|
|
28
|
+
*/
|
|
29
|
+
interface ExpressionOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Fermata hold factor: a fermata note/rest's tick span is stretched in
|
|
32
|
+
* elapsed time by this factor by dividing the prevailing BPM over the span
|
|
33
|
+
* (e.g. 2 → the span plays at half BPM, lasting twice as long). The note's
|
|
34
|
+
* tick length and `quarterPos` are unchanged. `1` disables. Default `1.75`.
|
|
35
|
+
*/
|
|
36
|
+
fermataHoldMultiplier?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Seconds of extra time a caesura ("railroad tracks") inserts, modelled as a
|
|
39
|
+
* tempo dip over the tail of the note carrying it (no tick is added).
|
|
40
|
+
* Default `0.4`. `0` disables.
|
|
41
|
+
*/
|
|
42
|
+
caesuraSeconds?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Seconds of extra time a breath mark inserts, modelled like a caesura but
|
|
45
|
+
* shorter. Default `0.25`. `0` disables.
|
|
46
|
+
*/
|
|
47
|
+
breathSeconds?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Number of discrete `set_tempo` steps used to approximate a rit./accel.
|
|
50
|
+
* tempo ramp between two tempo anchors. Higher = smoother. Default `12`.
|
|
51
|
+
*/
|
|
52
|
+
tempoRampSteps?: number;
|
|
53
|
+
}
|
|
20
54
|
/** Options controlling the rendered timeline. */
|
|
21
|
-
interface TimingMapOptions {
|
|
55
|
+
interface TimingMapOptions extends ExpressionOptions {
|
|
22
56
|
/**
|
|
23
57
|
* Ticks per quarter note (default: 480). Only affects internal tick rounding;
|
|
24
58
|
* `midiSec`/`quarterPos` are otherwise independent of it.
|
|
@@ -63,6 +97,23 @@ interface TimingSidecar {
|
|
|
63
97
|
ticksPerQuarterNote: number;
|
|
64
98
|
/** Breakpoints, sorted ascending and monotone by `midiSec`. */
|
|
65
99
|
breakpoints: TimingBreakpoint[];
|
|
100
|
+
/**
|
|
101
|
+
* Expressive-timing regions (fermatas, caesuras, breaths, rit./accel.). An
|
|
102
|
+
* aligner can relax its time constraints inside these spans, since the human
|
|
103
|
+
* performance is free to depart most from the grid there. Sorted by
|
|
104
|
+
* `fromMidiSec`. Omitted entirely when there are none.
|
|
105
|
+
*/
|
|
106
|
+
expressions?: ExpressionHint[];
|
|
107
|
+
}
|
|
108
|
+
/** The kind of expressive timing a span represents. */
|
|
109
|
+
type ExpressionKind = 'fermata' | 'caesura' | 'breath' | 'rit' | 'accel';
|
|
110
|
+
/** A time region (in MIDI seconds) carrying expressive tempo change. */
|
|
111
|
+
interface ExpressionHint {
|
|
112
|
+
type: ExpressionKind;
|
|
113
|
+
/** Start of the region in MIDI seconds. */
|
|
114
|
+
fromMidiSec: number;
|
|
115
|
+
/** End of the region in MIDI seconds. */
|
|
116
|
+
toMidiSec: number;
|
|
66
117
|
}
|
|
67
118
|
/**
|
|
68
119
|
* Generate the playback timeline (MIDI seconds ↔ conceptual musical position)
|
|
@@ -619,4 +670,4 @@ declare function countNotes(score: Score): number;
|
|
|
619
670
|
*/
|
|
620
671
|
declare function scoresEqual(a: Score, b: Score): boolean;
|
|
621
672
|
|
|
622
|
-
export { type FindNotesFilter, type NormalizedPositionOptions, type PitchRange, type PlaybackControls, type PlaybackMeasure, type RoundtripMetrics, type TimingBreakpoint, type TimingMapOptions, type TimingSidecar, type VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions };
|
|
673
|
+
export { type ExpressionHint, type ExpressionKind, type ExpressionOptions, type FindNotesFilter, type NormalizedPositionOptions, type PitchRange, type PlaybackControls, type PlaybackMeasure, type RoundtripMetrics, type TimingBreakpoint, type TimingMapOptions, type TimingSidecar, type VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, extractPlaybackControls, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, generatePlaybackSequence, generatePlaybackTimeline, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, hasPlaybackControls, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions };
|
package/dist/query/index.js
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
83
|
+
var _chunkCHMV7XWYjs = require('../chunk-CHMV7XWY.js');
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
|
|
@@ -163,4 +163,4 @@ var _chunkF6GPX6VWjs = require('../chunk-F6GPX6VW.js');
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
exports.buildVoiceToStaffMap =
|
|
166
|
+
exports.buildVoiceToStaffMap = _chunkCHMV7XWYjs.buildVoiceToStaffMap; exports.buildVoiceToStaffMapForPart = _chunkCHMV7XWYjs.buildVoiceToStaffMapForPart; exports.countNotes = _chunkCHMV7XWYjs.countNotes; exports.extractPlaybackControls = _chunkCHMV7XWYjs.extractPlaybackControls; exports.findBarlines = _chunkCHMV7XWYjs.findBarlines; exports.findDirectionsByType = _chunkCHMV7XWYjs.findDirectionsByType; exports.findNotes = _chunkCHMV7XWYjs.findNotes; exports.findNotesWithNotation = _chunkCHMV7XWYjs.findNotesWithNotation; exports.generatePlaybackSequence = _chunkCHMV7XWYjs.generatePlaybackSequence; exports.generatePlaybackTimeline = _chunkCHMV7XWYjs.generatePlaybackTimeline; exports.getAbsolutePosition = _chunkCHMV7XWYjs.getAbsolutePosition; exports.getAdjacentNotes = _chunkCHMV7XWYjs.getAdjacentNotes; exports.getAllNotes = _chunkCHMV7XWYjs.getAllNotes; exports.getAttributesAtMeasure = _chunkCHMV7XWYjs.getAttributesAtMeasure; exports.getBeamGroups = _chunkCHMV7XWYjs.getBeamGroups; exports.getChordProgression = _chunkCHMV7XWYjs.getChordProgression; exports.getChords = _chunkCHMV7XWYjs.getChords; exports.getClefChanges = _chunkCHMV7XWYjs.getClefChanges; exports.getClefForStaff = _chunkCHMV7XWYjs.getClefForStaff; exports.getDirections = _chunkCHMV7XWYjs.getDirections; exports.getDirectionsAtPosition = _chunkCHMV7XWYjs.getDirectionsAtPosition; exports.getDivisions = _chunkCHMV7XWYjs.getDivisions; exports.getDuration = _chunkCHMV7XWYjs.getDuration; exports.getDynamics = _chunkCHMV7XWYjs.getDynamics; exports.getEffectiveStaff = _chunkCHMV7XWYjs.getEffectiveStaff; exports.getEndings = _chunkCHMV7XWYjs.getEndings; exports.getEntriesAtPosition = _chunkCHMV7XWYjs.getEntriesAtPosition; exports.getEntriesForStaff = _chunkCHMV7XWYjs.getEntriesForStaff; exports.getEntriesInRange = _chunkCHMV7XWYjs.getEntriesInRange; exports.getHarmonies = _chunkCHMV7XWYjs.getHarmonies; exports.getHarmonyAtPosition = _chunkCHMV7XWYjs.getHarmonyAtPosition; exports.getKeyChanges = _chunkCHMV7XWYjs.getKeyChanges; exports.getLyricText = _chunkCHMV7XWYjs.getLyricText; exports.getLyrics = _chunkCHMV7XWYjs.getLyrics; exports.getMeasure = _chunkCHMV7XWYjs.getMeasure; exports.getMeasureByIndex = _chunkCHMV7XWYjs.getMeasureByIndex; exports.getMeasureCount = _chunkCHMV7XWYjs.getMeasureCount; exports.getNextNote = _chunkCHMV7XWYjs.getNextNote; exports.getNormalizedDuration = _chunkCHMV7XWYjs.getNormalizedDuration; exports.getNormalizedPosition = _chunkCHMV7XWYjs.getNormalizedPosition; exports.getNotesAtPosition = _chunkCHMV7XWYjs.getNotesAtPosition; exports.getNotesForStaff = _chunkCHMV7XWYjs.getNotesForStaff; exports.getNotesForVoice = _chunkCHMV7XWYjs.getNotesForVoice; exports.getNotesInRange = _chunkCHMV7XWYjs.getNotesInRange; exports.getOctaveShifts = _chunkCHMV7XWYjs.getOctaveShifts; exports.getPartById = _chunkCHMV7XWYjs.getPartById; exports.getPartByIndex = _chunkCHMV7XWYjs.getPartByIndex; exports.getPartCount = _chunkCHMV7XWYjs.getPartCount; exports.getPartIds = _chunkCHMV7XWYjs.getPartIds; exports.getPartIndex = _chunkCHMV7XWYjs.getPartIndex; exports.getPedalMarkings = _chunkCHMV7XWYjs.getPedalMarkings; exports.getPrevNote = _chunkCHMV7XWYjs.getPrevNote; exports.getRepeatStructure = _chunkCHMV7XWYjs.getRepeatStructure; exports.getSlurSpans = _chunkCHMV7XWYjs.getSlurSpans; exports.getStaffRange = _chunkCHMV7XWYjs.getStaffRange; exports.getStaveCount = _chunkCHMV7XWYjs.getStaveCount; exports.getStaves = _chunkCHMV7XWYjs.getStaves; exports.getStructuralChanges = _chunkCHMV7XWYjs.getStructuralChanges; exports.getTempoMarkings = _chunkCHMV7XWYjs.getTempoMarkings; exports.getTiedNoteGroups = _chunkCHMV7XWYjs.getTiedNoteGroups; exports.getTimeChanges = _chunkCHMV7XWYjs.getTimeChanges; exports.getTupletGroups = _chunkCHMV7XWYjs.getTupletGroups; exports.getVerseCount = _chunkCHMV7XWYjs.getVerseCount; exports.getVerticalSlice = _chunkCHMV7XWYjs.getVerticalSlice; exports.getVoiceLine = _chunkCHMV7XWYjs.getVoiceLine; exports.getVoiceLineInRange = _chunkCHMV7XWYjs.getVoiceLineInRange; exports.getVoices = _chunkCHMV7XWYjs.getVoices; exports.getVoicesForStaff = _chunkCHMV7XWYjs.getVoicesForStaff; exports.getWedges = _chunkCHMV7XWYjs.getWedges; exports.groupByStaff = _chunkCHMV7XWYjs.groupByStaff; exports.groupByVoice = _chunkCHMV7XWYjs.groupByVoice; exports.hasMultipleStaves = _chunkCHMV7XWYjs.hasMultipleStaves; exports.hasNotes = _chunkCHMV7XWYjs.hasNotes; exports.hasPlaybackControls = _chunkCHMV7XWYjs.hasPlaybackControls; exports.inferStaff = _chunkCHMV7XWYjs.inferStaff; exports.isRestMeasure = _chunkCHMV7XWYjs.isRestMeasure; exports.iterateEntries = _chunkCHMV7XWYjs.iterateEntries; exports.iterateNotes = _chunkCHMV7XWYjs.iterateNotes; exports.measureRoundtrip = _chunkCHMV7XWYjs.measureRoundtrip; exports.scoresEqual = _chunkCHMV7XWYjs.scoresEqual; exports.withAbsolutePositions = _chunkCHMV7XWYjs.withAbsolutePositions;
|
package/dist/query/index.mjs
CHANGED