Add four pedals: Mu-Tron, Auto-Wah, Feedback Delay, Multi-Tap Delay

Two envelope filters and two delays, registered in PedalRegistry and
showcased on demo Board 3.

- Mu-Tron: wraps the MuTronIII generator; three parallel LP/BP/HP
  instances switched live by a Select on the mode knob so filter state
  stays warmed across mode changes. Knobs: Mode, Sensitivity, Resonance.
- Auto-Wah: explicit amplitude-tracking chain — AmplitudeFollower scaled
  by sensitivity, clamped, mapped through LinExp to a swept SVF bandpass.
  Knobs: Sensitivity, Resonance, Range.
- Feedback Delay: DelayLineFeedback (cubic) into an RBJ lowpass for a
  darker, tape-style multi-repeat echo. Knobs: Time, Feedback, Tone.
- Multi-Tap Delay: three non-feedback DelayLine taps summed, per-tap
  volume folded into each tap's mul. Six knobs in two rows of three.

Bumps the Lyrebird dependency to 1.2.0 for the MuTronIII/SVF generators.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 15:07:34 -07:00
parent 6f55615d7b
commit c28e7cac90
11 changed files with 882 additions and 7 deletions
@@ -0,0 +1,115 @@
// MuTronPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Envelope-following filter pedal modeled on the Musitronics Mu-Tron III.
///
/// Wraps the Lyrebird `MuTronIII` generator. The input amplitude drives an exponential
/// cutoff sweep through a resonant Chamberlin state-variable filter. Because `MuTronIII`
/// fixes its filter `mode` at `init`, three instances (lowpass, bandpass, highpass) run
/// in parallel on the shared dry signal and a `Select` switch picks the active one from
/// the `mode` knob — this keeps all three filter states warmed so mode changes are
/// click-free (SuperCollider `Select` semantics: every input advances each block).
///
/// ## Knobs
/// - `mode`: Filter response. `0` = lowpass, `1` = bandpass (classic vowel wah), `2` = highpass.
/// - `sensitivity`: Drive into the envelope follower; higher values open the filter on quieter notes.
/// - `resonance`: Filter peak emphasis at the swept cutoff.
public final class MuTronPedal: Pedal {
// MARK: - Parameters
/// Filter response selector. `0` = lowpass, `1` = bandpass, `2` = highpass.
@UIParam public var mode: Double = 1.0
/// Envelope-follower drive. Higher values make the filter respond to quieter input.
@UIParam public var sensitivity: Double = 1.5
/// Filter resonance (Chamberlin SVF peak emphasis). Clamped to `≥ 1.0` internally.
@UIParam public var resonance: Double = 4.0
// MARK: - Constants
private static let defaultMix: Double = 1.0
/// Sweep direction is fixed to the classic "louder opens the filter" response.
private let sweepDirection: MuTronIIISweep = .up
/// Cutoff at zero envelope, in Hz.
private let freqLo: Double = 80.0
/// Cutoff at maximum envelope, in Hz (≈40× sweep over `freqLo`).
private let freqHi: Double = 3200.0
/// Envelope attack/release times, in seconds.
private let attackTime: Double = 0.005
private let releaseTime: Double = 0.15
/// Half-step bias added before `Select`'s truncate-toward-zero index, turning the
/// `mode` knob into a round-to-nearest 3-position switch over `[0, 2]`.
private let modeRoundingBias: Double = 0.5
// MARK: - Ranges
private let modeRange: ClosedRange<Double> = 0.0 ... 2.0
private let sensitivityRange: ClosedRange<Double> = 0.0 ... 4.0
private let resonanceRange: ClosedRange<Double> = 1.0 ... 12.0
// MARK: - Knobs
public override var effectKnobs: [PedalKnob] {
[
PedalKnob(label: "Mode", node: $mode, range: modeRange),
PedalKnob(label: "Sensitivity", node: $sensitivity, range: sensitivityRange),
PedalKnob(label: "Resonance", node: $resonance, range: resonanceRange),
]
}
// MARK: - Init
public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(
name: "Mu-Tron",
inputBus: inputBus,
outputBus: outputBus,
initialMix: MuTronPedal.defaultMix
)
}
// MARK: - Effect
public override func effect(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
let lowpass: MuTronIII.Audio = makeFilter(dry, mode: .lowpass)
let bandpass: MuTronIII.Audio = makeFilter(dry, mode: .bandpass)
let highpass: MuTronIII.Audio = makeFilter(dry, mode: .highpass)
// Round the [0, 2] knob to the nearest integer index, then switch.
let which: any ValidGeneratorInput = $mode + modeRoundingBias
return Select.Audio(
which: which,
inputs: [lowpass, bandpass, highpass]
)
}
private func makeFilter(
_ dry: any ValidGeneratorInput,
mode: MuTronIIIMode
) -> MuTronIII.Audio {
MuTronIII.Audio(
input: dry,
mode: mode,
direction: sweepDirection,
sensitivity: $sensitivity,
peak: $resonance,
freqLo: freqLo,
freqHi: freqHi,
attackTime: attackTime,
releaseTime: releaseTime
)
}
}