Skip to main content

Crate svara

Crate svara 

Source
Expand description

§svara — Formant and Vocal Synthesis

svara (Sanskrit: voice/tone/musical note) provides a complete formant-based vocal synthesis pipeline: glottal source generation, vocal tract modeling, phoneme-level synthesis, prosodic control, and sequenced speech rendering.

§Architecture

The synthesis pipeline flows:

GlottalSource → VocalTract (FormantFilter + NasalCoupling + LipRadiation) → Output

Higher-level constructs build on this:

  • Phonemes define articulatory targets and synthesis strategies per sound class
  • Prosody controls f0 contour, stress, and intonation patterns
  • Voice profiles parameterize speaker characteristics
  • Sequences combine phonemes with coarticulation and crossfading

§Quick Start

use svara::prelude::*;

// Create a male voice and synthesize a vowel
let voice = VoiceProfile::new_male();
let samples = synthesize_phoneme(
    &Phoneme::VowelA,
    &voice,
    44100.0,
    0.5,
).expect("synthesis should succeed");

// Or build a phoneme sequence
let mut seq = PhonemeSequence::new();
seq.push(PhonemeEvent::new(Phoneme::VowelA, 0.15, Stress::Primary));
seq.push(PhonemeEvent::new(Phoneme::NasalN, 0.08, Stress::Unstressed));
seq.push(PhonemeEvent::new(Phoneme::VowelI, 0.15, Stress::Secondary));
let audio = seq.render(&voice, 44100.0).expect("render should succeed");

§Feature Flags

  • naad-backend (default): Use naad crate for oscillators, filters, and noise. Without this, svara uses internal minimal implementations.
  • std (default): Enable standard library. Disable for no_std environments (requires alloc).
  • logging: Enable tracing-subscriber for structured log output.

Modules§

bridge
Dependency-free bridge functions for ecosystem integration.
error
Error types for the svara crate.
formant
Formant filtering and vowel target definitions.
glottal
Glottal source models for vocal synthesis.
lod
Level-of-detail quality control for multi-voice scenarios.
phoneme
Phoneme definitions and synthesis.
pool
Object pooling for transient phoneme synthesis.
prelude
Convenience re-exports for common usage.
prosody
Prosody: pitch contours, intonation patterns, and stress.
render
Async rendering API for non-real-time batch synthesis.
sequence
Phoneme sequencing with coarticulation and crossfading.
spectral
Spectral analysis tools for vocal synthesis.
tract
Vocal tract model connecting glottal source to output.
trajectory
Formant trajectory planning across multi-phoneme windows.
voice
Voice profiles defining speaker characteristics.