1.0.0 release

This commit is contained in:
2026-06-01 18:27:40 -07:00
parent b1ab0f102c
commit 1f20fcab20
1151 changed files with 230703 additions and 14 deletions
@@ -0,0 +1,50 @@
// FMTone.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
/// FM tone with an ASR envelope and stereo panning.
///
/// A sine modulator at `modFreq` drives the carrier frequency, producing
/// classic FM timbre. The `pan` argument places the voice in the stereo field
/// (-1 = hard left, 0 = centre, 1 = hard right).
final class FMTone: SynthesizerBase {
let carrierFreq: Double
let modFreq: Double
let modIndex: Double
let amp: Double
let pan: Double
let envelope: Envelope
init(carrierFreq: Double,
modFreq: Double = 220.0,
modIndex: Double = 3.0,
amp: Double = 0.18,
pan: Double = 0.0,
envelope: Envelope = Envelope(
levels: [0, 1, 0.7, 0],
durations: [0.02, 1.5, 0.5],
curves: [2, 0, -3.5]
)
) {
self.carrierFreq = carrierFreq
self.modFreq = modFreq
self.modIndex = modIndex
self.amp = amp
self.pan = pan
self.envelope = envelope
super.init()
}
override func build() {
let env = EnvelopeGen.Control(
envelope: envelope
)
let mod = OscSin.Audio(freq: modFreq) * (carrierFreq * modIndex)
let sig = OscSin.Audio(freq: carrierFreq + mod) * env * amp
output(bus: 0, source: Pan2(input: sig, pan: pan))
}
}