Skip to main content

CreatureTract

Struct CreatureTract 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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].

Source

pub fn reset(&mut self)

Resets the tract state.

Trait Implementations§

Source§

impl Clone for CreatureTract

Source§

fn clone(&self) -> CreatureTract

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreatureTract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CreatureTract

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CreatureTract

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,