Enhance Ableton export with value inversion support for automation and envelopes
This commit is contained in:
@@ -67,8 +67,14 @@ function getAbletonVersion(exporterParams: ExporterParams): AbletonVersion {
|
||||
return exporterParams.abletonVersion === '10' ? '10' : '11';
|
||||
}
|
||||
|
||||
function simplerEnvelopeMilliseconds(value: number, soundLength: number, oneshot: boolean) {
|
||||
const milliseconds = koEnvRangeToSeconds(value, soundLength) * 1000;
|
||||
function simplerEnvelopeMilliseconds(
|
||||
value: number,
|
||||
soundLength: number,
|
||||
oneshot: boolean,
|
||||
invertValue: boolean = false,
|
||||
) {
|
||||
const convertedValue = invertValue ? 255 - value : value;
|
||||
const milliseconds = koEnvRangeToSeconds(convertedValue, soundLength) * 1000;
|
||||
return oneshot ? Math.min(2000, milliseconds) : milliseconds;
|
||||
}
|
||||
|
||||
@@ -104,7 +110,12 @@ function setLive10SampleReference(fileRef: any, sampleName: string) {
|
||||
fileRef.LivePackId = { '@Value': '' };
|
||||
}
|
||||
|
||||
function targetFor(parameter: any, maxValue?: number, soundLength?: number) {
|
||||
function targetFor(
|
||||
parameter: any,
|
||||
maxValue?: number,
|
||||
soundLength?: number,
|
||||
invertValue?: boolean,
|
||||
) {
|
||||
const automationTarget =
|
||||
parameter?.AutomationTarget?.['@Id'] === undefined
|
||||
? undefined
|
||||
@@ -114,6 +125,7 @@ function targetFor(parameter: any, maxValue?: number, soundLength?: number) {
|
||||
session: automationTarget,
|
||||
maxValue,
|
||||
soundLength,
|
||||
invertValue,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -204,6 +216,7 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
|
||||
: simpler.VolumeAndPan.Envelope.AttackTime,
|
||||
oneshot ? 2000 : undefined,
|
||||
soundLength,
|
||||
false,
|
||||
),
|
||||
);
|
||||
addTarget(
|
||||
@@ -215,6 +228,7 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
|
||||
: simpler.VolumeAndPan.Envelope.ReleaseTime,
|
||||
oneshot ? 2000 : undefined,
|
||||
soundLength,
|
||||
oneshot,
|
||||
),
|
||||
);
|
||||
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount));
|
||||
@@ -452,6 +466,7 @@ async function buildSimplerDevice(koTrack: AblTrack, abletonVersion: AbletonVers
|
||||
koTrack.release,
|
||||
koTrack.soundLength,
|
||||
oneshot,
|
||||
oneshot,
|
||||
);
|
||||
device.VolumeAndPan.Panorama.Manual['@Value'] = koTrack.pan;
|
||||
|
||||
@@ -470,6 +485,7 @@ async function buildSimplerDevice(koTrack: AblTrack, abletonVersion: AbletonVers
|
||||
koTrack.faderParams[FaderParam.REL] * 255,
|
||||
koTrack.soundLength,
|
||||
oneshot,
|
||||
oneshot,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user