diff --git a/src/lib/exporters/ableton/automation.ts b/src/lib/exporters/ableton/automation.ts index a308e2a..25936f2 100644 --- a/src/lib/exporters/ableton/automation.ts +++ b/src/lib/exporters/ableton/automation.ts @@ -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); diff --git a/src/lib/exporters/ableton/builders.ts b/src/lib/exporters/ableton/builders.ts index 51f2d34..7a89d05 100644 --- a/src/lib/exporters/ableton/builders.ts +++ b/src/lib/exporters/ableton/builders.ts @@ -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, ), );