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:
@@ -0,0 +1,118 @@
|
||||
// AutoWahPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Amplitude-tracked auto-wah pedal built from discrete tracking + filter stages.
|
||||
///
|
||||
/// Unlike `MuTronPedal` (which wraps the single fused `MuTronIII` generator), this pedal
|
||||
/// wires the envelope path explicitly: an `AmplitudeFollower` tracks the dry signal level,
|
||||
/// the envelope is scaled by `sensitivity` and clamped to `[0, 1]`, then mapped through an
|
||||
/// exponential `LinExp` curve to a cutoff frequency that sweeps a resonant `SVF` bandpass.
|
||||
/// Louder playing opens the filter — the classic "wah" vowel that follows your picking.
|
||||
///
|
||||
/// ## Signal path
|
||||
/// ```
|
||||
/// dry → AmplitudeFollower → ×sensitivity → Clip[0,1] → LinExp(freqLo…range) → SVF.bandpass
|
||||
/// ↑freq
|
||||
/// ```
|
||||
///
|
||||
/// ## Knobs
|
||||
/// - `sensitivity`: How hard the envelope drives the sweep; higher reaches the top of the range sooner.
|
||||
/// - `resonance`: Bandpass Q. Higher values sharpen the vowel and add emphasis.
|
||||
/// - `range`: Upper cutoff in Hz reached at full envelope. Sets the sweep span over `freqLo`.
|
||||
public final class AutoWahPedal: Pedal {
|
||||
|
||||
// MARK: - Parameters
|
||||
|
||||
/// Envelope drive into the cutoff sweep. Higher values open the filter on quieter input.
|
||||
@UIParam public var sensitivity: Double = 2.0
|
||||
|
||||
/// Bandpass resonance (SVF quality factor). Higher values sharpen the wah vowel.
|
||||
@UIParam public var resonance: Double = 3.0
|
||||
|
||||
/// Upper cutoff frequency in Hz at maximum envelope.
|
||||
@UIParam public var range: Double = 2400.0
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
private static let defaultMix: Double = 1.0
|
||||
|
||||
/// Cutoff at zero envelope, in Hz. `LinExp` requires a strictly positive lower bound.
|
||||
private let freqLo: Double = 200.0
|
||||
|
||||
/// Envelope-follower attack/release times, in seconds.
|
||||
private let attackTime: Double = 0.01
|
||||
private let releaseTime: Double = 0.12
|
||||
|
||||
/// Clamp bounds for the scaled envelope before the exponential frequency map.
|
||||
private let envFloor: Double = 0.0
|
||||
private let envCeiling: Double = 1.0
|
||||
|
||||
// MARK: - Ranges
|
||||
|
||||
private let sensitivityRange: ClosedRange<Double> = 0.0 ... 4.0
|
||||
private let resonanceRange: ClosedRange<Double> = 0.5 ... 8.0
|
||||
private let rangeRange: ClosedRange<Double> = 500.0 ... 5000.0
|
||||
|
||||
// MARK: - Knobs
|
||||
|
||||
public override var effectKnobs: [PedalKnob] {
|
||||
[
|
||||
PedalKnob(label: "Sensitivity", node: $sensitivity, range: sensitivityRange),
|
||||
PedalKnob(label: "Resonance", node: $resonance, range: resonanceRange),
|
||||
PedalKnob(label: "Range", node: $range, range: rangeRange),
|
||||
]
|
||||
}
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(
|
||||
name: "Auto-Wah",
|
||||
inputBus: inputBus,
|
||||
outputBus: outputBus,
|
||||
initialMix: AutoWahPedal.defaultMix
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Effect
|
||||
|
||||
public override func effect(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
// Track the dry signal's amplitude envelope.
|
||||
let envelope: AmplitudeFollower.Audio = AmplitudeFollower.Audio(
|
||||
in: dry,
|
||||
attackTime: attackTime,
|
||||
releaseTime: releaseTime
|
||||
)
|
||||
|
||||
// Scale by sensitivity and clamp to [0, 1] so the exponential map stays in range
|
||||
// and the swept cutoff never exceeds `range` (and thus never approaches Nyquist).
|
||||
let driven: Clip.Audio = Clip.Audio(
|
||||
envelope * $sensitivity,
|
||||
lo: envFloor,
|
||||
hi: envCeiling
|
||||
)
|
||||
|
||||
// Map the clamped envelope to an exponential cutoff sweep from freqLo to range.
|
||||
let cutoff: LinExp.Audio = LinExp.Audio(
|
||||
driven,
|
||||
inLo: envFloor,
|
||||
inHi: envCeiling,
|
||||
outLo: freqLo,
|
||||
outHi: $range
|
||||
)
|
||||
|
||||
// Resonant bandpass swept by the tracked envelope — the wah voice.
|
||||
let filtered: SVF.Audio = SVF.Audio(
|
||||
input: dry,
|
||||
freq: cutoff,
|
||||
q: $resonance
|
||||
)
|
||||
return filtered.bandpass
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user