Add Plate, Room, and Spring reverb pedals
Wrap three Lyrebird 1.2.0 reverb algorithms as pedals, mirroring ReverbPedal (run the generator pure-wet, let the base Pedal mix blend): - Plate Reverb — PlateReverb.Audio (Dattorro plate), stereo folded to mono. Knobs: Decay, Tone, Damp, Mod. - Room Reverb — GVerb.Audio (FDN room/hall), stereo folded to mono. Knobs: Size (m), Decay (T60 s), Damp, Tail. - Spring Reverb — SpringReverb.Audio in mono (stereo:false, no fold). Knobs: Decay, Tension, Damp. Each registered across the six touchpoints (type, registry, category .reverb, palette order, enclosure colour) with a test suite (build+render, param changes output, knob labels, preset round-trip, registry membership). 339 tests pass; both app targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
// RoomReverbPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Room reverb pedal: the GVerb FDN room/hall algorithm, folded to mono.
|
||||
///
|
||||
/// Signal chain (inside `effect(_:)`):
|
||||
/// ```
|
||||
/// dry → GVerb.Audio(dryLevel: 0, roomSize:, reverbTime:, damping:, tailLevel:) → stereo (2 ch)
|
||||
/// → SumChannels.Audio(mul: 0.5) → mono (fold)
|
||||
/// ```
|
||||
///
|
||||
/// `GVerb` runs with `dryLevel: 0` (pure wet); the base `Pedal` handles the wet/dry blend via its
|
||||
/// own `mix` parameter. The native-stereo output is summed to mono with a ×0.5 gain.
|
||||
///
|
||||
/// ## Parameters
|
||||
///
|
||||
/// Inherits `mix`, `bypass`, and `level` from `Pedal`, plus:
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - size: Room size in metres, in [1, 100]. Larger = bigger space. Defaults to `30`.
|
||||
/// - decay: Reverb time (T60) in seconds, in [0.2, 12]. Defaults to `3`.
|
||||
/// - damp: High-frequency damping in [0, 1]. Higher = darker tail. Defaults to `0.5`.
|
||||
/// - tail: Late-reverb level in [0, 1] — how present the room tail sits. Defaults to `0.6`.
|
||||
public final class RoomReverbPedal: Pedal {
|
||||
|
||||
/// One-line description shown in the picker and info panel.
|
||||
public override var summary: String {
|
||||
"Parametric room and hall reverb — dial the space in metres and its decay time."
|
||||
}
|
||||
|
||||
// MARK: - Parameters
|
||||
|
||||
/// Room size in metres, in [1, 100]. Larger = bigger space.
|
||||
@UIParam public var size: Double = 30.0
|
||||
|
||||
/// Reverb time (T60) in seconds, in [0.2, 12].
|
||||
@UIParam public var decay: Double = 3.0
|
||||
|
||||
/// High-frequency damping in [0, 1]. Higher = darker tail.
|
||||
@UIParam public var damp: Double = 0.5
|
||||
|
||||
/// Late-reverb level in [0, 1] — how present the room tail sits.
|
||||
@UIParam public var tail: Double = 0.6
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
/// GVerb dry level. `0` = pure wet; the base `Pedal` handles dry/wet blending.
|
||||
private let gverbDryLevel: Double = 0.0
|
||||
|
||||
/// Gain applied to the summed stereo→mono fold, compensating for channel doubling.
|
||||
private let stereoSumGain: Double = 0.5
|
||||
|
||||
/// Default wet/dry blend — a partial mix so the dry signal stays up front.
|
||||
private static let defaultMix: Double = 0.3
|
||||
|
||||
// MARK: - Ranges
|
||||
|
||||
private let sizeRange: ClosedRange<Double> = 1.0 ... 100.0
|
||||
private let decayRange: ClosedRange<Double> = 0.2 ... 12.0
|
||||
private let normalizedRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
|
||||
// MARK: - UI knobs
|
||||
|
||||
public override var effectKnobs: [PedalKnob] {
|
||||
[
|
||||
PedalKnob(label: "Size", node: $size, range: sizeRange),
|
||||
PedalKnob(label: "Decay", node: $decay, range: decayRange),
|
||||
PedalKnob(label: "Damp", node: $damp, range: normalizedRange),
|
||||
PedalKnob(label: "Tail", node: $tail, range: normalizedRange),
|
||||
]
|
||||
}
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
/// Creates a room reverb pedal.
|
||||
///
|
||||
/// - 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: "Room Reverb",
|
||||
inputBus: inputBus,
|
||||
outputBus: outputBus,
|
||||
initialMix: RoomReverbPedal.defaultMix
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Effect
|
||||
|
||||
public override func effect(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
// GVerb produces a 2-channel stereo output.
|
||||
let stereoRoom: GVerb.Audio = GVerb.Audio(
|
||||
source: dry,
|
||||
roomSize: $size,
|
||||
reverbTime: $decay,
|
||||
damping: $damp,
|
||||
tailLevel: $tail,
|
||||
dryLevel: gverbDryLevel,
|
||||
sampleRate: sampleRate
|
||||
)
|
||||
// Sum stereo → mono with ×0.5 to avoid level doubling.
|
||||
return SumChannels.Audio(
|
||||
input: stereoRoom,
|
||||
mul: stereoSumGain
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user