piper1-rs 0.1.0

Safe Rust bindings to Piper, the TTS library
Documentation
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

pub mod data_file;
pub mod voices;

/// A map of speaker names to their model level IDs.
pub type SpeakerIdMap = HashMap<String, u16>;

/// Details about a language for a model.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Language {
	/// The full language code, including the region.
	pub code:            String,
	/// Strictly the ISO 639-1 language code.
	pub family:          String,
	/// Strictly the ISO 3166-1 alpha-2 country code.
	pub region:          String,
	/// The name of the language as written in the language itself.
	pub name_native:     String,
	/// The English name of the language.
	pub name_english:    String,
	/// The English name of the country.
	pub country_english: String,
}

/// The quality of a model.
/// Typically, defines output sample rate, and how much CPU the model uses to synthesize.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ModelQuality {
	/// Extra low quality. Typically about 16kHz, and extra fast synthesis.
	#[serde(rename = "x_low")]
	ExtraLow,
	/// Low quality. Typically about 16kHz, and fast synthesis.
	#[serde(rename = "low")]
	Low,
	/// Medium quality. Typically about 22.05kHz, and moderate synthesis speed.
	#[serde(rename = "medium")]
	Medium,
	/// High quality. Typically about 22.05kHz, and slow synthesis.
	#[serde(rename = "high")]
	High,
}