Enhance Ableton export logic with scaled note velocity and filter fader canonicalization

This commit is contained in:
2026-07-14 11:49:08 +02:00
parent b74c13621d
commit 82a4c73295
6 changed files with 70 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import {
buildClipEnvelopes,
convertFaderValue,
getFaderValueAt,
getScaledNoteVelocity,
} from '../src/lib/exporters/ableton/automation';
import { AblGroupPatternOccurrence, AblTrack } from '../src/lib/transformers/ableton';
import { FaderParam } from '../src/types/types';
@@ -49,6 +50,28 @@ const track = {
test('uses original note velocity until a VEL point is reached', () => {
assert.equal(getFaderValueAt(occurrence, FaderParam.VEL, 96), undefined);
assert.equal(getFaderValueAt(occurrence, FaderParam.VEL, 192), 0.5);
assert.equal(getScaledNoteVelocity(101, occurrence, 96), 101);
assert.equal(getScaledNoteVelocity(101, occurrence, 192), 51);
});
test('scales P07-like note velocities with static and automated VEL values', () => {
const staticVelocity = {
...occurrence,
faderParams: {
...occurrence.faderParams,
[FaderParam.VEL]: 0.5325199961662292,
},
faderAutomation: [
{ parameter: FaderParam.VEL, position: 192, value: 0.25, flags: 0 },
],
};
assert.deepEqual(
[127, 127, 48].map((velocity) => getScaledNoteVelocity(velocity, staticVelocity, 96)),
[68, 68, 26],
);
assert.equal(getScaledNoteVelocity(127, staticVelocity, 192), 32);
assert.equal(getScaledNoteVelocity(0, staticVelocity, 192), 1);
});
test('preserves each pad pitch offset while applying group PTC automation', () => {