Update fader value logic in Ableton exporter to handle undefined values correctly

This commit is contained in:
2026-07-13 05:28:18 +02:00
parent fd80334ab7
commit a1b1c7ef25
2 changed files with 5 additions and 5 deletions

View File

@@ -73,8 +73,7 @@ export function getFaderValueAt(
position: number,
) {
const staticValue = occurrence?.faderParams[parameter];
let value =
staticValue === undefined || staticValue === -1 ? defaultValue(parameter) : staticValue;
let value = staticValue === undefined || staticValue === -1 ? undefined : staticValue;
const points = (occurrence?.faderAutomation || [])
.filter((point) => point.parameter === parameter && point.position <= position)
.sort((a, b) => a.position - b.position);

View File

@@ -254,13 +254,14 @@ async function buildMidiClip(
dur = nextNote.position / 96 - noteData.position / 96;
}
const automatedVelocity = koClip.groupPattern
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position)
: undefined;
const velocity = Math.max(
1,
Math.min(
127,
koClip.groupPattern
? getFaderValueAt(koClip.groupPattern, FaderParam.VEL, noteData.position) * 127
: noteData.velocity,
automatedVelocity === undefined ? noteData.velocity : automatedVelocity * 127,
),
);