use std::ops::ControlFlow;
use std::path::{Path, PathBuf};
use std::process::ExitCode;
use clap::{Args, Parser, Subcommand};
use loqui::{Downloads, Engine, KokoroVariant, TtsConfig};
use loqui_server::{Acknowledgements, Listen, Server, ServerConfig, auth, fs};
#[derive(Parser)]
#[command(name = "loqui", version, about = "Local Kokoro text-to-speech and Whisper speech-to-text, served safely.")]
struct Cli {
#[command(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
Serve(ServeArgs),
Speak(SpeakArgs),
#[cfg(feature = "whisper")]
Transcribe(TranscribeArgs),
Token {
#[command(subcommand)]
action: TokenAction,
},
Doctor(ServeArgs),
Fetch(EngineArgs),
Voices(VoicesFile),
Match(MatchArgs),
}
#[derive(Subcommand)]
enum TokenAction {
Show,
Path,
Rotate,
}
#[derive(Args, Clone)]
struct VoicesFile {
#[arg(long = "voices", env = "LOQUI_VOICES_FILE")]
path: Option<PathBuf>,
}
impl VoicesFile {
fn path(&self) -> Option<PathBuf> {
voices_path(self.path.as_deref(), fs::config_dir().as_deref())
}
fn read(&self) -> Result<Vec<(String, String)>, String> {
self.path().map_or(Ok(Vec::new()), |path| read_voices(&path))
}
}
fn voices_path(explicit: Option<&Path>, config_dir: Option<&Path>) -> Option<PathBuf> {
explicit.map(Path::to_path_buf).or_else(|| config_dir.map(|d| d.join("voices.toml")).filter(|p| p.exists()))
}
fn read_voices(path: &Path) -> Result<Vec<(String, String)>, String> {
let text = std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?;
let table: toml::Table = text.parse().map_err(|e| format!("{}: {e}", path.display()))?;
table
.into_iter()
.map(|(name, value)| match value {
toml::Value::String(spec) => Ok((name, spec)),
_ => Err(format!("{}: voice {name:?} must be a string such as \"af_bella(2)+af_sky(1)\"", path.display())),
})
.collect()
}
#[derive(Args, Clone)]
struct EngineArgs {
#[arg(long, env = "LOQUI_CACHE_DIR")]
cache_dir: Option<PathBuf>,
#[arg(long)]
offline: bool,
#[arg(long, default_value = "fp32", value_parser = parse_variant)]
kokoro: KokoroVariant,
#[arg(long)]
gpu: Option<String>,
#[arg(long, env = "LOQUI_THREADS")]
threads: Option<u16>,
#[cfg(feature = "whisper")]
#[arg(long, default_value = "large-v3-turbo")]
stt_model: String,
#[cfg(feature = "whisper")]
#[arg(long)]
no_stt: bool,
#[cfg(feature = "whisper")]
#[arg(long, default_value_t = 600)]
stt_idle_secs: u64,
#[arg(long)]
preload: bool,
#[command(flatten)]
voices: VoicesFile,
}
impl EngineArgs {
fn tts(&self, gpu: Option<i32>) -> TtsConfig {
TtsConfig {
variant: self.kokoro,
device: gpu.map_or(loqui_kokoro::Device::Cpu, loqui_kokoro::Device::Cuda),
threads: self.threads.map(usize::from),
..TtsConfig::default()
}
}
fn speaker(&self) -> loqui::SpeakerConfig {
loqui::SpeakerConfig { threads: self.threads.map(usize::from), ..loqui::SpeakerConfig::default() }
}
#[cfg(feature = "whisper")]
fn stt(&self, gpu: Option<i32>) -> loqui::SttConfig {
loqui::SttConfig {
model: self.stt_model.clone(),
device: gpu.map_or(loqui::SttDevice::Cpu, loqui::SttDevice::Gpu),
threads: self.threads,
idle_ttl: (self.stt_idle_secs > 0).then(|| std::time::Duration::from_secs(self.stt_idle_secs)),
}
}
}
#[derive(Args, Clone)]
struct ServeArgs {
#[arg(long, env = "LOQUI_LISTEN", default_value = "unix")]
listen: String,
#[arg(long)]
i_understand_this_exposes_all_interfaces: bool,
#[arg(long)]
insecure_plaintext_network: bool,
#[arg(long, env = "LOQUI_TOKEN_FILE")]
token_file: Option<PathBuf>,
#[arg(long)]
require_token: bool,
#[arg(long = "allowed-host")]
allowed_hosts: Vec<String>,
#[arg(long)]
public_health: bool,
#[arg(long, requires = "tls_key")]
tls_cert: Option<PathBuf>,
#[arg(long, requires = "tls_cert")]
tls_key: Option<PathBuf>,
#[arg(long, default_value_t = 4096)]
max_input_chars: usize,
#[arg(long, default_value_t = 1800)]
max_audio_secs: u64,
#[arg(long, default_value_t = 8)]
max_queue: usize,
#[command(flatten)]
engine: EngineArgs,
}
#[derive(Args)]
struct SpeakArgs {
text: String,
#[arg(short, long, default_value = "speech.wav")]
output: PathBuf,
#[arg(long, default_value = "af_heart")]
voice: String,
#[arg(long, default_value_t = 1.0)]
speed: f32,
#[arg(long, default_value = "wav")]
format: String,
#[command(flatten)]
engine: EngineArgs,
}
#[cfg(feature = "whisper")]
#[derive(Args)]
struct TranscribeArgs {
file: PathBuf,
#[arg(long)]
language: Option<String>,
#[command(flatten)]
engine: EngineArgs,
}
#[derive(Args)]
struct MatchArgs {
file: PathBuf,
#[arg(long, default_value = "matched")]
name: String,
#[arg(long, default_value_t = 4)]
max_voices: usize,
#[arg(long, default_value_t = 36)]
evaluations: usize,
#[arg(long, default_value = "auto", value_parser = parse_accent)]
accent: loqui::Accent,
#[arg(long)]
transcript: Option<String>,
#[cfg(feature = "whisper")]
#[arg(long)]
no_transcribe: bool,
#[command(flatten)]
engine: EngineArgs,
}
fn parse_accent(s: &str) -> Result<loqui::Accent, String> {
match s {
"auto" => Ok(loqui::Accent::Auto),
"us" | "american" => Ok(loqui::Accent::American),
"gb" | "british" => Ok(loqui::Accent::British),
other => Err(format!("unknown accent {other:?}; use auto, us or gb")),
}
}
fn parse_variant(s: &str) -> Result<KokoroVariant, String> {
match s {
"fp32" => Ok(KokoroVariant::Fp32),
"fp16" => Ok(KokoroVariant::Fp16),
"quantized" | "q8" => Ok(KokoroVariant::Quantized),
other => Err(format!("unknown Kokoro variant {other:?}; use fp32, fp16 or quantized")),
}
}
fn gpu_ordinal(gpu: &Option<String>) -> Result<Option<i32>, String> {
match gpu.as_deref() {
None => Ok(None),
Some("cuda") => Ok(Some(0)),
Some(s) => s.strip_prefix("cuda:").and_then(|n| n.parse().ok()).map(Some).ok_or_else(|| format!("--gpu {s:?}: use cuda or cuda:N")),
}
}
#[derive(Clone, Copy, Default)]
struct Needs {
stt: bool,
speaker: bool,
}
fn build_engine(args: &EngineArgs, needs: Needs, max_input_chars: usize, max_audio_secs: u64) -> Result<Engine, String> {
let gpu = gpu_ordinal(&args.gpu)?;
let mut builder = Engine::builder()
.downloads(if args.offline { Downloads::Deny } else { Downloads::Allow })
.max_input_chars(max_input_chars)
.max_audio_secs(max_audio_secs)
.preload(args.preload)
.tts(Some(args.tts(gpu)));
if let Some(dir) = &args.cache_dir {
builder = builder.cache_dir(dir);
}
for (name, spec) in args.voices.read()? {
builder = builder.voice(name, spec);
}
if needs.speaker {
builder = builder.speaker(Some(args.speaker()));
}
#[cfg(feature = "whisper")]
if needs.stt && !args.no_stt {
builder = builder.stt(Some(args.stt(gpu)));
}
#[cfg(not(feature = "whisper"))]
let _ = needs.stt;
builder.build().map_err(|e| e.to_string())
}
fn server_config(args: &ServeArgs) -> Result<ServerConfig, String> {
Ok(ServerConfig {
listen: args.listen.parse::<Listen>().map_err(|e| e.to_string())?,
acknowledgements: Acknowledgements {
all_interfaces: args.i_understand_this_exposes_all_interfaces,
plaintext_network: args.insecure_plaintext_network,
},
token_file: args.token_file.clone(),
require_token_on_unix: args.require_token,
allowed_hosts: args.allowed_hosts.clone(),
public_health: args.public_health,
tls_cert: args.tls_cert.clone(),
tls_key: args.tls_key.clone(),
max_queue: Some(args.max_queue),
..ServerConfig::default()
})
}
async fn shutdown_signal() {
let ctrl_c = async {
let _ = tokio::signal::ctrl_c().await;
};
#[cfg(unix)]
let term = async {
match tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()) {
Ok(mut s) => {
s.recv().await;
}
Err(_) => std::future::pending::<()>().await,
}
};
#[cfg(not(unix))]
let term = std::future::pending::<()>();
tokio::select! {
() = ctrl_c => {}
() = term => {}
}
tracing::info!("shutting down");
}
async fn serve(args: ServeArgs) -> Result<(), String> {
let config = server_config(&args)?;
let engine = build_engine(&args.engine, Needs { stt: true, ..Needs::default() }, args.max_input_chars, args.max_audio_secs)?;
let server = Server::bind(config, engine).await.map_err(|e| e.to_string())?;
tracing::info!(address = %server.address(), token = %server.token_source(), "loqui listening");
if server.listen().is_network() && args.insecure_plaintext_network && args.tls_cert.is_none() {
tracing::warn!("serving a network address without TLS; tokens and audio cross the network in plaintext");
}
server.run(shutdown_signal()).await.map_err(|e| e.to_string())
}
fn doctor(args: &ServeArgs) -> Result<(), String> {
let config = server_config(args)?;
let mut problems = 0;
let mut say = |ok: bool, line: String| {
println!("{} {line}", if ok { "ok " } else { "WARN" });
if !ok {
problems += 1;
}
};
let tls = config.tls_cert.is_some();
match config.listen.check(config.acknowledgements, tls) {
Ok(()) => say(true, format!("listener {} is allowed", config.listen)),
Err(e) => say(false, format!("serve would refuse to start: {e}")),
}
let reach = match &config.listen {
Listen::Unix(_) => "processes running as this user, on this host".to_owned(),
Listen::Loopback(p) => format!("any process of any user on this host, via 127.0.0.1:{p}, with a token"),
Listen::Interface(a) => format!("anything that can route to {a}, with a token"),
Listen::AllInterfaces(p) => format!("anything that can reach any address of this host on port {p}, with a token"),
};
say(!config.listen.is_network(), format!("reachable by: {reach}"));
if config.listen.is_unix() {
match config.listen {
Listen::Unix(Some(ref p)) => say(true, format!("socket: {}", p.display())),
_ => match fs::default_socket_path() {
Some(p) => say(true, format!("socket: {}", p.display())),
None => say(false, "XDG_RUNTIME_DIR is unset: pass --listen unix:/path".into()),
},
}
say(
true,
format!(
"token on the socket: {}",
if config.require_token_on_unix { "required" } else { "not required (peer uid is checked)" }
),
);
}
if std::env::var_os("LOQUI_TOKEN").is_some() {
say(false, "LOQUI_TOKEN is set; other processes of this user can read it from /proc. Prefer --token-file".into());
}
match (&config.token_file, fs::default_token_path()) {
(Some(p), _) => match auth::check_private_file(p) {
Ok(()) => say(true, format!("token file {} is private", p.display())),
Err(e) => say(false, e.to_string()),
},
(None, Some(p)) if p.exists() => match auth::check_private_file(&p) {
Ok(()) => say(true, format!("generated token {} is private", p.display())),
Err(e) => say(false, e.to_string()),
},
(None, Some(p)) => say(true, format!("a token will be generated at {}", p.display())),
(None, None) => say(false, "no config directory for a generated token: set HOME or pass --token-file".into()),
}
if config.public_health && config.listen.is_network() {
say(false, "/health is public on a network listener (reveals only that loqui is running)".into());
}
let cache = args.engine.cache_dir.clone().or_else(loqui::default_cache_dir);
say(cache.is_some(), format!("model cache: {}", cache.map_or("none".into(), |c| c.display().to_string())));
match build_engine(&EngineArgs { preload: false, ..args.engine.clone() }, Needs { stt: true, ..Needs::default() }, 4096, 0) {
Ok(engine) => {
if let Some(path) = args.engine.voices.path() {
let named = engine.voices().map_or(0, |v| v.iter().filter(|v| v.blend.is_some()).count());
say(true, format!("{named} named voice(s) from {}", path.display()));
}
let missing = engine.missing();
let megabytes = missing.iter().map(|f| f.bytes).sum::<u64>().div_ceil(1_000_000);
match (missing.len(), args.engine.offline) {
(0, _) => say(true, "every model file is cached".into()),
(n, true) => {
say(false, format!("{n} model file(s) ({megabytes} MB) are not cached and --offline is set: run `loqui fetch`"))
}
(n, false) => say(true, format!("{n} model file(s) ({megabytes} MB) download on first use, or now with `loqui fetch`")),
}
}
Err(e) => say(false, format!("serve would refuse to start: {e}")),
}
if problems == 0 { Ok(()) } else { Err(format!("{problems} warning(s)")) }
}
fn token(action: TokenAction) -> Result<(), String> {
let path = fs::default_token_path().ok_or("no config directory: set HOME")?;
match action {
TokenAction::Path => println!("{}", path.display()),
TokenAction::Show => {
if !path.exists() {
auth::generate_file(&path).map_err(|e| e.to_string())?;
}
auth::check_private_file(&path).map_err(|e| e.to_string())?;
let text = std::fs::read_to_string(&path).map_err(|e| e.to_string())?;
let first = text.lines().map(str::trim).find(|l| !l.is_empty() && !l.starts_with('#')).ok_or("the token file is empty")?;
println!("{first}");
}
TokenAction::Rotate => {
auth::rotate(&path).map_err(|e| e.to_string())?;
eprintln!("rotated {}; restart `loqui serve` and update clients", path.display());
}
}
Ok(())
}
fn speak(args: SpeakArgs) -> Result<(), String> {
let engine = build_engine(&args.engine, Needs::default(), 4096, 0)?;
let format = loqui::Format::parse(&args.format).map_err(|e| e.to_string())?;
let request = loqui::SpeakRequest { text: args.text, voice: args.voice, speed: args.speed, format };
let speech = engine.speak(&request).map_err(|e| e.to_string())?;
std::fs::write(&args.output, &speech.audio).map_err(|e| format!("{}: {e}", args.output.display()))?;
eprintln!("{:.1}s of speech written to {}", speech.duration_secs, args.output.display());
Ok(())
}
#[cfg(feature = "whisper")]
fn transcribe(args: TranscribeArgs) -> Result<(), String> {
let engine = build_engine(&args.engine, Needs { stt: true, ..Needs::default() }, 4096, 7200)?;
let audio = std::fs::read(&args.file).map_err(|e| format!("{}: {e}", args.file.display()))?;
let request = loqui::TranscribeRequest { audio, language: args.language, ..Default::default() };
let result = engine.transcribe(&request).map_err(|e| e.to_string())?;
println!("{}", result.text);
Ok(())
}
fn voices(file: VoicesFile) -> Result<(), String> {
let mut builder = Engine::builder();
for (name, spec) in file.read()? {
builder = builder.voice(name, spec);
}
let voices = builder.build().and_then(|engine| engine.voices()).map_err(|e| e.to_string())?;
let width = voices.iter().map(|v| v.id.len()).max().unwrap_or(0);
for v in voices {
let line = format!("{:width$} {} {:7} {}", v.id, v.language, v.gender, v.blend.unwrap_or_default());
println!("{}", line.trim_end());
}
Ok(())
}
fn fetch(args: EngineArgs) -> Result<(), String> {
let engine = build_engine(&EngineArgs { preload: false, ..args }, Needs { stt: true, speaker: true }, 4096, 0)?;
engine.fetch().map_err(|e| e.to_string())?;
for m in engine.models() {
eprintln!("{} ready", m.id);
}
engine.fetch_voices().map_err(|e| e.to_string())?;
eprintln!("{} voices ready", loqui_kokoro::ENGLISH_VOICES.len());
Ok(())
}
fn check_voice_name(name: &str) -> Result<(), String> {
let charset = !name.is_empty() && name.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_');
let kokoro_shaped = matches!(name.as_bytes(), [_, b'f' | b'm', b'_', ..]);
if !charset || kokoro_shaped {
return Err(format!("--name {name:?}: use lowercase letters, digits and _, not a Kokoro-shaped name like af_custom"));
}
Ok(())
}
fn match_voice(args: MatchArgs) -> Result<(), String> {
check_voice_name(&args.name)?;
let audio = std::fs::read(&args.file).map_err(|e| format!("{}: {e}", args.file.display()))?;
#[cfg(feature = "whisper")]
let transcribe = args.transcript.is_none() && !args.no_transcribe;
#[cfg(not(feature = "whisper"))]
let transcribe = false;
let engine = build_engine(&args.engine, Needs { stt: transcribe, speaker: true }, 4096, 1800)?;
#[cfg_attr(not(feature = "whisper"), allow(unused_mut))]
let mut transcript = args.transcript;
#[cfg(feature = "whisper")]
if transcribe && engine.stt_model_id().is_some() {
eprintln!("transcribing {} for its words...", args.file.display());
match engine.transcribe(&loqui::TranscribeRequest { audio: audio.clone(), ..Default::default() }) {
Ok(t) => transcript = Some(t.text),
Err(e) => eprintln!("could not transcribe ({e}); matching on reference sentences instead"),
}
}
let mut request = loqui::MatchRequest::new(audio);
request.transcript = transcript;
request.max_voices = args.max_voices;
request.evaluations = args.evaluations;
request.accent = args.accent;
let mut progress = |p: &loqui::MatchProgress| {
match p {
loqui::MatchProgress::Preparing { done, total } => eprint!("\rpreparing the stock voices: {done}/{total} "),
loqui::MatchProgress::Evaluated { evaluations, budget, best_similarity } => {
eprint!("\rtrying blends: {evaluations}/{budget}, best similarity {best_similarity:.3} ")
}
_ => {}
}
ControlFlow::Continue(())
};
let found = engine.match_voice(&request, &mut progress).map_err(|e| e.to_string())?;
eprintln!();
let speed = found.speed.filter(|s| (s - 1.0).abs() >= 0.025).map_or(String::new(), |s| format!("; speak it at --speed {s:.2}"));
println!(
"# similarity {:.2}, closest single voice {} at {:.2}; the closest blend available, not a copy{speed}",
found.similarity, found.closest_voice, found.closest_similarity
);
println!("{} = \"{}\"", args.name, found.spec);
Ok(())
}
fn main() -> ExitCode {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info,whisper_rs=warn".into()))
.with_writer(std::io::stderr)
.init();
let cli = Cli::parse();
let result = match cli.command {
Command::Serve(args) => match tokio::runtime::Runtime::new() {
Ok(rt) => rt.block_on(serve(args)),
Err(e) => Err(e.to_string()),
},
Command::Speak(args) => speak(args),
#[cfg(feature = "whisper")]
Command::Transcribe(args) => transcribe(args),
Command::Token { action } => token(action),
Command::Doctor(args) => doctor(&args),
Command::Fetch(args) => fetch(args),
Command::Voices(file) => voices(file),
Command::Match(args) => match_voice(args),
};
match result {
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
eprintln!("loqui: {e}");
ExitCode::FAILURE
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_command_line_is_well_formed() {
use clap::CommandFactory;
Cli::command().debug_assert();
}
fn engine_commands() -> Vec<Vec<&'static str>> {
let mut commands = vec![vec!["serve"], vec!["doctor"], vec!["speak", "hi"], vec!["match", "a.wav"], vec!["fetch"]];
#[cfg(feature = "whisper")]
commands.push(vec!["transcribe", "a.wav"]);
commands
}
fn engine_args(command: Command) -> EngineArgs {
match command {
Command::Serve(args) | Command::Doctor(args) => args.engine,
Command::Speak(args) => args.engine,
#[cfg(feature = "whisper")]
Command::Transcribe(args) => args.engine,
Command::Match(args) => args.engine,
Command::Fetch(args) => args,
Command::Token { .. } | Command::Voices(_) => panic!("this command runs no model"),
}
}
#[test]
fn every_command_that_runs_a_model_takes_threads() {
for command in engine_commands() {
let argv = ["loqui"].into_iter().chain(command.iter().copied()).chain(["--threads", "3"]);
let args = engine_args(Cli::try_parse_from(argv).unwrap_or_else(|e| panic!("{command:?}: {e}")).command);
assert_eq!(args.tts(None).threads, Some(3), "{command:?}");
assert_eq!(args.speaker().threads, Some(3), "{command:?}");
#[cfg(feature = "whisper")]
assert_eq!(args.stt(None).threads, Some(3), "{command:?}");
}
}
#[test]
fn threads_come_from_loqui_threads_and_default_to_unset() {
use clap::CommandFactory;
let cli = Cli::command();
for command in engine_commands() {
let name = command[0];
let threads = cli.find_subcommand(name).and_then(|c| c.get_arguments().find(|a| a.get_id() == "threads"));
let threads = threads.unwrap_or_else(|| panic!("{name} has no --threads"));
assert_eq!(threads.get_env(), Some(std::ffi::OsStr::new("LOQUI_THREADS")), "{name}");
assert!(threads.get_default_values().is_empty(), "{name}");
}
}
#[test]
fn a_match_name_is_one_voices_toml_accepts() {
assert!(check_voice_name("me").is_ok());
assert!(check_voice_name("warm_2").is_ok());
for bad in ["", "Me", "my voice", "af_me", "bm_x"] {
assert!(check_voice_name(bad).is_err(), "{bad:?}");
}
}
struct TempDir(PathBuf);
impl TempDir {
fn new(name: &str) -> Self {
let dir = std::env::temp_dir().join(format!("loqui-cli-{name}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
Self(dir)
}
fn file(&self, name: &str, text: &str) -> PathBuf {
let path = self.0.join(name);
std::fs::write(&path, text).unwrap();
path
}
}
impl Drop for TempDir {
fn drop(&mut self) {
let _ = std::fs::remove_dir_all(&self.0);
}
}
#[test]
fn voices_files_are_name_spec_pairs() {
let dir = TempDir::new("voices-ok");
let path = dir.file("voices.toml", "# my voices\nwill = \"am_puck(1)+am_liam(1)+am_onyx(0.5)\"\nnova = \"nova(3)+af_sky\"\n");
let mut voices = read_voices(&path).unwrap();
voices.sort();
assert_eq!(voices, [("nova".into(), "nova(3)+af_sky".into()), ("will".into(), "am_puck(1)+am_liam(1)+am_onyx(0.5)".into())]);
}
#[test]
fn voices_files_say_what_is_wrong_and_where() {
let dir = TempDir::new("voices-bad");
let table = read_voices(&dir.file("table.toml", "[will]\nblend = \"am_puck\"\n")).unwrap_err();
assert!(table.contains("table.toml") && table.contains("\"will\" must be a string"), "{table}");
let syntax = read_voices(&dir.file("syntax.toml", "will = am_puck\n")).unwrap_err();
assert!(syntax.contains("syntax.toml") && syntax.contains("line 1"), "{syntax}");
let missing = read_voices(&dir.0.join("absent.toml")).unwrap_err();
assert!(missing.contains("absent.toml"), "{missing}");
}
#[test]
fn the_default_voices_file_is_used_only_if_it_exists() {
let dir = TempDir::new("voices-default");
let explicit = dir.0.join("mine.toml");
assert_eq!(voices_path(Some(&explicit), Some(&dir.0)), Some(explicit.clone()), "named files are used even if absent");
assert_eq!(voices_path(None, Some(&dir.0)), None);
assert_eq!(voices_path(None, None), None);
let default = dir.file("voices.toml", "");
assert_eq!(voices_path(None, Some(&dir.0)), Some(default));
}
}