@jeffy-g/live-midi-types 0.7.2 → 0.7.4

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.
@@ -14,8 +14,8 @@
14
14
  */
15
15
  export declare const abletonColorPalette: string[];
16
16
  /**
17
- * Get color code from Ableton color index.
18
- * @param {number} colorIndex Index of Ableton color palette.
17
+ * Get color code from Ableton Live color index.
18
+ * @param {number} colorIndex Index of Ableton Live color palette.
19
19
  * @returns {string} Hex color code.
20
20
  */
21
21
  export declare function getColorFromIndex(colorIndex: number): string;
@@ -23,8 +23,8 @@ export const abletonColorPalette = "#ff94a6:#ffa529:#cc9927:#f7f47c:#bffb00:#1af
23
23
  #af3333:#a95131:#724f41:#dbc300:#85961f:#539f31:#0a9c8e:\
24
24
  #236384:#1a2f96:#2f52a2:#624bad:#a34bad:#cc2e6e:#3c3c3c".split(":");
25
25
  /**
26
- * Get color code from Ableton color index.
27
- * @param {number} colorIndex Index of Ableton color palette.
26
+ * Get color code from Ableton Live color index.
27
+ * @param {number} colorIndex Index of Ableton Live color palette.
28
28
  * @returns {string} Hex color code.
29
29
  */
30
30
  export function getColorFromIndex(colorIndex) {
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export * from "./midi-event.js";
2
2
  export * from "./midi-clip.js";
3
3
  export * from "./project.js";
4
4
  export * from "./ableton-colors.js";
5
- export declare const version = "v0.7.2";
5
+ export declare const version = "v0.7.4";
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export * from "./midi-event.js";
2
2
  export * from "./midi-clip.js";
3
3
  export * from "./project.js";
4
4
  export * from "./ableton-colors.js";
5
- export const version = "v0.7.2";
5
+ export const version = "v0.7.4";
package/dist/project.d.ts CHANGED
@@ -9,69 +9,165 @@
9
9
  * @file src/project.ts
10
10
  */
11
11
  import type { TempoEvent } from "./midi-event.ts";
12
+ /**
13
+ * Summary information for an Ableton Live MIDI clip.
14
+ */
12
15
  export type TClipSummary<T extends Record<string, any>> = {
13
16
  /**
14
- * ```js
15
- * // e.g
17
+ * Original `MidiClip` ID from the ALS document.
18
+ *
19
+ * + Stored as a numeric string.
20
+ *
21
+ * ```
16
22
  * "/Ableton/LiveSet/Tracks/MidiTrack[4]/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip[3]/@Id"
17
23
  * ```
18
24
  * @date 2026/07/02
19
25
  */
20
26
  originId: string;
21
27
  /**
22
- * ID assigned for use in UI etc.
28
+ * Application-specific ID assigned for use by the UI and other consumers.
23
29
  *
24
30
  * ```
25
- * "clip-" + crypto.randomUUID()
31
+ * `clip-${crypto.randomUUID()}`
26
32
  * ```
27
33
  */
28
34
  id: string;
35
+ /**
36
+ * Index into the Ableton Live color palette.
37
+ * + This value is always the index of the color palette.
38
+ * ```
39
+ * // e.g. xpath
40
+ * "/Ableton/LiveSet/Tracks/MidiTrack/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip/Color/@Value"
41
+ *
42
+ * // how to actual color
43
+ * // "0" or "12" to "#ff94a6" / "#e553a0"
44
+ * const hexColor = getColorFromIndex(+clip.color);
45
+ * ```
46
+ *
47
+ * @see {@link getColorFromIndex}
48
+ */
29
49
  color: string;
30
50
  /**
31
- * Disabled property for the clip.
51
+ * Whether the clip is disabled.
32
52
  */
33
53
  disabled: boolean;
54
+ /**
55
+ * Original name of the `MidiClip`.
56
+ *
57
+ * ```
58
+ * // e.g
59
+ * "/Ableton/LiveSet/Tracks/MidiTrack/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip/Name/@Value"
60
+ * ```
61
+ */
34
62
  clipName: string;
63
+ /**
64
+ * Name of the parent track.
65
+ */
35
66
  trackName: string;
36
- annotations?: string;
67
+ /**
68
+ * Annotation attached to this `MidiClip` in Ableton Live.
69
+ *
70
+ * + Any text value appears to be accepted.
71
+ *
72
+ * ```
73
+ * // e.g
74
+ * "/Ableton/LiveSet/Tracks/MidiTrack/DeviceChain/MainSequencer/ClipTimeable/ArrangerAutomation/Events/MidiClip/Annotation/@Value"
75
+ * ```
76
+ */
77
+ annotation: string;
37
78
  } & T;
79
+ /**
80
+ * Summary information for an Ableton Live track.
81
+ */
38
82
  export type TTrackInfo<T extends Record<string, any>> = {
39
83
  /**
40
- * ```js
84
+ * Original track ID from the ALS document.
85
+ *
86
+ * ```
41
87
  * // e.g
42
88
  * "/Ableton/LiveSet/Tracks/MidiTrack[4]/@Id"
43
89
  * ```
44
90
  * @date 2026/07/02
45
91
  */
46
92
  originId: string;
93
+ /**
94
+ * Application-specific ID assigned for use by the UI and other consumers.
95
+ *
96
+ * ```
97
+ * // e.g.
98
+ * "clip-" + crypto.randomUUID()
99
+ * ```
100
+ */
47
101
  id: string;
102
+ /**
103
+ * Original name of the track.
104
+ *
105
+ * ```
106
+ * // e.g MidiTrack
107
+ * "/Ableton/LiveSet/Tracks/MidiTrack/Name/EffectiveName/@Value"
108
+ * ```
109
+ */
48
110
  name: string;
111
+ /**
112
+ * Index into the Ableton Live color palette.
113
+ * + This value is always the index of the color palette.
114
+ *
115
+ * ```
116
+ * // e.g. xpath (MidiTrack)
117
+ * "/Ableton/LiveSet/Tracks/MidiTrack/Color/@Value"
118
+ *
119
+ * // Convert the index to a CSS color:
120
+ * // "0" or "12" to "#ff94a6" / "#e553a0"
121
+ * const hexColor = getColorFromIndex(+clip.color);
122
+ * ```
123
+ * @see {@link getColorFromIndex}
124
+ */
49
125
  color: string;
50
- annotations?: string;
51
126
  /**
127
+ * Annotation attached to this track in Ableton Live. (MidiTrack etc).
128
+ *
129
+ * + Any text value appears to be accepted.
52
130
  * ```
53
- * Record<"clipName", TMidiClipSummary>
131
+ * // e.g (MidiTrack)
132
+ * "/Ableton/LiveSet/Tracks/MidiTrack/Name/Annotation/@Value"
54
133
  * ```
55
134
  */
135
+ annotation: string;
136
+ /**
137
+ * MIDI clips indexed by clip name.
138
+ */
56
139
  clips: Record<string, TClipSummary<T>>;
57
140
  };
141
+ /**
142
+ * Parsed data required by the Ableton Live project UI.
143
+ */
58
144
  export type TParsedAbletonLiveSet<T extends Record<string, any>> = {
59
145
  /**
60
- * Ableton Live project name
61
- * Usually the als file name without the extension.
146
+ * Ableton Live project name.
147
+ *
148
+ * + Usually the `.als` filename without its extension.
62
149
  */
63
150
  alsName: string;
64
151
  /**
65
- * ppq (ticks per quarter note)
152
+ * Pulses per quarter note (PPQ).
153
+ *
154
+ * + This value is not stored in the ALS document; it is supplied by the application.
66
155
  */
67
156
  ticksPerQuarter: number;
68
157
  /**
69
158
  * Tracks in the project.
70
- * NOTE: currently, this is a Midi tracks only.
159
+ *
160
+ * + Currently contains only MIDI tracks.
71
161
  */
72
162
  tracks: TTrackInfo<T>[];
73
163
  /**
74
- * Tempo automation events.
164
+ * Tempo automation events extracted from the master track.
165
+ *
166
+ * + Retrieving tempo event data requires a version-dependent XPath.
167
+ * ```
168
+ * // Specific XPath examples (live 12.x)
169
+ * "/Ableton/LiveSet/MasterTrack/AutomationEnvelopes/Envelopes/AutomationEnvelope[2]/Automation/Events"
170
+ * ```
75
171
  */
76
172
  tempoAutomation: TempoEvent[];
77
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffy-g/live-midi-types",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Common TypeScript types for Ableton Live MIDI clip and event data.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",