@jeffy-g/live-midi-types 0.11.1 → 0.11.3
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/midi-clip.d.ts +5 -2
- package/dist/midi-clip.js +2 -3
- package/dist/midi10-smf-types.d.ts +17 -0
- package/dist/project.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/midi-clip.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ export type TMidiClipData<GRawData = never> = {
|
|
|
46
46
|
* Time adjustment for tempo mapping (in beats).
|
|
47
47
|
*/
|
|
48
48
|
adjustTimeOftempee: number;
|
|
49
|
+
/**
|
|
50
|
+
* @since v0.11.1
|
|
51
|
+
*/
|
|
49
52
|
programChange: number;
|
|
50
53
|
/**
|
|
51
54
|
* CC numbers known to this clip, sorted in ascending order.
|
|
@@ -59,7 +62,7 @@ export type TMidiClipData<GRawData = never> = {
|
|
|
59
62
|
notes: NoteEvent[];
|
|
60
63
|
/**
|
|
61
64
|
* Control change event map. (key: cc number, `0..127`)
|
|
62
|
-
* @
|
|
65
|
+
* @since v0.8.0
|
|
63
66
|
*/
|
|
64
67
|
ccMap: {
|
|
65
68
|
[ccNumber: `${number}`]: ControlChangeEvent[];
|
|
@@ -67,7 +70,7 @@ export type TMidiClipData<GRawData = never> = {
|
|
|
67
70
|
/**
|
|
68
71
|
* Array of extracted control change events. (flatten {@link TMidiClipData.ccMap __`ccMap`__}, sort by time)
|
|
69
72
|
* + use `flattenCCEventMap` (recommended)
|
|
70
|
-
* @
|
|
73
|
+
* @since v0.8.0
|
|
71
74
|
* @see {@link flattenCCEventMap}
|
|
72
75
|
*/
|
|
73
76
|
cc?(): ControlChangeEvent[];
|
package/dist/midi-clip.js
CHANGED
|
@@ -20,7 +20,6 @@ const getFlattenSize = (ccEventMap, knownCCEvents) => {
|
|
|
20
20
|
}
|
|
21
21
|
return total;
|
|
22
22
|
};
|
|
23
|
-
const warn = console.warn;
|
|
24
23
|
/**
|
|
25
24
|
* @param {Record<string, ControlChangeEvent[]>} ccEventMap
|
|
26
25
|
* @param {number[]} knownCCEvents
|
|
@@ -28,7 +27,7 @@ const warn = console.warn;
|
|
|
28
27
|
export const flattenCCEventMap = (ccEventMap, knownCCEvents) => {
|
|
29
28
|
var afterFlattenSize = getFlattenSize(ccEventMap, knownCCEvents);
|
|
30
29
|
/** @type {ControlChangeEvent[]} */
|
|
31
|
-
var ccBuffer = Array(afterFlattenSize);
|
|
30
|
+
var ccBuffer = Array(afterFlattenSize).fill(undefined);
|
|
32
31
|
var bufferIndex = 0;
|
|
33
32
|
for (let idx = 0, ccEventsLen = knownCCEvents.length; idx < ccEventsLen;) {
|
|
34
33
|
let ccEvents = ccEventMap[knownCCEvents[idx++]];
|
|
@@ -38,7 +37,7 @@ export const flattenCCEventMap = (ccEventMap, knownCCEvents) => {
|
|
|
38
37
|
}
|
|
39
38
|
if (bufferIndex !== afterFlattenSize) {
|
|
40
39
|
ccBuffer.length = bufferIndex;
|
|
41
|
-
warn(`⚠️ flattenCCEventMap: afterFlattenSize=${afterFlattenSize} lastSize=${bufferIndex}`);
|
|
40
|
+
console.warn(`⚠️ flattenCCEventMap: afterFlattenSize=${afterFlattenSize} lastSize=${bufferIndex}`);
|
|
42
41
|
}
|
|
43
42
|
return ccBuffer.sort((a, b) => a.time - b.time);
|
|
44
43
|
};
|
|
@@ -11,12 +11,29 @@
|
|
|
11
11
|
* @file src/midi10-smf-types.ts
|
|
12
12
|
*/
|
|
13
13
|
import type { ESMFEventType } from "./ESMFEventType.ts";
|
|
14
|
+
/**
|
|
15
|
+
* Standard MIDI File `MThd` header fields.
|
|
16
|
+
*
|
|
17
|
+
* Choose either `ticksPerBeat` for musical timing or `framesPerSecond` and
|
|
18
|
+
* `ticksPerFrame` for SMPTE timing. The optional `timeDivision` supplies the
|
|
19
|
+
* encoded 16-bit division word directly when writing.
|
|
20
|
+
*
|
|
21
|
+
* @see ./midi10-header.md for field details and parser/writer behavior.
|
|
22
|
+
*/
|
|
14
23
|
export interface MidiHeader {
|
|
24
|
+
/** SMF organization: `0` for one track, `1` for synchronous tracks, or `2` for independent sequences. */
|
|
15
25
|
format: 0 | 1 | 2;
|
|
26
|
+
/** Number of `MTrk` chunks reported by the header when parsing. */
|
|
16
27
|
numTracks: number;
|
|
28
|
+
/**
|
|
29
|
+
* Optional raw, unsigned 16-bit division word; takes precedence when writing. (__`0 - 32767`__)
|
|
30
|
+
*/
|
|
17
31
|
timeDivision?: number;
|
|
32
|
+
/** SMPTE frames per second; use with `ticksPerFrame`. */
|
|
18
33
|
framesPerSecond?: number;
|
|
34
|
+
/** Number of ticks in one SMPTE frame; use with `framesPerSecond`. */
|
|
19
35
|
ticksPerFrame?: number;
|
|
36
|
+
/** Number of ticks in one quarter note (PPQ); alternative to SMPTE timing. */
|
|
20
37
|
ticksPerBeat?: number;
|
|
21
38
|
}
|
|
22
39
|
export type TextEventTypesUnion = ESMFEventType.text | ESMFEventType.copyrightNotice | ESMFEventType.trackName | ESMFEventType.instrumentName | ESMFEventType.lyrics | ESMFEventType.marker | ESMFEventType.cuePoint;
|
package/dist/project.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ export type TGeneralTrack<T extends Record<string, any>> = TTrackInfo<T> | TMidi
|
|
|
158
158
|
/**
|
|
159
159
|
* Parsed data required by the Ableton Live project UI.
|
|
160
160
|
*/
|
|
161
|
-
export type TParsedAbletonLiveSet<
|
|
161
|
+
export type TParsedAbletonLiveSet<GTrackType = TGeneralTrack<Record<string, any>>> = {
|
|
162
162
|
/**
|
|
163
163
|
* Ableton Live project name.
|
|
164
164
|
*
|
|
@@ -191,7 +191,7 @@ export type TParsedAbletonLiveSet<T extends Record<string, any>> = {
|
|
|
191
191
|
* }
|
|
192
192
|
* ```
|
|
193
193
|
*/
|
|
194
|
-
tracks:
|
|
194
|
+
tracks: GTrackType[];
|
|
195
195
|
/**
|
|
196
196
|
* Tempo automation events extracted from the master track.
|
|
197
197
|
*
|