speakers-core 0.2.0

Core library for the speakers local TTS CLI and daemon
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use qwen3_tts::{Language, Speaker};

pub const DEFAULT_LANGUAGE: &str = "en";
pub const DEFAULT_PRESET_VOICE: &str = "ryan";

/// Parse speech-dispatcher language codes. Region suffixes are ignored.
pub fn parse_language(code: &str) -> Result<Language> {
    let base = code.split('-').next().unwrap_or(code);
    base.parse::<Language>()
        .map_err(|e| anyhow::anyhow!("unknown language '{code}': {e}"))
}

/// Parse a preset Qwen3 voice name.
pub fn parse_speaker(name: &str) -> Result<Speaker> {
    name.parse::<Speaker>()
        .map_err(|e| anyhow::anyhow!("unknown preset voice '{name}': {e}"))
}