@jeffy-g/live-midi-types 0.1.0 → 0.2.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.
- package/dist/ableton-colors.js +71 -11
- package/dist/midi-clip.d.ts +20 -28
- package/dist/midi-event.d.ts +46 -46
- package/dist/project.d.ts +40 -21
- package/package.json +2 -1
package/dist/ableton-colors.js
CHANGED
|
@@ -13,16 +13,76 @@
|
|
|
13
13
|
* @date 2025/6/27 4:51:48
|
|
14
14
|
*/
|
|
15
15
|
export const abletonColorPalette = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
"#ff94a6",
|
|
17
|
+
"#ffa529",
|
|
18
|
+
"#cc9927",
|
|
19
|
+
"#f7f47c",
|
|
20
|
+
"#bffb00",
|
|
21
|
+
"#1aff2f",
|
|
22
|
+
"#25ffa8",
|
|
23
|
+
"#5cffe8",
|
|
24
|
+
"#8bc5ff",
|
|
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",
|
|
26
86
|
];
|
|
27
87
|
/**
|
|
28
88
|
* Get color code from Ableton color index.
|
|
@@ -30,5 +90,5 @@ export const abletonColorPalette = [
|
|
|
30
90
|
* @returns {string} Hex color code.
|
|
31
91
|
*/
|
|
32
92
|
export function getColorFromIndex(colorIndex) {
|
|
33
|
-
|
|
93
|
+
return abletonColorPalette[colorIndex] ?? "#888"; // fallback gray
|
|
34
94
|
}
|
package/dist/midi-clip.d.ts
CHANGED
|
@@ -22,32 +22,24 @@ import type { NoteEvent, ControlChangeEvent } from "./midi-event";
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export type TMidiClipData = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Array of extracted note events.
|
|
47
|
-
*/
|
|
48
|
-
notes: NoteEvent[];
|
|
49
|
-
/**
|
|
50
|
-
* Array of extracted control change events.
|
|
51
|
-
*/
|
|
52
|
-
cc: ControlChangeEvent[];
|
|
25
|
+
/**
|
|
26
|
+
* Start position of the clip on the Live MidiTrack (in beats).
|
|
27
|
+
*/
|
|
28
|
+
clipStartInBeats: number;
|
|
29
|
+
/**
|
|
30
|
+
* Length of the clip (in beats). Usually `CurrentEnd.Value - CurrentStart.Value`.
|
|
31
|
+
*/
|
|
32
|
+
clipLength: number;
|
|
33
|
+
/**
|
|
34
|
+
* Time adjustment for tempo mapping (in beats).
|
|
35
|
+
*/
|
|
36
|
+
adjustTimeOftempee: number;
|
|
37
|
+
/**
|
|
38
|
+
* Array of extracted note events.
|
|
39
|
+
*/
|
|
40
|
+
notes: NoteEvent[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of extracted control change events.
|
|
43
|
+
*/
|
|
44
|
+
cc: ControlChangeEvent[];
|
|
53
45
|
};
|
package/dist/midi-event.d.ts
CHANGED
|
@@ -10,57 +10,57 @@
|
|
|
10
10
|
* @summary Common MIDI event types for Ableton Live and related tools.
|
|
11
11
|
*/
|
|
12
12
|
export type NoteEvent = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
/**
|
|
14
|
+
* NOTE: floating number
|
|
15
|
+
*/
|
|
16
|
+
time: number;
|
|
17
|
+
/**
|
|
18
|
+
* NOTE: floating number
|
|
19
|
+
*/
|
|
20
|
+
duration: number;
|
|
21
|
+
pitch: number;
|
|
22
|
+
/**
|
|
23
|
+
* `0` to `127`
|
|
24
|
+
* NOTE: floating number
|
|
25
|
+
*/
|
|
26
|
+
velocity: number;
|
|
27
27
|
};
|
|
28
28
|
export type ControlChangeEvent = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Time relative to the start of the clip.
|
|
31
|
+
*
|
|
32
|
+
* **This is a floating point number representing the time in quarter notes. (Ableton Live)**
|
|
33
|
+
*/
|
|
34
|
+
time: number;
|
|
35
|
+
/**
|
|
36
|
+
* MIDI controller number.
|
|
37
|
+
*/
|
|
38
|
+
controller: number;
|
|
39
|
+
/**
|
|
40
|
+
* `0` to `127`
|
|
41
|
+
*
|
|
42
|
+
* Value of the controller (0-127, may be float).
|
|
43
|
+
*/
|
|
44
|
+
value: number;
|
|
45
|
+
/**
|
|
46
|
+
* Source type: "curve" for interpolated, "single" for discrete.
|
|
47
|
+
*/
|
|
48
|
+
source?: "curve" | "single";
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Tempo event object.
|
|
52
52
|
*/
|
|
53
53
|
export type TempoEvent = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Time in quarter notes.
|
|
56
|
+
*
|
|
57
|
+
* 拍ベースのタイムスタンプ(例:4.5 = 4拍と8分音符)
|
|
58
|
+
*/
|
|
59
|
+
time: number;
|
|
60
|
+
/**
|
|
61
|
+
* Tempo in BPM.
|
|
62
|
+
*
|
|
63
|
+
* この地点でのテンポ(BPM)
|
|
64
|
+
*/
|
|
65
|
+
bpm: number;
|
|
66
66
|
};
|
package/dist/project.d.ts
CHANGED
|
@@ -8,29 +8,48 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* @file src/project.ts
|
|
10
10
|
*/
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
export type TClipSummary<T extends Record<string, any>> = {
|
|
12
|
+
/**
|
|
13
|
+
* UI などで使用する時のために付与される ID
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
* "clip-" + createUUID().toUpperCase()
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
color: string;
|
|
21
|
+
/**
|
|
22
|
+
* Disabled property for the clip.
|
|
23
|
+
*/
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
clipName: string;
|
|
26
|
+
trackName: string;
|
|
27
|
+
annotations?: string;
|
|
22
28
|
} & T;
|
|
23
29
|
export type TTrackInfo<T extends Record<string, any>> = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
name: string;
|
|
31
|
+
color: string;
|
|
32
|
+
annotations?: string;
|
|
33
|
+
/**
|
|
34
|
+
* ```
|
|
35
|
+
* Record<"clipName", TMidiClipSummary>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
clips: Record<string, TClipSummary<T>>;
|
|
32
39
|
};
|
|
33
40
|
export type TParsedLiveAlsProject<T extends Record<string, any>> = {
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Ableton Live のプロジェクト名
|
|
43
|
+
* 通常、拡張子を除いた als file name.
|
|
44
|
+
*/
|
|
45
|
+
alsName: string;
|
|
46
|
+
/**
|
|
47
|
+
* ppq (ticks per quarter note)
|
|
48
|
+
*/
|
|
49
|
+
ticksPerQuarter: number;
|
|
50
|
+
/**
|
|
51
|
+
* Tracks in the project.
|
|
52
|
+
* NOTE: currently, this is a Midi tracks only.
|
|
53
|
+
*/
|
|
54
|
+
tracks: TTrackInfo<T>[];
|
|
36
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffy-g/live-midi-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Common TypeScript types for Ableton Live MIDI clip and event data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prebuild": "rimraf -g ./dist/*",
|
|
33
|
+
"format": "prettier --tab-width 2 -w \"./dist/**/*\"",
|
|
33
34
|
"build": "tsc",
|
|
34
35
|
"watch": "tsc -w"
|
|
35
36
|
}
|