@jeffy-g/live-midi-types
Version:
Common TypeScript types for Ableton Live MIDI clip and event data.
58 lines (57 loc) • 1.68 kB
TypeScript
/*!
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Copyright (C) 2025 jeffy-g <hirotom1107@gmail.com>
// Released under the MIT license
// https://opensource.org/licenses/mit-license.php
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
/**
* @file src/midi-clip.ts
* @summary Common MIDI clip data type for Ableton Live and related tools.
*/
import type { NoteEvent, ControlChangeEvent } from "./midi-event.ts";
/**
* MIDI clip data extracted from Ableton Live's MidiClip object.
*
* This type represents all essential information for a single MIDI clip,
* including note events, control change events, and timing information.
*
* ```ts
* import type { TMidiClipData } from "@jeffy-g/live-midi-types";
* const data: TMidiClipData = ...;
* ```
*/
export type TMidiClipData = {
/**
* Start position of the clip on the Live MidiTrack (in beats).
*/
clipStartInBeats: number;
/**
* Length of the clip (in beats). Usually `CurrentEnd.Value - CurrentStart.Value`.
*/
clipLength: number;
/**
* Time adjustment for tempo mapping (in beats).
*/
adjustTimeOftempee: number;
/**
* List of known CC events in this clip.
*
* {@link TMidiClipData.ccMap __`ccMap`__}
*/
knownCCEvents: number[];
/**
* Array of extracted note events.
*/
notes: NoteEvent[];
/**
* Control change event map. (key: cc number)
* @version 0.8.0
*/
ccMap: Record<string, ControlChangeEvent[]>;
/**
* Array of extracted control change events. (flatten {@link TMidiClipData.ccMap __`ccMap`__}, sort by time)
* @version 0.8.0
*/
cc(): ControlChangeEvent[];
};