@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.
@@ -13,16 +13,76 @@
13
13
  * @date 2025/6/27 4:51:48
14
14
  */
15
15
  export const abletonColorPalette = [
16
- "#ff94a6", "#ffa529", "#cc9927", "#f7f47c", "#bffb00", "#1aff2f", "#25ffa8",
17
- "#5cffe8", "#8bc5ff", "#5480e4", "#92a7ff", "#d86ce4", "#e553a0", "#ffffff",
18
- "#ff3636", "#f66c03", "#99724b", "#fff034", "#87ff67", "#3dc300", "#00bfaf",
19
- "#19e9ff", "#10a4ee", "#007dc0", "#886ce4", "#b677c6", "#ff39d4", "#d0d0d0",
20
- "#e2675a", "#ffa374", "#d3ad71", "#edffae", "#d2e498", "#bad074", "#9bc48d",
21
- "#d4fde1", "#cdf1f8", "#b9c1e3", "#cdbbe4", "#ae98e5", "#e5dce1", "#a9a9a9",
22
- "#c6928b", "#b78256", "#99836a", "#bfba69", "#a6be00", "#7db04d", "#88c2ba",
23
- "#9bb3c4", "#85a5c2", "#8393cc", "#a595b5", "#bf9fbe", "#bc7196", "#7b7b7b",
24
- "#af3333", "#a95131", "#724f41", "#dbc300", "#85961f", "#539f31", "#0a9c8e",
25
- "#236384", "#1a2f96", "#2f52a2", "#624bad", "#a34bad", "#cc2e6e", "#3c3c3c"
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
- return abletonColorPalette[colorIndex] ?? "#888"; // fallback gray
93
+ return abletonColorPalette[colorIndex] ?? "#888"; // fallback gray
34
94
  }
@@ -22,32 +22,24 @@ import type { NoteEvent, ControlChangeEvent } from "./midi-event";
22
22
  * ```
23
23
  */
24
24
  export type TMidiClipData = {
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).
31
- */
32
- clipLength: number;
33
- /**
34
- * Time adjustment for tempo mapping (in beats).
35
- */
36
- adjustTimeOftempee: number;
37
- /**
38
- * color for visualization (Color table index)
39
- */
40
- color: string;
41
- /**
42
- * Disabled property for the clip.
43
- */
44
- disabled: boolean;
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
  };
@@ -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
- * 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;
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
- * 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";
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
- * 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;
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 TMidiClipSummary<T extends Record<string, any>> = {
12
- /**
13
- * UI などで使用する時のために付与される ID
14
- *
15
- * ```
16
- * "clip-" + createUUID().toUpperCase()
17
- * ```
18
- */
19
- id: string;
20
- clipName: string;
21
- trackName: string;
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
- name: string;
25
- color: string;
26
- /**
27
- * ```
28
- * Record<"clipName", TMidiClipSummary>
29
- * ```
30
- */
31
- clips: Record<string, TMidiClipSummary<T>>;
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
- ticksPerQuarter: number;
35
- tracks: TTrackInfo<T>[];
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.1.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
  }