// ChimeAmpPedal.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import LyrebirdSynth import LyrebirdUI /// Chimey/jangly amp (bell-like top boost) with a **Cut** control that rolls off the high end as /// it's turned up — the classic top-boost "Cut" behavior. /// /// A ``AmpVoicePedal`` fixed to the chime tone stack. public final class ChimeAmpPedal: AmpVoicePedal { /// Cut amount in [0, 1]: `0` = fully open/bright, `1` = darkest. Maps to a low-pass cutoff /// swept from `cutOpenHz` down to `cutDarkHz`. @UIParam public var cut: Double = 0.2 private let cutOpenHz: Double = 9000.0 private let cutDarkHz: Double = 2500.0 private let cutQ: Double = 0.707 public override var toneStackModel: ToneStackModel { .vox } public override var summaryText: String { "Chimey top-boost jangle with a Cut control that tames the highs." } public override var signatureKnobs: [PedalKnob] { [PedalKnob(label: "Cut", node: $cut, range: signatureRange)] } /// Creates a Chime amp. /// /// - Parameters: /// - inputBus: Audio bus index to read the dry input from. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. public init(inputBus: Int = 0, outputBus: Int = 0) { super.init(name: "Chime", inputBus: inputBus, outputBus: outputBus) gain = 5.0 } public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { // cut 0 → cutOpenHz (bright), cut 1 → cutDarkHz (dark). let cutoff: LinLin.Audio = LinLin.Audio( $cut, inLo: 0.0, inHi: 1.0, outLo: cutOpenHz, outHi: cutDarkHz) return RBJLowPass.Audio(input: signal, freq: cutoff, q: cutQ) } }