Skip to content

Waldorf Quantum/Iridium: convert the vibrato and the tremolo of a source - #372

Open
douglas-carmichael wants to merge 2 commits into
git-moss:mainfrom
douglas-carmichael:qpat-lfo
Open

Waldorf Quantum/Iridium: convert the vibrato and the tremolo of a source#372
douglas-carmichael wants to merge 2 commits into
git-moss:mainfrom
douglas-carmichael:qpat-lfo

Conversation

@douglas-carmichael

Copy link
Copy Markdown
Contributor

The Waldorf Quantum/Iridium was the last of the larger formats without any LFO support: a source which carries a vibrato or a tremolo lost it, and a preset of the device which has one was read without it. This adds both, in the creator and in the detector.

Where the modulation goes

The device has 6 low frequency oscillators and 40 modulation matrix slots. The slots 1-3 are already spent on the pitch envelopes of the three oscillators (createPitchEnvelopeModulator, keyed to the oscillator index), so the two new modulations take the next free ones:

Slot Source Destination What
1-3 Free Env1-3 Osc1-3 Pitch pitch envelopes, unchanged
4 LFO 1 Pitch (index 1) vibrato
5 LFO 2 VCA (index 117) tremolo

Nothing has to give way: 5 of 40 slots and 2 of 6 LFOs is the most this creator ever writes, so the slots 6-40 and the LFOs 3-6 stay free for the user.

The vibrato uses the destination Pitch, which moves all three oscillators at once, rather than one slot per oscillator. That is one slot instead of three, and it matches what a vibrato of a multi-sample is - a property of the whole instrument, not of one of its layers. Reading also accepts the per-oscillator destinations Osc1/2/3 Pitch, since a preset written on the device may well use them.

The tremolo uses the destination VCA, the amplifier of the voice. Its oscillator is written unipolar with a negative amount, so the modulation attenuates from the full level downwards. A bipolar oscillator would press the first half of every cycle against the upper end of the amplifier and leave only the rectified half of the waveform audible - which is why the two modulations cannot share one LFO, the vibrato needs the bipolar swing around the played note.

The laws

The waveform, rate, delay and fade-in are converted with the laws of the sound engine, read out of the Iridium MK2 firmware (4.0.5). The parameter registrar at 0x100BE938 names every QPAT parameter and hands it the function which formats its value; those formatters are the laws:

  • rate: 1/240 Hz + (100 Hz - 1/240 Hz) * x^4 - the quartic gives 6.2539 Hz at the middle of the range, which is the default the manual documents, and 240 seconds at zero, which is the slowest speed it documents
  • delay: 20 * x^2 seconds
  • fade-in (the device calls it Attack): 10 * x^2 seconds
  • shapes: [0] Sine [1] Triangle [2] Square [3] Saw (down) [4] Saw (up) [5] S&H - a one-to-one map onto LfoWaveform

The vibrato depth converts the model's cent scale (IEnvelope.MAX_ENVELOPE_DEPTH) to the ±24 semi-tones one matrix slot reaches. The tremolo depth is scaled with the loudness law of the device (dB = 40*log10(x), the one Osc{n}Vol already uses), so a depth of 6 dB is an amount of -29.21 % and the maximum depth of the model, 96 dB, is -99.60 % - the swing from the full level down to silence, i.e. the end of the range of a slot. That the two ends coincide is the reason for using that law.

Every parameter the modulation depends on is written explicitly (Speed, Sync, Global, Shape, Polarity, Phase, Delay, Attack, Decay), so the result does not depend on what the previously loaded preset left in that oscillator.

Two things are deliberately not carried:

  • An oscillator of a read preset which is synchronized to the tempo of the song is skipped - its speed is a note length, and a multi-sample carries no tempo with which that could be converted into Hertz.
  • The key sync flag of the model is not written; both oscillators are always written in the Poly mode. No source format fills that flag today, so honouring its false default would put every converted preset on a free-running, voice-shared LFO, which is not what a vibrato or a tremolo of a sampled instrument does.

What was verified

In software, with a build of this branch:

  • SFZ -> QPAT: every written value matches the firmware laws by hand-calculation (rate 5.5 Hz -> 0.48418677, delay 0.25 s -> 0.1118034, fade-in 1.5 s -> 0.38729835, 50 cents -> +2.08 %, 6 dB -> -29.21 %).
  • SFZ -> QPAT -> SFZ: Tremolo: 4.00 Hz, depth 6.0 dB, delay 0.100 s, fade-in 0.800 s and Vibrato: 5.50 Hz, depth +50 cents, delay 0.250 s, fade-in 1.500 s come back identically (the analysis details of -ad).
  • QPAT -> QPAT is a fixpoint: 44 parameters in, 44 out, zero differences.
  • All six waveforms round-trip through QPAT -> QPAT.
  • Edge cases, on hand-patched presets: a disabled slot reads nothing; a tempo-synchronized oscillator reads nothing; a free phase is not read; a vibrato on Osc2 Pitch is correctly not applied to oscillator 1; a full-range tremolo reads back as exactly 96 dB; an over-range source is clamped (-9600 cents -> the -2400 the device can reach, 120 Hz -> 100 Hz, a 40 s delay -> 20 s).
  • No regression: a source without LFOs writes no Lfo* and no Matrix* parameter at all, and the 141 presets of an Iridium library read with zero errors and zero spurious vibrato or tremolo - none of them routes an LFO to Pitch or VCA.

Not verified on hardware: the scale of the VCA destination. The modulation matrix is additive in the destination's own normalized units (ModMatrix::calc at 0x100A1884: dest += source * (2*amount - 1), clamped), but the consumer which turns the VCA slot into a gain is not in the part of the firmware I decoded, so how many dB an amount of 100 % actually attenuates is inferred from the device's level law rather than read out of it. Everything else above is either firmware-exact or a round-trip result. I have an Iridium MK2 and can check the tremolo depth against the device.

Base

Branched on top of #367 (Waldorf Quantum/Iridium: keep the instant attack of a percussive sound), which touches the same creator - that PR's commit is the first of the two here. Merging #367 first leaves this one as a single commit.

The device cannot play an amplitude stage shorter than 0.07 seconds. A
shorter one was therefore lifted to that length, so that it would not
collapse into an instant stage, which snaps the VCA open and clicks when
the audio does not start at a zero crossing.

That lift was applied to every source. A sampled instrument, however,
carries its attack in the audio itself and starts at silence, so there
was nothing to click - the lift only faded the recorded attack in over
70 milliseconds and took the strike off every piano, plucked string and
drum. An Akai S-1000 electric piano asks for 3 milliseconds and was
written as 70, which is 23 times longer.

The audio of the zones is now measured and the stage is only lifted when
a zone really starts with a step which can be heard: more than 2 % of
the peak level of that audio, the ratio at which the wrap of a loop
becomes audible. The measurement runs only for a preset whose attack is
short enough to be affected at all.

Of the 117 presets of a commercial CD-ROM 78 regain their instant attack
and 1 - whose audio starts at 3.5 % of its peak - keeps the lift. An
instant attack is what the device uses for a percussive sound itself:
35 % of 141 presets written by an Iridium set the amplitude attack to 0.
The format was the last of the larger ones without any LFO support: a
source which carries a vibrato or a tremolo lost it, and a preset of the
device which has one was read without it.

Both are routed through the modulation matrix. Of its 40 slots the first
three already carry the pitch envelopes of the three oscillators, so the
vibrato takes the slot 4 and the tremolo the slot 5 and the slots 6-40
as well as the LFOs 3-6 stay untouched for the user. The vibrato drives
the destination "Pitch", which moves all three oscillators with a single
slot instead of one slot per oscillator - a vibrato of a multi-sample
belongs to the whole instrument and not to one of its layers. Reading
also accepts the per-oscillator destinations "Osc1/2/3 Pitch", which a
preset of the device may well use.

The tremolo drives the destination "VCA". Its oscillator is written
unipolar with a negative amount, so the modulation attenuates from the
full level of the amplifier downwards; a bipolar one would press the
first half of every cycle against the upper end of the amplifier and
leave only the rectified half of the waveform. The depth is scaled with
the loudness law of the device, where the maximum depth of the model
(96 dB) becomes the swing from the full level down to silence - which
is an amount of -99.6 % and therefore also the end of the range of a
matrix slot.

The waveform, rate, delay and fade-in use the laws of the sound engine,
which were read from the firmware of an Iridium MK2 (4.0.5): the rate is
1/240 Hz + (100 Hz - 1/240 Hz) * x^4, the delay is 20 * x^2 seconds and
the fade-in 10 * x^2 seconds. The quartic gives at the middle of its
range 6.2539 Hz, which is the default the manual documents, and at zero
the 240 seconds it documents as the slowest speed. The six shapes of the
device map one to one onto the waveforms of the model.

Every parameter the modulation depends on is written, so that the result
does not depend on what the previously loaded preset left in that
oscillator. An oscillator of a read preset which is synchronized to the
tempo of the song is skipped, since a multi-sample carries no tempo with
which its note lengths could be converted into Hertz.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant