Skip to content

Pitchbox 0.1.0-experimental (draft): a pitch shifter and harmonizer for FX2 - #2688

Draft
jrs1717 wants to merge 8 commits into
repeat98:mainfrom
jrs1717:module/pitchbox
Draft

jrs1717 wants to merge 8 commits into
repeat98:mainfrom
jrs1717:module/pitchbox

Conversation

@jrs1717

@jrs1717 jrs1717 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

What works: Pitchbox is a new pitch shifter and harmonizer for FX2 of any track, heard on the author's MKII ("sounds really cool!"). It works on any audio in the slot, including live input, Thru and Neighbor tracks. Repitch, by contrast, changes how a stock machine plays its own sample.

  • Voice 1 (PTCH) and voice 2 (INTV, brought in by VOC2): each -12 to +12 semitones, for octaves, fifths and triads.
  • FINE tunes both voices; DTUN detunes them apart with a slow drift; GLID slides pitch changes; FDBK makes rising or falling spirals.
  • DLY2 delays voice 2 up to 100 ms; TONE, WIDE and MIX shape the result.
  • MODE: SMTH (46 ms), TIGHT (23 ms), GRIT (12 ms, hard-switched) and ARP. ARP steps voice 1 through 0, PTCH, INTV and +12 on sixteenths at the tempo, restarting on its track's trigs.
  • Waveform-matched splice: a silent head searches for the offset that best matches the playing head before it fades in, so long notes keep their pitch.

In dsp_host it matches its reference model bit for bit (43 gates). Idle and DC pass the audio check in every mode, and a full-feedback tail ends in exact silence.

What is open:

  • The test procedure and the author's stage on the unit come next.
  • Cost: worst 409.7 executed DSP instructions a sample, 1.30x SPRING REV, under the base's admission line (about 414). The work done once a call happens once per 16 frames, so a trig split never doubles it in a block. The record justifies the cost.
  • ARP doesn't follow track speed or swing; the base's planned step clock for DSP effects would cover that. Documented.
  • It waits behind the author's other modules in the review queue.

Who acts: @jrs1717, the unit stage. Ran on a unit: RAM trials only so far.

Not tested on a unit: heard in RAM trials; the test procedure comes next.

Edge cases:

Case Why this change makes it a risk How run Result
Full feedback with both voices the loop gain could pass 1 FDBK x 0.75 x (1 - VOC2 / 2); test: the tail dies away; verify.py: exact silence after 10 s passed in dsp_host
DLY2 turned while playing voice 2's read position moves it slides a sample a sample; test: never more than 1 a sample passed in the model; verify.py bit for bit
MODE changed while playing, FDBK up the window jumps under the heads the wet fades, no feedback while pending, the swap, a fade in; verify.py with and without splits passed in dsp_host; not yet heard
Trig splits per-call work would double one full call per 16 frames; perf.py: worst 409.7 over every split passed in dsp_host
ARP: tempo jumps and trigs step bursts, late restarts the sixteenth restarts on a tempo change; a trig starts the figure at its sample; verify.py at 30, 120 and 300 BPM passed in dsp_host
An FX1-sized slot the ring needs FX2's buffer passes the track dry; verify.py passed in dsp_host
Details
  • A fresh-session code review found five bugs, all fixed and tested: runaway feedback with VOC2, DLY2 clicks, a click on a MODE change with feedback, an ARP burst after a tempo jump, and a splice search biased to one side. Earlier, while building: the crossfade's gain could go negative (a silent head played inverted), and the first call seeded the pitch step into the wrong word.
  • test_reference.py 21/21; fx:audit idle and DC pass; perf:audit passes and is stamped.
  • Guides: nothing yet.

🤖 Generated with Claude Code

Jason Stephenson and others added 8 commits December 5, 2026 16:44
Two voices read a stereo ring in the FX2 slot's buffer with two crossfading heads each (a delay-line shifter): PTCH
and INTV -12..+12 semitones (2^x from a 4th-order polynomial once a call), FINE, DTUN, GLID, FDBK, TONE, WIDE, MIX
and MODE (SMTH 46 ms, TIGHT 23 ms, GRIT 12 ms hard-switched). verify.py holds engine.asm (from gen_engine.py) to
reference.py bit for bit in dsp_host: 35 gates, exact silence after a full-feedback tail. 356 executed instructions
a sample unsplit (about 1.13x SPRING REV). Not yet run on a unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…RP mode; the crossfade's gain floored at 0

The crossfade's gain was only limited at full scale, so a silent head played inverted at full level: fixed in model
and engine. While a head is silent after its wrap, each call tries one offset in -K..K against the playing head (four
words 8 frames apart) and keeps the best, so long notes keep their pitch (SMTH and TIGHT put nearly all energy on the
target in the model's tone tests). DLY2 delays voice 2 up to 100 ms (glided); DTUN's depth drifts at 0.15 Hz; ARP
steps voice 1 through 0, PTCH, INTV, +12 a sixteenth at the tempo, restarting on the track's trigs (r6+$12 bit 15).
The ring grows to 7,680 frames with a 32-frame guard. verify.py bit-exact (43 gates); 392.5 unsplit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t), perf.py; worst 400.7

A call that brings fewer than 16 frames since the last full one only counts (the arpeggio, the drift's phase) and
holds the runs; targets, steps and the splice wait for the full call, so a trig split never doubles the per-call
work. Worst 400.7 executed instructions a sample (moving, split 10), under the base's admission line (about 414).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lly cool!")

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce, ARP timing and trig, DLY2, drift, light calls, mode change, silence)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…performance record, README and the sleeve

Feedback x 0.75 x (1 - VOC2 / 2), so the loop gain stays under 0.85 with both voices (it reached 1.7); off while a
MODE change is pending. Voice 2's DLY2 delay slides a sample a sample (it jumped hundreds a call). A tempo change
restarts ARP's sixteenth; a trig starts the figure at its sample. The splice searches outward from 0.
test_reference.py 21/21; verify.py bit-exact; fx:audit idle and DC pass in every mode; worst 409.7 (1.30x), stamped.
The sleeve waits in presentation/ until listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…), its edge cases, the screens

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ower cycle: everything survived)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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