Skip to content

audiodev: a live audio path for stompbox use — an input pull-source node and a low-buffer duplex I2S loop #26

Description

@bdbarnett

Stakes

The effects program is rebuilding all 46 audioeffects classes with documented, near-zero algorithmic latency, and one intended use is a stompbox on a stage — a single effect or a chain. On today's audio path those effects cannot be played live, whatever they do internally:

  • lib/audiodev/sample_out.py pumps playback in 40 ms chunks with a two-chunk lookahead.
  • The "low" latency profile queues 100 ms into machine.I2S's ibuf (LOW_LATENCY_QUEUE_MS); capture is opened at queue_ms=150 (board_peripherals.audio_in()).
  • The README's own measurement on the host: 52 ms steady at "low", 418 ms at the default.
  • PCMInput exists (I2S, SDL, wasm) but nothing wraps a live input as an audioif pull-source, so an input cannot head an effect graph today.
  • On the P4 panel, playback and capture cannot run together — both open I2S(0) (P4 panel: playback and capture cannot run together — both directions open I2S(0) #23).

A stompbox built on this path would sit at a hundred milliseconds or more round trip, against the roughly ten a player starts to feel. The effect graph itself is not the problem: a filter, a drive, a modulation or a delay's dry path add zero; only the convolver's 256-frame partition, an opt-in limiter lookahead and the pitch shifter's window add any, and those are the effects program's to minimise and document.

The ask — a platform spike, not scheduled

  1. A live-input pull-source: an object over PCMInput that speaks the audiosample protocol (audiocore.get_buffer / reset_buffer) so a live input can be the source of any audioeffects class or Rack.
  2. A tight duplex loop: I2S-in → graph → I2S-out with DMA-sized buffers (a few milliseconds, not a hundred), most likely pumped in C the way the output pump already is arranged; full duplex on the P4 per P4 panel: playback and capture cannot run together — both directions open I2S(0) #23.
  3. A loopback latency harness: a click through a wire, output jumpered to input, measured on the P4 and the S3 at each buffer setting. The effects program's Phase 1 will measure today's path this way, wire and five-effect chain, and link the numbers here so the gap is a number.
  4. The target: a round trip under 10 ms is the working assumption; the effects survey sources the perceptible-delay figure and this issue adopts it.

Boundary

The effects program (workspace docs/effects-vision.md §9a, docs/effects-roadmap.md Phase 0/1, and hardware concept C2 in docs/hardware-products.md) owns per-class latency budgets and reporting; this issue is the platform half. It is filed so the seam is real before anyone builds the pedal; it is not on a schedule.

Trigger: the Phase 1 round-trip numbers land, or a stompbox build starts.

Related: #23 (P4 duplex), #24 (mck= ignored on esp32), usbif's M5 (a USB-mic capture path that already exists and could head a graph the same way).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions