243be726ea
Add ReverseReverbPedal: the "sucked-in" pre-verb of ambient/shoegaze records. The dry signal runs through the existing segmented ReverseDelay generator — notes are captured in fixed segments and played back reversed, so a decay becomes a swell rising into the note — then feeds a GVerb room tank, folded stereo→mono, so the backwards swell arrives wrapped in a diffuse wash. Distinct from the plain Reverse Delay (no reverb) and a forward Room Reverb (energy follows the note instead of swelling up to it). Knobs: Time (reverse segment length / swell pre-delay, tempo-syncable), Decay/Size/Damp (GVerb tail). GVerb dry/tail/early levels kept modest for output headroom, and early reflections trimmed since they fire forward, against the backwards character. Latency is one segment. Wire into PedalType, the registry, and the reverb category; add to the README reverb catalog. 9 tests: pre-delay (energy arrives after one segment), a rising-swell-shape assertion across the reversed segment, reverb tail persistence, determinism, a click-free bypass flip at the 512-sample block, knob labels, preset round-trip, registry presence. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
133 lines
5.4 KiB
Swift
133 lines
5.4 KiB
Swift
// PedalType.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/// A type-safe identifier for a pedal type, used by the board-edit API instead of a raw string.
|
|
///
|
|
/// `PedalType` is an extensible token (the `RawRepresentable` struct pattern, à la
|
|
/// `Notification.Name`): the built-in pedals are exposed as static members for discoverable,
|
|
/// autocompleting call sites —
|
|
///
|
|
/// ```swift
|
|
/// try shoeGaze.appendPedal(.overdrive, to: board)
|
|
/// ```
|
|
///
|
|
/// — while staying open for custom pedals, since any `PedalType("My Pedal")` is valid and a
|
|
/// third party can add their own static members in an extension.
|
|
///
|
|
/// `rawValue` is the pedal's `displayName`, which is exactly what the rig save format stores
|
|
/// (`PedalState.type`) and what ``PedalRegistry`` keys on. `PedalType` therefore changes only the
|
|
/// authoring call site — the JSON format and load path are unchanged.
|
|
///
|
|
/// > Note: named `PedalType` rather than `PedalKind` to avoid colliding with Lyrebird's
|
|
/// > score-notation `PedalKind` enum, which is visible whenever both modules are imported.
|
|
public struct PedalType: RawRepresentable, Hashable, Sendable {
|
|
|
|
/// The pedal's `displayName`; the key used by ``PedalRegistry`` and stored in saved rigs.
|
|
public let rawValue: String
|
|
|
|
/// Creates a type from a raw `displayName` string.
|
|
public init(rawValue: String) {
|
|
self.rawValue = rawValue
|
|
}
|
|
|
|
/// Creates a type from a raw `displayName` string.
|
|
public init(_ rawValue: String) {
|
|
self.rawValue = rawValue
|
|
}
|
|
}
|
|
|
|
// MARK: - Built-in pedals
|
|
|
|
public extension PedalType {
|
|
|
|
// Drive & dynamics
|
|
static let california = PedalType("California")
|
|
static let british = PedalType("British")
|
|
static let britishPlexi = PedalType("British Plexi")
|
|
static let britishJTM = PedalType("British JTM")
|
|
static let britishBluesbreaker = PedalType("British Bluesbreaker")
|
|
static let britishMaster = PedalType("British Master")
|
|
static let britishDual = PedalType("British Dual")
|
|
static let boutiqueLead = PedalType("Boutique Lead")
|
|
static let boutiqueOD = PedalType("Boutique OD")
|
|
static let caliHiGain = PedalType("Cali Hi-Gain")
|
|
static let command = PedalType("Command")
|
|
static let citrus = PedalType("Citrus")
|
|
static let sixtiesCombo = PedalType("Sixties Combo")
|
|
static let magnaVibrato = PedalType("Magna Vibrato")
|
|
static let anaheim = PedalType("Anaheim")
|
|
static let modernHighGain = PedalType("Modern High-Gain")
|
|
static let chime = PedalType("Chime")
|
|
static let chimeFifteen = PedalType("Chime 15")
|
|
static let chimeNormal = PedalType("Chime Normal")
|
|
static let chimeBaby = PedalType("Chime Baby")
|
|
static let fullertonReverb = PedalType("Fullerton Reverb")
|
|
static let fullertonDeluxe = PedalType("Fullerton Deluxe")
|
|
static let fullertonPrinceton = PedalType("Fullerton Ivy League")
|
|
static let fullertonDrive = PedalType("Fullerton Drive")
|
|
static let jazzClean = PedalType("Jazz Clean")
|
|
static let chimeTopBoost = PedalType("Chime Top Boost")
|
|
static let neuralAmp = PedalType("Neural Amp")
|
|
static let overdrive = PedalType("Overdrive")
|
|
static let distortion = PedalType("Distortion")
|
|
static let fuzz = PedalType("Fuzz")
|
|
static let sustainFuzz = PedalType("Sustain Fuzz")
|
|
static let compressor = PedalType("Compressor")
|
|
static let limiter = PedalType("Limiter")
|
|
static let noiseGate = PedalType("Noise Gate")
|
|
static let cabinet = PedalType("Cabinet")
|
|
|
|
// EQ & filter
|
|
static let graphicEQ = PedalType("Graphic EQ")
|
|
static let autoWah = PedalType("Auto-Wah")
|
|
static let wah = PedalType("Wah")
|
|
static let mutant = PedalType("Mutant")
|
|
static let phaser = PedalType("Phaser")
|
|
|
|
// Modulation
|
|
static let tremolo = PedalType("Tremolo")
|
|
static let modulation = PedalType("Modulation")
|
|
static let chorus = PedalType("Chorus")
|
|
static let flanger = PedalType("Flanger")
|
|
static let vibrato = PedalType("Vibrato")
|
|
static let vibe = PedalType("Vibe")
|
|
static let rotary = PedalType("Rotary")
|
|
static let ringModulator = PedalType("Ring Modulator")
|
|
static let diffuser = PedalType("Diffuser")
|
|
static let bitcrusher = PedalType("Bitcrusher")
|
|
static let granulator = PedalType("Granulator")
|
|
static let autoGranulator = PedalType("Auto Granulator")
|
|
|
|
// Dynamics (additional)
|
|
static let sustainer = PedalType("Sustainer")
|
|
|
|
// Gain (additional)
|
|
static let volume = PedalType("Volume")
|
|
|
|
// Delay & reverb
|
|
static let delay = PedalType("Delay")
|
|
static let feedbackDelay = PedalType("Feedback Delay")
|
|
static let multiTapDelay = PedalType("Multi-Tap Delay")
|
|
static let pingPong = PedalType("Ping-Pong")
|
|
static let reverseDelay = PedalType("Reverse Delay")
|
|
static let reverb = PedalType("Reverb")
|
|
static let shimmerReverb = PedalType("Shimmer Reverb")
|
|
static let plateReverb = PedalType("Plate Reverb")
|
|
static let roomReverb = PedalType("Room Reverb")
|
|
static let springReverb = PedalType("Spring Reverb")
|
|
static let reverseReverb = PedalType("Reverse Reverb")
|
|
|
|
// Pitch & octave
|
|
static let octaveSplitter = PedalType("Octave Splitter")
|
|
static let bassOctaver = PedalType("Bass Octaver")
|
|
static let harmonizer = PedalType("Harmonizer")
|
|
static let whammy = PedalType("Whammy")
|
|
static let polyOctave = PedalType("Poly Octave")
|
|
|
|
// Looper
|
|
static let looper = PedalType("Looper")
|
|
}
|