Add support for MIDI events in Ableton export pipeline

This commit is contained in:
2026-07-14 06:40:46 +02:00
parent da8aca596f
commit 85c68268e8
3 changed files with 27 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import {
ExporterParams,
FaderAutomationEvent,
FaderParam,
MidiPatternEvent,
Note,
Pad,
PadCode,
@@ -44,6 +45,7 @@ export type AblNote = Note;
export type AblClip = {
notes: AblNote[];
midiEvents: AblMidiEvent[];
bars: number;
offset: number;
sceneBars: number;
@@ -54,6 +56,11 @@ export type AblClip = {
groupPattern?: AblGroupPatternOccurrence;
};
export type AblMidiEvent = Pick<
MidiPatternEvent,
'position' | 'source' | 'flags' | 'data' | 'rawData'
>;
export type AblFaderAutomationPoint = Pick<FaderAutomationEvent, 'position' | 'value' | 'flags'> & {
parameter: FaderParam;
};
@@ -166,6 +173,10 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
}
const faderParams = data.settings.groupFaderParams[pad.group];
const source = Number(pattern.pad.slice(1));
const midiEvents = (scene.patternEvents[pattern.group]?.events || []).filter(
(event): event is MidiPatternEvent => event.type === 'midi' && event.source === source,
);
if (!track) {
const soundId = findSoundIdByPad(pattern.pad, pads) || 0;
@@ -204,6 +215,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
lane.clips.push({
offset,
notes: pattern.notes,
midiEvents,
bars: pattern.bars,
sceneBars,
sceneIndex,
@@ -324,6 +336,7 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
if (!newClips[clip.sceneName]) {
newClips[clip.sceneName] = structuredClone(clip);
newClips[clip.sceneName].notes = [];
newClips[clip.sceneName].midiEvents = [];
}
newClips[clip.sceneName].notes = [
@@ -333,6 +346,10 @@ function abletonTransformer(data: ProjectRawData, exporterParams: ExporterParams
note: drumPad,
})),
];
newClips[clip.sceneName].midiEvents = [
...newClips[clip.sceneName].midiEvents,
...clip.midiEvents,
];
});
});