Update Ableton exporter to use sound length for automation calculations
This commit is contained in:
@@ -104,7 +104,7 @@ function setLive10SampleReference(fileRef: any, sampleName: string) {
|
||||
fileRef.LivePackId = { '@Value': '' };
|
||||
}
|
||||
|
||||
function targetFor(parameter: any, maxValue?: number) {
|
||||
function targetFor(parameter: any, maxValue?: number, soundLength?: number) {
|
||||
const automationTarget =
|
||||
parameter?.AutomationTarget?.['@Id'] === undefined
|
||||
? undefined
|
||||
@@ -113,6 +113,7 @@ function targetFor(parameter: any, maxValue?: number) {
|
||||
arrangement: automationTarget,
|
||||
session: automationTarget,
|
||||
maxValue,
|
||||
soundLength,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -188,6 +189,10 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
|
||||
|
||||
findSimplers(midiTrack.DeviceChain.DeviceChain.Devices).forEach((simpler) => {
|
||||
const oneshot = Number(simpler.Globals.PlaybackMode['@Value']) === 1;
|
||||
const sampleRef = simpler.Player.MultiSampleMap.SampleParts.MultiSamplePart.SampleRef;
|
||||
const sampleRate = Number(sampleRef.DefaultSampleRate?.['@Value']);
|
||||
const sampleDuration = Number(sampleRef.DefaultDuration?.['@Value']);
|
||||
const soundLength = sampleRate > 0 ? sampleDuration / sampleRate : undefined;
|
||||
addTarget(targets, FaderParam.PTC, targetFor(simpler.Pitch.TransposeKey));
|
||||
addTarget(targets, FaderParam.TUNE, targetFor(simpler.Pitch.TransposeFine));
|
||||
addTarget(
|
||||
@@ -198,6 +203,7 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
|
||||
? simpler.VolumeAndPan.OneShotEnvelope.FadeInTime
|
||||
: simpler.VolumeAndPan.Envelope.AttackTime,
|
||||
oneshot ? 2000 : undefined,
|
||||
soundLength,
|
||||
),
|
||||
);
|
||||
addTarget(
|
||||
@@ -208,6 +214,7 @@ function trackAutomationTargets(midiTrack: any, includeArrangementMixer: boolean
|
||||
? simpler.VolumeAndPan.OneShotEnvelope.FadeOutTime
|
||||
: simpler.VolumeAndPan.Envelope.ReleaseTime,
|
||||
oneshot ? 2000 : undefined,
|
||||
soundLength,
|
||||
),
|
||||
);
|
||||
addTarget(targets, FaderParam.MOD, targetFor(simpler.Pitch.PitchLfoAmount));
|
||||
|
||||
Reference in New Issue
Block a user