An Arduino sketch for the OpenMusicLabs StompShield that creates a rhythmic octave-up "arpeggio" effect by alternating between normal-speed and double-speed playback of a short live audio buffer. The rotary encoder on the pedal sets the alternation rate.
- Arduino (Uno / 328-based)
- OpenMusicLabs StompShield
- Rotary encoder wired to the shield (A → D2, B → D4, button → D7)
This sketch started as stomp_updown.pde, one of the example sketches that ships with the StompShield (OpenMusicLabs, 7.15.13). The original demonstrated buffered playback by sweeping a read pointer through a 1000-sample ring buffer — forward at double speed, then backward at single speed, bouncing at the buffer boundaries. The rotary encoder was wired up by the shield but not used by the sketch.
Instead of bouncing the read pointer back and forth, this version keeps it moving forward and toggles its step size between 1 (normal pitch) and 2 (octave up) at a regular interval. The result is a two-note stutter — the input signal plays at its original pitch, then jumps an octave, then drops back, repeating. With a guitar going in, it sounds like a very tight octave-up arpeggio.
Specifically:
- Bounce → alternation. The original
dir/offsetbounce logic was replaced with a single forward-advancingplayLocationwhose increment is either+1or+2depending on adoubleSpeedflag. - Mode flip in the ISR. An
intervalCountcounter inside theTIMER1_OVF_vectISR flipsdoubleSpeedeveryINTERVALaudio samples (the ISR runs at ~48 kHz, so 48 ticks ≈ 1 ms). - Rotary encoder is now live. A small
pollEncoder()routine runs fromloop()(polled ~1 kHz) and remaps the encoder's position toINTERVAL, giving a usable range from ~2 ms (fast warble) up to ~100 ms (slow, audible octave stutter). - Encoder button (D7) is wired but unused. Reserved for a future on/off bypass or rate reset.
stomp_arp.ino— the sketchsketch.properties— Arduino IDE metadata
Requires the OpenMusicLabs StompShield library on your include path. Open the folder in the Arduino IDE and upload to the board.
