b6fdee8bfc
Consolidated release: the cross-platform Linux port (engine, generators, CLI, REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive. See RELEASES.md and LINUX_README.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
909 B
Swift
31 lines
909 B
Swift
// EventVoiceSynth.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import LyrebirdSynth
|
|
|
|
/// A fixed-pitch sine voice added by a `LyrebirdProcess` body in the events demo
|
|
/// (`LYREBIRD_DEMO=events`). The process's own envelope gates it, so firing an
|
|
/// event in the `LyrebirdEventListPerformanceView` starts an audible, visibly
|
|
/// "running" process strip.
|
|
final class EventVoiceSynth: SynthesizerBase {
|
|
|
|
/// Output gain, kept low so several stacked voices don't clip.
|
|
private let voiceGain: Double = 0.12
|
|
|
|
private let voiceFreq: Double
|
|
|
|
/// - Parameter freq: Oscillator frequency in Hz.
|
|
init(freq: Double) {
|
|
self.voiceFreq = freq
|
|
super.init()
|
|
}
|
|
|
|
override func build() {
|
|
let osc: OscSin.Audio = OscSin.Audio(freq: voiceFreq)
|
|
output(bus: 0, source: Pan2(input: osc * voiceGain))
|
|
}
|
|
}
|