pub struct CreatureTract { /* private fields */ }Expand description
A creature’s vocal tract, configured for a specific species.
Wraps svara’s VocalTract with species-specific formant targets
and excitation source selection based on the vocal apparatus type.
Implementations§
Source§impl CreatureTract
impl CreatureTract
Sourcepub fn new(params: &SpeciesParams, sample_rate: f32) -> Self
pub fn new(params: &SpeciesParams, sample_rate: f32) -> Self
Creates a new creature vocal tract for the given species parameters.
Configures the svara vocal tract with species-specific formant frequencies derived from the species’ vocal tract geometry.
Sourcepub fn synthesize(
&mut self,
f0: f32,
num_samples: usize,
options: &SynthesisOptions,
) -> Result<Vec<f32>>
pub fn synthesize( &mut self, f0: f32, num_samples: usize, options: &SynthesisOptions, ) -> Result<Vec<f32>>
Synthesizes a block of samples using the creature’s vocal apparatus.
For laryngeal/syringeal species, pipes a glottal source through the vocal tract. For noise-only species, generates filtered noise. For stridulatory species, generates amplitude-modulated tone.
options carries per-block modifiers (subharmonics, formant blend, etc.)
that are layered on top of the species defaults.
Sourcepub fn synthesize_purr(
&mut self,
num_samples: usize,
purr_f0: f32,
) -> Result<Vec<f32>>
pub fn synthesize_purr( &mut self, num_samples: usize, purr_f0: f32, ) -> Result<Vec<f32>>
Synthesizes purring: 25-30 Hz laryngeal muscle cycling.
Cat purring uses a fundamentally different mechanism than normal phonation. The laryngeal muscles contract and relax at ~25 Hz, producing a characteristic asymmetric waveform (longer closed phase). The sharp glottal burst at ~25 Hz excites the vocal tract resonances, producing harmonics at multiples of 25 Hz shaped by the tract formants.
Sourcepub fn set_formant_blend(
&mut self,
target: &[f32; 3],
target_bw: &[f32; 3],
blend: f32,
) -> Result<()>
pub fn set_formant_blend( &mut self, target: &[f32; 3], target_bw: &[f32; 3], blend: f32, ) -> Result<()>
Updates the formant targets for dynamic formant transitions.
Blends the current formants toward target formants by blend factor (0.0-1.0).
At blend=0.0, uses the species default formants. At blend=1.0, uses target.
Sourcepub fn apply_spectral_tilt(samples: &mut [f32], tilt_db: f32, sample_rate: f32)
pub fn apply_spectral_tilt(samples: &mut [f32], tilt_db: f32, sample_rate: f32)
Applies spectral tilt (first-order lowpass) to a buffer.
tilt_db is dB/octave: negative = darker (lowpass), 0 = neutral.
Implemented as a one-pole filter: y[n] = (1-a)*x[n] + a*y[n-1].
Trait Implementations§
Source§impl Clone for CreatureTract
impl Clone for CreatureTract
Source§fn clone(&self) -> CreatureTract
fn clone(&self) -> CreatureTract
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more