45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { getPadEnvelopeState, getPadSoundState } from '../src/lib/exporters/ableton/padSound';
|
|
import { AblTrack } from '../src/lib/transformers/ableton';
|
|
|
|
const track = {
|
|
volume: 0.75,
|
|
pitch: -3,
|
|
playMode: 'key',
|
|
pan: 0.25,
|
|
trimLeft: 100,
|
|
trimRight: 1000,
|
|
attack: 64,
|
|
release: 128,
|
|
timeStretch: 'bars',
|
|
timeStretchBpm: 92,
|
|
timeStretchBars: 2,
|
|
rootNote: 48,
|
|
soundLength: 4,
|
|
} as AblTrack;
|
|
|
|
test('keeps static pad sound settings separate from group fader state', () => {
|
|
assert.deepEqual(getPadSoundState(track), {
|
|
amp: 0.75,
|
|
pitch: -3,
|
|
playMode: 'key',
|
|
pan: 0.25,
|
|
trimStart: 100,
|
|
trimEnd: 1000,
|
|
envelope: { attack: 64, release: 128 },
|
|
time: { mode: 'bars', bpm: 92, bars: 2 },
|
|
rootNote: 48,
|
|
soundLength: 4,
|
|
});
|
|
});
|
|
|
|
test('maps only pad ENV values into the static Classic envelope', () => {
|
|
const envelope = getPadEnvelopeState(getPadSoundState(track));
|
|
|
|
assert.equal(envelope.classicAttackMs, (64 / 255) * 4000);
|
|
assert.equal(envelope.classicReleaseMs, (128 / 255) * 4000);
|
|
assert.equal(envelope.oneShotFadeInMs, 0);
|
|
assert.equal(envelope.oneShotFadeOutMs, 5);
|
|
});
|