3 Commits

Author SHA1 Message Date
josh 4e8f6e280c release: ShoeGaze 3.3.0 — noise-gate threshold + mono-output fixes on Lyrebird 2.2.0
Bump to Lyrebird 2.2.0 (both Package.resolved pins → 2.2.0 / 24ea32e) and cut
ShoeGaze 3.3.0. This release surfaces the upstream ramp-origin fix plus the two
local fixes already on main:

- Noise Gate respects its threshold after loading a rig: the gate's open level is
  derived from the threshold, which previously swept up from a default on the first
  audio block and tripped the gate on the transient (latching it open). Lyrebird
  2.2.0 delivers a pre-first-render parameter value flat, so the gate reads its real
  threshold from block one.
- Mono rigs output at unity (were ~3 dB down through a centre pan).
- Noise Gate detector Peak/RMS switch, defaulting to RMS.

NoiseGatePedal doc comment tidied (signal-chain diagram + detector parameter).
App build track: MARKETING_VERSION 3.3, CURRENT_PROJECT_VERSION 23.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-03 13:09:48 -08:00
josh a434b14f4b fix(output,gate): unity mono output + RMS noise-gate detector
Two fixes from the guitar-input analysis:

- Mono board output no longer loses 3 dB. BoardOutputMaster panned a mono
  board to stereo centre with an equal-power Pan2 (×0.707 per channel). A
  mono rig should come out at the level it went in, so the signal is now
  written to both hardware buses directly at unity.

- Noise Gate gains a Peak/RMS detector switch (defaults to RMS). The peak
  follower (|x|) rides the waveform's peaks, so the gate's threshold decision
  tracked instantaneous peaks rather than loudness; the RMS detector
  (√ symmetric-average of x²) follows perceived level, so the gate opens and
  closes where the note actually is. Implemented as a rebuildsOnChange switch
  that builds only the chosen follower. Serialization-safe: a gate saved
  before the switch (empty switchValues) loads with the RMS default.

Tests cover the detector switch, RMS default (incl. legacy load), state
round-trip, and RMS closing earlier than Peak on a sustained tail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-03 08:49:16 -08:00
josh 0ddf350f1f Migrate to Lyrebird 2.0.0; app version bump
Lyrebird 2.0 moved `@UIParam` / `UIParamNode` out of `LyrebirdUI` into the
core `LyrebirdSynth` module (the `Lyrebird` product); `LyrebirdUI` no longer
re-exports them. Migrate:
- add `import LyrebirdSynth` to every file that uses `@UIParam`/`UIParamNode`
  (the pedal controls, tempo-syncable params, and the SwiftUI views).
- Package.swift: the `LyrebirdShoeGazeUI` target now also depends on the
  `Lyrebird` product (previously only `LyrebirdUI`), so `import LyrebirdSynth`
  resolves there under explicit module maps.
- Package.resolved (SwiftPM + both Xcode projects) pinned to Lyrebird 2.0.0.

Also: app marketing/project version bumps, Xcode upgrade-check, and a
CHANGELOG wording tweak carried in the same working tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-23 21:17:30 -07:00
33 changed files with 226 additions and 63 deletions
+4 -3
View File
@@ -59,9 +59,10 @@ plus a batch of rig-switching and reverb fixes.
- **No more spurious "Save changes?" prompt when switching rigs.** The unsaved-changes check
compared live session settings (input source, engine channel counts) that legitimately
differ from a rig's saved values; it now compares rig content only.
- **Overwrite guard for starter rigs.** Saving over a loaded starter rig now asks first,
offering **Overwrite**, **Save as New Rig**, or **Cancel**, so a shipped rig isn't replaced
by accident.
- **Starter rigs can't be overwritten by accident.** A built-in starter rig is managed content
(refreshed to the shipped version on updates), so saving over a loaded starter offers **Save
as New Rig** or **Cancel** — your changes are kept as your own rig rather than replacing the
shipped one.
- **Multi-board signal-router rigs now save and load.** Routed A/B rigs were previously lost
on save; their branch chains and blend now persist.
@@ -100,7 +100,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1600;
LastUpgradeCheck = 2660;
LastUpgradeCheck = 2700;
TargetAttributes = {
C3B100000000000000000014 = {
CreatedOnToolsVersion = 16.0;
@@ -163,7 +163,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = "21``";
CURRENT_PROJECT_VERSION = 23;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_HARDENED_RUNTIME = YES;
@@ -175,7 +175,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 3.1.1;
MARKETING_VERSION = 3.3;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -193,7 +193,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = "21``";
CURRENT_PROJECT_VERSION = 23;
DEAD_CODE_STRIPPING = YES;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = ShoeGazeBuilder/Info.plist;
@@ -204,7 +204,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 3.1.1;
MARKETING_VERSION = 3.3;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -216,6 +216,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
@@ -279,6 +280,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
@@ -366,7 +368,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://realizedsound.mooo.com/josh/Lyrebird";
requirement = {
kind = upToNextMajorVersion;
kind = versionRange;
maximumVersion = 3.0.0;
minimumVersion = 1.2.0;
};
};
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "c058493a9853695c441895a12e9f4a5dbc7295b0",
"version" : "1.2.3"
"revision" : "24ea32e47cecff8efec9720546ed068b4efef2f7",
"version" : "2.2.0"
}
},
{
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2660"
LastUpgradeVersion = "2700"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
@@ -103,7 +103,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1600;
LastUpgradeCheck = 2660;
LastUpgradeCheck = 2700;
TargetAttributes = {
C3C100000000000000000011 = {
CreatedOnToolsVersion = 16.0;
@@ -165,7 +165,7 @@
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 10;
DEBUG_INFORMATION_FORMAT = dwarf;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze;
@@ -175,11 +175,13 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 2;
@@ -194,7 +196,7 @@
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 10;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
@@ -203,11 +205,13 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.1.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 2;
@@ -218,6 +222,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
@@ -281,6 +286,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
@@ -368,8 +374,9 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://realizedsound.mooo.com/josh/Lyrebird";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
kind = versionRange;
maximumVersion = 3.0.0;
minimumVersion = 1.7.2;
};
};
/* End XCRemoteSwiftPackageReference section */
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "77580ee98e05cb4a94aac367097d27b91d3776c0",
"version" : "1.7.2"
"revision" : "b6fdee8bfc7c44d31a0a8cfe6fbd53f352dfad54",
"version" : "2.0.0"
}
},
{
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2660"
LastUpgradeVersion = "2700"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
+4 -6
View File
@@ -17,10 +17,6 @@
</array>
</dict>
</array>
<!-- Incoming .shoegaze files are read and imported into the rig library (a copy), never
edited in place, so the app opens a copy rather than the original document. -->
<key>LSSupportsOpeningDocumentsInPlace</key>
<false/>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -32,11 +28,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>${MARKETING_VERSION}</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 realizedsound. All rights reserved.</string>
<key>NSMicrophoneUsageDescription</key>
+3 -3
View File
@@ -1,5 +1,5 @@
{
"originHash" : "eed06b1870eecb6b28d2417331f105ea1cc25e9d6fe588c9d2eff8ca3af096f0",
"originHash" : "c8855e41a403b5b1fccd9ccb4b3ef4d75c4307590ae6a0b8e985e71c41011e09",
"pins" : [
{
"identity" : "linenoise-swift",
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "77580ee98e05cb4a94aac367097d27b91d3776c0",
"version" : "1.7.2"
"revision" : "24ea32e47cecff8efec9720546ed068b4efef2f7",
"version" : "2.2.0"
}
},
{
+9 -6
View File
@@ -24,14 +24,16 @@ let package = Package(
.library(name: "LyrebirdShoeGazeUI", targets: ["LyrebirdShoeGazeUI"]),
],
dependencies: [
.package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "1.7.2"),
.package(url: "https://realizedsound.mooo.com/josh/Lyrebird", from: "2.0.0"),
],
targets: [
// The core target depends on LyrebirdUI as well as the synthesis core:
// pedals expose their knobs as `@UIParam`, whose projected `UIParamNode`
// (the type `ParameterKnob` binds to) lives in LyrebirdUI. Importing
// LyrebirdUI here does not pull SwiftUI into ShoeGaze's own sources —
// it only makes the `@UIParam` wrapper and `UIParamNode` visible.
// Both targets depend on the core `Lyrebird` product AND `LyrebirdUI`.
// Pedals expose their knobs as `@UIParam`, whose projected `UIParamNode`
// lives in the core `LyrebirdSynth` module (the `Lyrebird` product) as of
// Lyrebird 2.0 — `LyrebirdUI` no longer re-exports it — so any file using
// `@UIParam` / `UIParamNode` needs `import LyrebirdSynth`, which requires
// the `Lyrebird` product as a direct dependency. Importing these does not
// pull SwiftUI into ShoeGaze's own core sources.
.target(
name: "LyrebirdShoeGaze",
dependencies: [
@@ -44,6 +46,7 @@ let package = Package(
name: "LyrebirdShoeGazeUI",
dependencies: [
"LyrebirdShoeGaze",
.product(name: "Lyrebird", package: "Lyrebird"),
.product(name: "LyrebirdUI", package: "Lyrebird"),
],
path: "Sources/LyrebirdShoeGazeUI"
+19
View File
@@ -1,4 +1,23 @@
# Releases
## ShoeGaze 3.3.0
Noise-gate and output-level fixes, on Lyrebird 2.2.0.
### Fixed
- **Noise Gate now respects its threshold after loading a rig.** A gate restored from a saved
rig could latch open and ignore its Threshold knob — the gate's open level is derived from the
threshold, and that value swept up from a default on the first audio block, tripping the gate
on the transient. Fixed upstream in Lyrebird 2.2.0 (a live parameter set before the first
render is now delivered flat), so the gate reads its real threshold from the first block.
- **Mono rigs come out at the level they went in.** A mono board was written through a centre
pan that dropped both channels ~3 dB; it now copies the mono signal to both outputs at unity.
### Changed
- **Noise Gate detector: Peak / RMS, defaulting to RMS.** RMS follows perceived loudness, so the
gate's threshold decision tracks how loud the note actually is instead of riding the waveform
peaks. A gate saved before this switch existed loads on RMS. (Peak remains available.)
- Updated to **Lyrebird 2.2.0**.
## ShoeGaze 3.1.1
A small fix for the Mutant envelope filter's control panel.
@@ -1,5 +1,5 @@
{
"originHash" : "9ce521e7cebf3eed8e20837aba069e3f0c5484a64130b1791e8e6fdb7874b9f0",
"originHash" : "13b4323e9d41dfdff1c6aeac595cff272eb4eee9cc1a3146483bdaf8543bc103",
"pins" : [
{
"identity" : "linenoise-swift",
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://realizedsound.mooo.com/josh/Lyrebird",
"state" : {
"revision" : "77580ee98e05cb4a94aac367097d27b91d3776c0",
"version" : "1.7.2"
"revision" : "b6fdee8bfc7c44d31a0a8cfe6fbd53f352dfad54",
"version" : "2.0.0"
}
},
{
@@ -82,9 +82,6 @@ final class BoardOutputMaster: SynthesizerBase {
// MARK: - Constants
/// Pan position for the board in the stereo field. Centre = 0.0. Used only for a mono board.
private let stereoPan: Double = 0.0
/// Lag time constant in seconds for the bypass crossfades — smooths engaged ↔ bypassed
/// transitions to prevent clicks. Matches the per-pedal bypass lag.
private let bypassLagTime: Double = 0.02
@@ -137,8 +134,12 @@ final class BoardOutputMaster: SynthesizerBase {
output(bus: 0, source: gainedLeft)
output(bus: 1, source: gainedRight)
} else {
// Mono board: Pan2 spreads the mono output to stereo hardware buses 0 + 1.
output(bus: 0, source: Pan2(input: gainedLeft, pan: stereoPan))
// Mono board: write the mono signal to both hardware buses at unity (0 dB). Using an
// equal-power `Pan2` to centre would drop each channel by 3 dB (×0.707) — power-correct
// for a true pan, but a mono guitar rig should come out at the same level it went in, so
// the signal is copied to left and right directly instead.
output(bus: 0, source: gainedLeft)
output(bus: 1, source: gainedLeft)
}
}
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A UI-agnostic description of one pedal button — a momentary action trigger or a
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A continuous pedal control that can be driven by a MIDI Control Change — the common shape of a
+1
View File
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A UI-agnostic description of one controllable pedal knob.
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A UI-agnostic description of a knob that snaps to a fixed set of labelled stops.
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A UI-agnostic description of one continuous vertical pedal fader.
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// A UI-agnostic description of one multi-position pedal switch.
@@ -11,20 +11,19 @@ import LyrebirdUI
///
/// Signal chain (inside `effect(_:)`):
/// ```
/// dry ─┬─────────────────────────────────────────────────────────┐
/// └→ AmplitudeFollower → Schmidt(lo: thr, hi: thr×ratio) │
/// → LinLin(0…1 → floor…1) │
/// → LagUpDown(fast open/slow close) × ─┴→ mono out
/// detector(dry) → Schmidt(lo: thr, hi: thr×ratio) → LinLin(0…1 → floor…1) → LagUpDown(open/close)
/// Peak: AmplitudeFollower(|x|)
/// RMS: √Lag(x²) out = dry × smoothed-gain
/// ```
///
/// An `AmplitudeFollower` tracks the dry signal level. A Schmitt trigger turns that
/// envelope into an open/closed gate with hysteresis (opens above `threshold × openRatio`,
/// closes below `threshold`) so the gate does not chatter around the threshold. The 0/1
/// gate is mapped to a gain in `[floor, 1]` and smoothed **asymmetrically** — opening fast so a
/// note's attack isn't softened, closing slowly so the gate fades shut instead of snapping (a fast
/// close popped audibly when heavy downstream gain amplified the step). When the gate is closed the
/// signal is attenuated to `floor` rather than hard-muted, so `floor` sets how much of the quiet
/// signal/noise tail bleeds through.
/// The **detector** tracks the dry signal level — either peak (`|x|`) or RMS (√mean-square). A
/// Schmitt trigger turns that envelope into an open/closed gate with hysteresis (opens above
/// `threshold × openRatio`, closes below `threshold`) so the gate does not chatter around the
/// threshold. The 0/1 gate is mapped to a gain in `[floor, 1]` and smoothed **asymmetrically** —
/// opening fast so a note's attack isn't softened, closing slowly so the gate fades shut instead of
/// snapping (a fast close popped audibly when heavy downstream gain amplified the step). When the
/// gate is closed the signal is attenuated to `floor` rather than hard-muted, so `floor` sets how
/// much of the quiet signal/noise tail bleeds through.
///
/// The wet/dry mix and bypass switching are handled by the `Pedal` base class.
///
@@ -39,6 +38,8 @@ import LyrebirdUI
/// mute, `1` = no gating. Range `[0, 1]`. Defaults to `0.0`.
/// - attack: Gate open time in seconds (advanced pop-over). Range `[0.001, 0.05]`. Defaults to `0.005`.
/// - release: Gate close time in seconds (advanced pop-over). Range `[0.01, 0.5]`. Defaults to `0.08`.
/// - detector: Level-detection mode (switch). `0` = Peak (`|x|`), `1` = RMS (√mean-square).
/// Defaults to RMS (`1`).
public final class NoiseGatePedal: Pedal {
/// One-line description shown in the picker and info panel.
@@ -63,17 +64,33 @@ public final class NoiseGatePedal: Pedal {
/// out chatter at the threshold). Range `[0.01, 0.5]`. Surfaced in the advanced pop-over.
@UIParam public var release: Double = 0.08
/// Detector mode: `0` = **Peak** (tracks `|x|`), `1` = **RMS** (tracks √mean-square). RMS follows
/// perceived loudness, so the threshold decision — and the level at which the gate closes — lines
/// up with how loud the note actually is, instead of riding the waveform's peaks. Defaults to RMS.
@UIParam public var detector: Double = 1.0
// MARK: - Constants
/// Default wet/dry blend — fully wet; the gate sits in-line.
private static let defaultMix: Double = 1.0
/// `detector` value selecting the peak follower.
private let detectorPeakValue: Double = 0.0
/// `detector` value selecting the RMS follower.
private let detectorRMSValue: Double = 1.0
/// Envelope-follower attack time, in seconds — fast so the gate opens promptly on a note.
private let detectAttack: Double = 0.002
/// Envelope-follower release time, in seconds — slower so the gate holds through decay.
private let detectRelease: Double = 0.05
/// RMS integration window (one-pole averaging time, in seconds) for the RMS detector. Long enough
/// to average out the waveform's per-cycle ripple so the envelope reflects mean-square level, not
/// instantaneous peaks.
private let rmsWindow: Double = 0.02
/// Open-threshold multiplier. The gate opens above `threshold × openRatio` and closes
/// below `threshold`, giving hysteresis that prevents chatter near the threshold.
private let openRatio: Double = 2.0
@@ -122,6 +139,23 @@ public final class NoiseGatePedal: Pedal {
]
}
/// Detector-mode switch (Peak / RMS). Appended as the gate's only switch, so a gate saved before
/// it existed (empty `switchValues`) loads with the RMS default — no migration.
public override var effectSwitches: [PedalSwitch] {
[
PedalSwitch(
label: "Detector",
node: $detector,
options: [
PedalSwitch.Option(title: "Peak", value: detectorPeakValue),
PedalSwitch.Option(title: "RMS", value: detectorRMSValue),
],
// Switching detector changes which follower is instantiated, so rebuild the board.
rebuildsOnChange: true
),
]
}
// MARK: - Init
/// Creates a noise-gate pedal.
@@ -150,12 +184,26 @@ public final class NoiseGatePedal: Pedal {
/// - Parameter dry: Dry mono input signal.
/// - Returns: Gated mono output.
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: detectAttack,
releaseTime: detectRelease
)
// Build the chosen detector only. `detector` is a `rebuildsOnChange` switch, so it is read
// here as a plain value at build time (the board rebuilds when it is toggled) — no live
// node-select in the graph.
let envelope: any ValidGeneratorInput
if detector >= detectorRMSValue {
// RMS detector: √(symmetric one-pole average of x²). The averaging window must be
// symmetric — a fast attack would track the *squared peaks* and collapse back to peak
// detection — so a plain `Lag` over `rmsWindow` recovers the mean square, giving a
// loudness-tracking envelope roughly 3 dB below the peak for a steady tone.
let squared: any ValidGeneratorInput = dry * dry
let meanSquare: Lag.Audio = Lag.Audio(input: squared, time: rmsWindow)
envelope = Sqrt.Audio(meanSquare)
} else {
// Peak detector: a one-pole follower of |x| (fast attack, slower release).
envelope = AmplitudeFollower.Audio(
in: dry,
attackTime: detectAttack,
releaseTime: detectRelease
)
}
// Hysteretic open/closed gate: opens above threshold×openRatio, closes below threshold.
let gate: Schmidt.Audio = Schmidt.Audio(
@@ -4,6 +4,7 @@
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Descriptor for one pedal parameter that can be locked to the tempo.
@@ -7,6 +7,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
/// A horizontal board-mixer strip for switching between, or blending, multiple `PedalBoard`s.
///
@@ -7,6 +7,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
/// A full board manager presented as a sheet — the richer companion to the inline
/// ``BoardBarView``.
@@ -7,6 +7,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
/// Renders a ``ChainRouter`` as a vertical stack with transport controls, two labelled
/// board rows, and a merger + optional master-gain output stage.
@@ -5,6 +5,7 @@
// SPDX-License-Identifier: MIT
import SwiftUI
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
@@ -7,6 +7,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
/// A horizontal scrolling strip of ``PedalView`` cards, one per pedal in a `PedalBoard`.
///
@@ -7,6 +7,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
// MARK: - PedalButtonView
@@ -5,6 +5,7 @@
// SPDX-License-Identifier: MIT
import SwiftUI
import LyrebirdSynth
import LyrebirdShoeGaze
/// Environment action a leaf pedal control can call to ask the host to rebuild the board that
@@ -5,6 +5,7 @@
// SPDX-License-Identifier: MIT
import SwiftUI
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
@@ -8,6 +8,7 @@ import SwiftUI
import UniformTypeIdentifiers
import LyrebirdUI
import LyrebirdShoeGaze
import LyrebirdSynth
// MARK: - Accent-color mapping (UI-only, never in the core target)
@@ -5,6 +5,7 @@
// SPDX-License-Identifier: MIT
import SwiftUI
import LyrebirdSynth
import LyrebirdUI
import LyrebirdShoeGaze
@@ -6,6 +6,7 @@
import SwiftUI
import LyrebirdUI
import LyrebirdSynth
/// A vertical fader bound to a single ``UIParamNode``.
///
@@ -170,4 +170,69 @@ struct NoiseGatePedalTests {
#expect(pedal.threshold == 0.03 && pedal.floor == 0.4, "legacy Threshold/Floor mis-mapped")
#expect(pedal.attack == 0.005 && pedal.release == 0.08, "legacy gate should default Attack/Release")
}
@Test func exposesDetectorSwitch() throws {
let switches: [PedalSwitch] = NoiseGatePedal().effectSwitches
#expect(switches.map { $0.label } == ["Detector"])
#expect(switches.first?.options.map { $0.title } == ["Peak", "RMS"])
}
@Test func defaultsToRMSAndLegacyGateGetsRMS() throws {
#expect(NoiseGatePedal().detector == 1.0, "new gate should default to RMS")
// A gate saved before the detector switch (empty switchValues) loads with the RMS default.
let legacy: PedalState = PedalState(
id: UUID(), type: "Noise Gate",
knobValues: [0.03, 0.4, 1.0, 1.0], switchValues: [], advancedValues: [], bypass: 0.0)
let pedal: NoiseGatePedal = NoiseGatePedal()
pedal.applyState(legacy)
#expect(pedal.detector == 1.0, "legacy gate should default to the RMS detector")
}
@Test func detectorRoundTripsThroughState() throws {
let pedal: NoiseGatePedal = NoiseGatePedal()
pedal.detector = 0.0 // Peak
let restored: NoiseGatePedal = NoiseGatePedal()
restored.applyState(pedal.captureState())
#expect(restored.detector == 0.0)
}
@Test func rmsDetectorClosesEarlierThanPeak() throws {
// On a note held just above threshold, the RMS envelope (≈ 3 dB below the peak envelope for a
// steady tone) drops under the close threshold sooner than the peak envelope does — so the
// RMS gate shuts earlier and passes less of the sustained tail than the Peak gate. The source
// steps to a constant 0.03 (peak env ≈ 0.03, RMS env ≈ 0.021); with threshold 0.025 the Peak
// gate stays open on the tail while the RMS gate closes.
func tailEnergy(detector: Double) throws -> Double {
let sr: Double = 48000.0
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.6, sampleRate: sr)
defer { try? FileManager.default.removeItem(at: url) }
let srcBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
let dstBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
defer {
engine.busAllocator.releaseAudioBus(srcBus)
engine.busAllocator.releaseAudioBus(dstBus)
}
let source: DecaySineSource = DecaySineSource(bus: srcBus.index)
let gate: NoiseGatePedal = NoiseGatePedal(inputBus: srcBus.index, outputBus: dstBus.index)
gate.sampleRate = sr
gate.threshold = 0.025
gate.floor = 0.0
gate.detector = detector
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
try engine.add(source)
try engine.add(gate, position: NodePosition.after(source))
try engine.add(master, position: NodePosition.after(gate))
try engine.start()
let inter: [Float] = readStereoCAF(url: url, sampleRate: sr)
let mono: [Double] = stride(from: 0, to: inter.count, by: 2).map { Double(inter[$0]) }
let start: Int = Int(0.15 * sr) // the sustained, below-peak-threshold tail
var energy: Double = 0.0
for i: Int in start..<mono.count { energy += mono[i] * mono[i] }
return energy
}
let peakTail: Double = try tailEnergy(detector: 0.0)
let rmsTail: Double = try tailEnergy(detector: 1.0)
#expect(peakTail > rmsTail * 2.0,
"RMS should close earlier than Peak on the sustained tail (peak=\(peakTail) rms=\(rmsTail))")
}
}