All books

The MIDI channel filter: one sequencer, many instruments

~2 min read · updated 2026-09-28 · markdown

By default a .dsp is Omni — it reacts to notes on every MIDI channel. That's fine for one instrument; with several DSPs on the bus, every note plays every instrument. The fix is the per-DSP channel filter:

declare options "[midi:chan 2][midi:on][nvoices:8]";

[midi:chan N] (1–16) is a FaustWave convention token in the declare options string — libfaust ignores it; the DSP's MIDI handler filters on it. Absent token = Omni.

What the filter applies to (one rule everywhere since the pre-arm round): notes, pitch bend, and the two panic CCs (120 All Sound Off, 123 All Notes Off) are channel-scoped — they are what a wrong channel would make audible. Everything else passes regardless of channel: system messages, clock, program change, and ordinary CCs. A CC that should listen on one channel only says so per control, with [midi:ctrl N CH] in the parameter's metadata — that is the one per-patch channel scoping Faust itself understands.

You rarely write it by hand. The action does it for you, live on the running DSP, no recompile:

  • dsp.midi.channel.set { module_id, channel } — 0 = Omni (removes the token), 1–16 = accept only that channel. Marks the buffer dirty; documents.save persists.
  • Read the current value from documents.list → midi_channel.
  • Builder twin: the midi_note node's channel param / dsp.midi.channel.set — same semantics on the visual side.

The multi-timbral recipe

  1. Give every instrument DSP its channel: lead → 1, bass → 2, drums → 3, …
  2. Give every sequencer track the matching channel: sequencer.track.midi-channel.set { track_id, channel }.
  3. Patchbay-connect sequencer-default:out to each DSP's :midi-in sink (the bus is filter-free by design — receivers do the filtering).
  4. Play. Each track now drives exactly one instrument.

Auditioning a single instrument respects the same rule: midi.note.play { note, channel } — a filtered DSP still lists in midi_consumers but silently drops other-channel notes, so when an audition note stays silent, check the receiver's channel before suspecting broken MIDI.

Try it yourself — the IDE runs in your browser. Open the IDE → Get the desktop app

Text licensed under CC BY 4.0 — Mani Weber / FaustWave. For language models: llms.txt · llms-full.txt

AUDIO · 48k · 48.0ms FAUST · 3 KB · 1171 docs CPU · 8.4% BPM · 120.0 UTF-8 BETA· v0.90.0