Files
ShoeGaze/Sources/LyrebirdShoeGaze/Pedals/CitrusAmpPedal.swift
T
josh ac61b47d17 feat(amps): character amps — Command/Citrus/Sixties/Magna/Anaheim (Phase 8)
Five character voices:
- Command (Hiwatt) — BritishCombo variant: loud hi-fi clean, high headroom.
- Citrus (Orange) — .marshall, fixed mid bump + a single Shape tilt control.
- Sixties Combo (Supro) — .fender, gritty early breakup + onboard tremolo (shared
  tremolo helper + footswitch).
- Magna Vibrato (Magnatone) — .fender, TRUE pitch vibrato: a DelayLine whose delay
  is swept by an LFO (Speed/Depth + footswitch), not amplitude tremolo.
- Anaheim (Music Man hybrid) — .fender, symmetric-bias (solid-state-flavoured)
  preamp, huge headroom, Bright + Deep switches, and a built-in Limiter
  (LookAheadLimiter, ceiling 0.5 when engaged, before the power amp). True
  oversampled hard-clip SS shaper deferred to Lyrebird 1.7.x.

Registered across 6 sites as .amp. New CharacterAmpsTests suite (10 tests):
per-amp control/effect changes, Sixties tremolo bit-exact bypass, Magna vibrato
on≠off + fixed-delay-when-off, Anaheim switches + limiter engages hot, ceiling at
max for all five, tone-stack models, round-trip, registry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 15:36:06 -07:00

56 lines
2.2 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// CitrusAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// British **mid-forward crunch** — the Citrus voice: a thick, punchy midrange with a single
/// **Shape** control that tilts the top end from dark to bright.
///
/// A ``AmpVoicePedal`` on the `.marshall` stack with a fixed mid bump (the amp's signature push)
/// and a Shape high-shelf whose gain sweeps from cut to boost.
public final class CitrusAmpPedal: AmpVoicePedal {
/// Shape in [0, 1]: `0` = dark (top cut), `0.5` = flat, `1` = bright (top boost).
@UIParam public var shape: Double = 0.5
private let midFreqHz: Double = 800.0
private let midBumpDb: Double = 3.0
private let midQ: Double = 0.8
private let shapeFreqHz: Double = 2600.0
private let shapeMinDb: Double = -6.0
private let shapeMaxDb: Double = 6.0
private let shapeSlope: Double = 0.8
public override var toneStackModel: ToneStackModel { .marshall }
public override var summaryText: String {
"British mid-forward crunch with a single Shape control (dark ↔ bright top end)."
}
public override var signatureKnobs: [PedalKnob] {
[PedalKnob(label: "Shape", node: $shape, range: signatureRange)]
}
/// Creates a Citrus 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: "Citrus", inputBus: inputBus, outputBus: outputBus)
gain = 6.0
cab = 1.0 // British 4×12
}
/// A fixed midrange bump (the Citrus push), then the Shape high-shelf tilt.
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let midded: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio(
input: signal, freq: midFreqHz, gain: midBumpDb, q: midQ)
let shapeDb: LinLin.Audio = LinLin.Audio(
$shape, inLo: 0.0, inHi: 1.0, outLo: shapeMinDb, outHi: shapeMaxDb)
return RBJHighShelf.Audio(input: midded, freq: shapeFreqHz, gain: shapeDb, slope: shapeSlope)
}
}