Hermetic Modular

Capicola: first look

By Luke Pendergrass

alchemy-lab · alchemy-sdk · daisy · open-source-eurorack

Capicola system overview block diagram: audio in feeds a keyframer whose output runs through a saturator and bandpass filter feedback loop to audio out, while input and output detectors drive trigger and envelope outputs

An exciting announcement today: a first look at a new Alchemy Lab firmware coming very soon!

Capicola is a new real-time time stretch algorithm built for cheap execution on embedded hardware, and it is running today on Daisy, inside the Alchemy Lab. Matthew Nielsen wrote it, his paper on the method was peer reviewed for DAFx26, and his full Daisy implementation is open source. This is a first look: the formal announcement and the firmware release come later, and today is about the video, the paper, and the code.

What is keyframe time stretching?

The phase vocoder and WSOLA stretch audio well at the cost of an FFT or a cross-correlation per frame, and on a microcontroller that cost is the whole budget. Matthew's method, Keyframe Time Stretching via Extrema Sampling, reduces the incoming signal to its timestamped local extrema, a sparse set of keyframes whose spacing tracks the signal's local information density. Plain overlap-add uses one fixed crossfade length that suits neither transients nor sustained sounds; the keyframe method sets the crossfade from the extrema density sample by sample. It comes out an order of magnitude cheaper than a phase vocoder or WSOLA, with added saturation and some spectral contrast loss as the dominant artifacts rather than smeared transients. The paper will be presented at DAFx26 in Cambridge, Massachusetts, September 1 to 4.

What Capicola does with it

Capicola is the hardware embodiment: a stereo time stretcher, pitch shifter, transient detector, and envelope follower in one Alchemy Lab firmware. Incoming audio is stretched continuously while a TKEO-driven detector extracts its envelope and transients in parallel. When a transient crosses the threshold, the lagging read head snaps to the present with a short crossfade and stretches from there, so the stretched tails ring out underneath while the output stays locked to the incoming rhythm. Pitch and time are fully decoupled, the stretch knob runs from real time to a true freeze, and both envelopes and both transient gates come out on the CV jacks, where they can also modulate every performance knob. The DSP is Matthew's; the pot catch, paging, preset storage, and LED rings come from the Alchemy SDK, which is what the SDK is for.

Go read the code

The capicola repository is AGPL-3.0 and builds with CMake presets on top of the Alchemy SDK submodule: src/main.cpp is the entire UI, src/audio/ owns the routing, and lib/ is the DSP core. Start with lib/KeyframeRecorder.h, the method from the paper, written for offline recording and playback as well as real time, so it works outside the Alchemy Lab too. The rest of lib/ is worth reading on its own:

  • Zavalishin zero-delay-feedback filters, one-pole and state variable.
  • A delay line with Hermite or B-spline interpolated reads that also returns first and second derivatives and the Teager-Kaiser energy operator.
  • Tabulated functions for cheap tanh(), sin(), and friends.
  • The TKEO peak detector with adaptive thresholding that drives the slicing.

What comes next

A formal announcement and a firmware release are coming. Until then: watch the video, read the paper, and go through the code. If you build something with KeyframeRecorder.h, or want to run it on your Alchemy Lab, come by the Discord.