@jeffy-g/live-midi-types 0.6.4 → 0.7.1
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/README.md +19 -0
- package/dist/ableton-colors.js +10 -72
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/midi-event.d.ts +12 -4
- package/dist/midi-event.js +1 -3
- package/dist/project.d.ts +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,25 @@ It is designed to ensure type safety and data consistency across projects that h
|
|
|
13
13
|
|
|
14
14
|
By providing a single source of truth for data structures, this library simplifies development and reduces errors when passing MIDI and project data between different modules.
|
|
15
15
|
|
|
16
|
+
> ## Type Origin and Gaps
|
|
17
|
+
|
|
18
|
+
These definitions were **reverse engineered** from Ableton Live 11 `.als` files.
|
|
19
|
+
Ableton publishes no official specification, so some fields may be missing or misinterpreted.
|
|
20
|
+
If you encounter inaccuracies, please open an issue or pull request.
|
|
21
|
+
|
|
22
|
+
> ## Directory Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
src/
|
|
26
|
+
├─ midi-event.ts # basic note, control change, and tempo events
|
|
27
|
+
├─ midi-clip.ts # builds on midi-event to describe clips
|
|
28
|
+
├─ project.ts # aggregates clips into a project
|
|
29
|
+
├─ ableton-colors.ts # color utilities
|
|
30
|
+
└─ index.ts # public exports
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Dependencies flow upward: `midi-event` → `midi-clip` → `project`, while `ableton-colors` stands alone.
|
|
34
|
+
|
|
16
35
|
> ## Installation
|
|
17
36
|
|
|
18
37
|
You can install the package using npm or yarn:
|
package/dist/ableton-colors.js
CHANGED
|
@@ -12,78 +12,16 @@
|
|
|
12
12
|
* Ableton Live color palette.
|
|
13
13
|
* @date 2025/6/27 4:51:48
|
|
14
14
|
*/
|
|
15
|
-
export const abletonColorPalette =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"#5480e4",
|
|
26
|
-
"#92a7ff",
|
|
27
|
-
"#d86ce4",
|
|
28
|
-
"#e553a0",
|
|
29
|
-
"#ffffff",
|
|
30
|
-
"#ff3636",
|
|
31
|
-
"#f66c03",
|
|
32
|
-
"#99724b",
|
|
33
|
-
"#fff034",
|
|
34
|
-
"#87ff67",
|
|
35
|
-
"#3dc300",
|
|
36
|
-
"#00bfaf",
|
|
37
|
-
"#19e9ff",
|
|
38
|
-
"#10a4ee",
|
|
39
|
-
"#007dc0",
|
|
40
|
-
"#886ce4",
|
|
41
|
-
"#b677c6",
|
|
42
|
-
"#ff39d4",
|
|
43
|
-
"#d0d0d0",
|
|
44
|
-
"#e2675a",
|
|
45
|
-
"#ffa374",
|
|
46
|
-
"#d3ad71",
|
|
47
|
-
"#edffae",
|
|
48
|
-
"#d2e498",
|
|
49
|
-
"#bad074",
|
|
50
|
-
"#9bc48d",
|
|
51
|
-
"#d4fde1",
|
|
52
|
-
"#cdf1f8",
|
|
53
|
-
"#b9c1e3",
|
|
54
|
-
"#cdbbe4",
|
|
55
|
-
"#ae98e5",
|
|
56
|
-
"#e5dce1",
|
|
57
|
-
"#a9a9a9",
|
|
58
|
-
"#c6928b",
|
|
59
|
-
"#b78256",
|
|
60
|
-
"#99836a",
|
|
61
|
-
"#bfba69",
|
|
62
|
-
"#a6be00",
|
|
63
|
-
"#7db04d",
|
|
64
|
-
"#88c2ba",
|
|
65
|
-
"#9bb3c4",
|
|
66
|
-
"#85a5c2",
|
|
67
|
-
"#8393cc",
|
|
68
|
-
"#a595b5",
|
|
69
|
-
"#bf9fbe",
|
|
70
|
-
"#bc7196",
|
|
71
|
-
"#7b7b7b",
|
|
72
|
-
"#af3333",
|
|
73
|
-
"#a95131",
|
|
74
|
-
"#724f41",
|
|
75
|
-
"#dbc300",
|
|
76
|
-
"#85961f",
|
|
77
|
-
"#539f31",
|
|
78
|
-
"#0a9c8e",
|
|
79
|
-
"#236384",
|
|
80
|
-
"#1a2f96",
|
|
81
|
-
"#2f52a2",
|
|
82
|
-
"#624bad",
|
|
83
|
-
"#a34bad",
|
|
84
|
-
"#cc2e6e",
|
|
85
|
-
"#3c3c3c",
|
|
86
|
-
];
|
|
15
|
+
export const abletonColorPalette = "#ff94a6:#ffa529:#cc9927:#f7f47c:#bffb00:#1aff2f:#25ffa8\
|
|
16
|
+
#5cffe8:#8bc5ff:#5480e4:#92a7ff:#d86ce4:#e553a0:#ffffff\
|
|
17
|
+
#ff3636:#f66c03:#99724b:#fff034:#87ff67:#3dc300:#00bfaf\
|
|
18
|
+
#19e9ff:#10a4ee:#007dc0:#886ce4:#b677c6:#ff39d4:#d0d0d0\
|
|
19
|
+
#e2675a:#ffa374:#d3ad71:#edffae:#d2e498:#bad074:#9bc48d\
|
|
20
|
+
#d4fde1:#cdf1f8:#b9c1e3:#cdbbe4:#ae98e5:#e5dce1:#a9a9a9\
|
|
21
|
+
#c6928b:#b78256:#99836a:#bfba69:#a6be00:#7db04d:#88c2ba\
|
|
22
|
+
#9bb3c4:#85a5c2:#8393cc:#a595b5:#bf9fbe:#bc7196:#7b7b7b\
|
|
23
|
+
#af3333:#a95131:#724f41:#dbc300:#85961f:#539f31:#0a9c8e\
|
|
24
|
+
#236384:#1a2f96:#2f52a2:#624bad:#a34bad:#cc2e6e:#3c3c3c".split(":");
|
|
87
25
|
/**
|
|
88
26
|
* Get color code from Ableton color index.
|
|
89
27
|
* @param {number} colorIndex Index of Ableton color palette.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/midi-event.d.ts
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
* @file src/midi-event.ts
|
|
10
10
|
* @summary Common MIDI event types for Ableton Live and related tools.
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* ```
|
|
14
|
+
* // Path to `MidiClip` element
|
|
15
|
+
* `/Ableton/LiveSet/Tracks/MidiTrack[]/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip[]`
|
|
16
|
+
* // this type is `MidiNoteEvent`
|
|
17
|
+
* `<MidiClip>/Notes/KeyTracks/KeyTrack[]/Notes/MidiNoteEvent[]`
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
12
20
|
export type NoteEvent = {
|
|
13
21
|
/**
|
|
14
22
|
* NOTE: floating number
|
|
@@ -18,6 +26,9 @@ export type NoteEvent = {
|
|
|
18
26
|
* NOTE: floating number
|
|
19
27
|
*/
|
|
20
28
|
duration: number;
|
|
29
|
+
/**
|
|
30
|
+
* NOTE: Must be an integer. Floating-point values are not valid.
|
|
31
|
+
*/
|
|
21
32
|
pitch: number;
|
|
22
33
|
/**
|
|
23
34
|
* `0` to `127`
|
|
@@ -79,7 +90,4 @@ export type TEventMap = {
|
|
|
79
90
|
* @param {K} type Type of event to check against.
|
|
80
91
|
* @returns {events is TEventMap[K]} True if the events match the specified type.
|
|
81
92
|
*/
|
|
82
|
-
export declare const eventsIs: <K extends keyof TEventMap>(
|
|
83
|
-
events: unknown[],
|
|
84
|
-
type: K,
|
|
85
|
-
) => events is TEventMap[K];
|
|
93
|
+
export declare const eventsIs: <K extends keyof TEventMap>(events: unknown[], type: K) => events is TEventMap[K];
|
package/dist/midi-event.js
CHANGED
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
* @param {unknown} value Value to check.
|
|
18
18
|
* @returns {value is Record<string, unknown>} True if the value is an object.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
return typeof value === "object" && value !== null;
|
|
22
|
-
}
|
|
20
|
+
const isObject = (value) => typeof value === "object" && value !== null;
|
|
23
21
|
/**
|
|
24
22
|
* Type guard to check if the events array contains a specific type of MIDI event.
|
|
25
23
|
* @template {keyof TEventMap} K
|
package/dist/project.d.ts
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { TempoEvent } from "./midi-event.ts";
|
|
12
12
|
export type TClipSummary<T extends Record<string, any>> = {
|
|
13
|
+
/**
|
|
14
|
+
* ```js
|
|
15
|
+
* // e.g
|
|
16
|
+
* "/Ableton/LiveSet/Tracks/MidiTrack[4]/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip[3]/@Id"
|
|
17
|
+
* ```
|
|
18
|
+
* @date 2026/07/02
|
|
19
|
+
*/
|
|
20
|
+
originId: string;
|
|
13
21
|
/**
|
|
14
22
|
* ID assigned for use in UI etc.
|
|
15
23
|
*
|
|
@@ -28,6 +36,14 @@ export type TClipSummary<T extends Record<string, any>> = {
|
|
|
28
36
|
annotations?: string;
|
|
29
37
|
} & T;
|
|
30
38
|
export type TTrackInfo<T extends Record<string, any>> = {
|
|
39
|
+
/**
|
|
40
|
+
* ```js
|
|
41
|
+
* // e.g
|
|
42
|
+
* "/Ableton/LiveSet/Tracks/MidiTrack[4]/@Id"
|
|
43
|
+
* ```
|
|
44
|
+
* @date 2026/07/02
|
|
45
|
+
*/
|
|
46
|
+
originId: string;
|
|
31
47
|
id: string;
|
|
32
48
|
name: string;
|
|
33
49
|
color: string;
|