pub struct UnisonConfig {
pub voices: usize,
pub detune_cents: f64,
pub stereo_spread: f64,
pub phase_random: f64,
}Expand description
Unison configuration
Fields§
§voices: usizeNumber of stacked voices (1 = no unison)
detune_cents: f64Total edge-to-edge detune spread in cents: the span between the lowest and highest stacked voices. Each side is detuned by half this amount around the center.
stereo_spread: f64Stereo spread (0.0 = mono/centered, 1.0 = full stereo)
phase_random: f64Voice phase randomization (0.0 = all in phase, 1.0 = random)
Implementations§
Source§impl UnisonConfig
impl UnisonConfig
Sourcepub fn new(voices: usize, detune_cents: f64) -> Self
pub fn new(voices: usize, detune_cents: f64) -> Self
Create a unison configuration with the given voice count and total edge-to-edge detune spread (in cents).
Sourcepub fn detune_offset(&self, voice_index: usize) -> f64
pub fn detune_offset(&self, voice_index: usize) -> f64
Calculate the detune offset for a specific unison voice, in V/Oct.
detune_cents is the total edge-to-edge spread, so the lowest and
highest voices sit at ∓detune_cents/2 cents around the center and the
full span between them equals detune_cents. (100 cents = 1 semitone =
1/12 octave; 2400 cents = 2 octaves = the ±half-span denominator.)
Sourcepub fn pan_position(&self, voice_index: usize) -> f64
pub fn pan_position(&self, voice_index: usize) -> f64
Calculate the stereo pan position for a specific unison voice Returns pan value (-1.0 = left, 0.0 = center, 1.0 = right)
Sourcepub fn voice_gain(&self) -> f64
pub fn voice_gain(&self) -> f64
Get the gain multiplier per unison voice to keep the summed level roughly
constant as voices are stacked (equal-power: 1/sqrt(voices)).
Trait Implementations§
Source§impl Clone for UnisonConfig
impl Clone for UnisonConfig
Source§fn clone(&self) -> UnisonConfig
fn clone(&self) -> UnisonConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more