Skip to content

Elektron Tonverk: loops are written as the Tonverk loads them - #491

Open
douglas-carmichael wants to merge 2 commits into
git-moss:mainfrom
douglas-carmichael:fix-tonverk-loop-limits
Open

douglas-carmichael wants to merge 2 commits into
git-moss:mainfrom
douglas-carmichael:fix-tonverk-loop-limits

Conversation

@douglas-carmichael

@douglas-carmichael douglas-carmichael commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

With the category and tags of #490, Michael Oakley's 32 TAL-Sampler presets converted to Tonverk presets show up in the preset menu of the Tonverk, but 8 of them cannot be loaded: The Call Of Africa, Prophet Voices, Power Brass, PPG Power Keys, Lush Choir, John Hughes Movies, Domino Dancing and Crocketts Revenge. Each of them breaks one of two rules which all 3,388 looped samples of the factory library follow:

  • A loop ends at least one frame before the end of its sample. 120 factory samples loop up to exactly one frame before it, none to the last frame. clampLoops clamps a loop end to the last frame, and the converted loops of John Hughes Movies, Prophet Voices, Power Brass, The Call Of Africa, PPG Power Keys, Lush Choir and Crocketts Revenge end there - the end of the source sample.
  • A loop cross-fade is shorter than the audio in front of the loop start, which the Tonverk cross-fades the end of the loop with (the factory cross-fades are always at least 198 frames shorter). The cross-fades from the source are longer than that: as long as the whole loop (Crocketts Revenge), in front of a loop which starts at frame 0 or 5 (Lush Choir, PPG Power Keys), or 2,448 frames in front of 1,816 (Domino Dancing).

Domino Dancing breaks only the second rule, and John Hughes Movies, Prophet Voices, Power Brass and The Call Of Africa only the first, so each rule alone stops a preset from loading. None of the 24 presets which load breaks either rule.

Changes

Both the preset writer and the multi-sample writer, after trimming a sample and clamping its loops:

  • fitLoopCrossfades: a cross-fade which does not fit moves the loop start forward until 256 frames of the sample are left in front of the cross-fade (the factory cross-fades leave at least 198), so the cross-fade blends the end of the loop into the audio which the loop skips, like a sampler which cross-fades into the start of the loop. A cross-fade which covers most of the loop is limited to half of the remaining loop (the factory cross-fades are at most 71.5% of their loop). The start of a single-cycle loop (up to 512 frames) is not moved, since its length is its pitch; its cross-fade is shortened instead. Every changed loop is logged.
  • addFrameBehindLoop: a sample whose (first) loop ends on its last frame gets one more frame, a copy of the first frame of the loop. That is the frame which follows the loop end when the loop plays, so the loop and the sound stay as they are.

The first commit shortened a cross-fade which did not fit. That made the loops click which the source cross-fades over a jump: the loops of Lush Choir and Crocketts Revenge start at frame 0, so their cross-fade became 0, over a jump of 18 to 55 times the normal change between two frames. The second commit moves the loop start instead.

CHANGELOG and README-FORMATS describe both. The CHANGELOG entry adds an Elektron Tonverk Preset block at the same place as #490, so whichever of the two is merged second needs both bullets under one heading.

Verification

  • The 32 presets as they were written before (the ones loaded on the device) converted from Tonverk to Tonverk, with main 31b0f8a and with this branch: with main, 16 of the 43 loops are outside what the factory samples do (loop end on the last frame, cross-fade longer than the audio in front of the loop start or covering the whole loop, loop start at frame 0); with this branch none, and 9 loops are logged as changed. Only the files of the 8 presets which did not load differ: samples with one frame more (the audio in front of it is unchanged, the new frame is the first frame of the loop), moved loop starts in the presets and the smpl chunks. The files of the other 24 presets are byte-identical.
  • Lush Choir, Domino Dancing, PPG Power Keys and The Call Of Africa keep the cross-fade of the source; the three loops of Crocketts Revenge which cross-faded over the whole loop now cross-fade over a third of it (1 to 3 seconds). With the cross-fade applied in front of the loop start, every changed loop wraps with a step of the size of the normal change between two frames of its audio - e.g. Lush Choir 0.009 instead of 0.064 without a cross-fade, with 0.007 being normal there.
  • Built on main 31b0f8a.
  • The 8 corrected presets have not been loaded on the device yet.

8 of 32 converted presets showed up in the preset menu of the Tonverk
but could not be loaded. Each of them has a loop which ends on the last
frame of its sample or whose cross-fade is longer than the audio in
front of the loop start. The loops of the factory samples always end at
least one frame before the end of their sample (120 of them exactly one
frame before it) and their cross-fades are always shorter than the
audio in front of the loop start, which the Tonverk cross-fades the
end of the loop with.

After trimming, a sample whose loop ends on its last frame gets the
first frame of the loop appended - the frame which follows the loop end
when it plays - so the loop and the sound stay the same, and a longer
cross-fade is shortened to the audio in front of the loop start; the
shortening is logged. Both the preset and the multi-sample writer do
this.
Shortening a cross-fade to the audio in front of the loop start makes
the loops click which the source cross-fades over a jump: in 'Lush
Choir' and 'Crocketts Revenge' the loops start at frame 0, so their
cross-fade became 0, over a jump of 18 to 55 times the normal change
between two frames.

A cross-fade which does not fit now moves the loop start forward until
256 frames of the sample are left in front of the cross-fade (the
factory cross-fades leave at least 198), so the cross-fade blends the
end of the loop into the audio which the loop skips, like a sampler
which cross-fades into the start of the loop. A cross-fade which covers
most of the loop is limited to half of the remaining loop (the factory
cross-fades are at most 71.5% of their loop). The start of a
single-cycle loop is not moved, since its length is its pitch; its
cross-fade is shortened instead. Every changed loop is logged.
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