Skip to content

Instantly share code, notes, and snippets.

@siiky
Last active May 22, 2017 18:43
Show Gist options
  • Save siiky/d429fc2f8fc1d8a8e15f46bfed4ce467 to your computer and use it in GitHub Desktop.
Save siiky/d429fc2f8fc1d8a8e15f46bfed4ce467 to your computer and use it in GitHub Desktop.
Play the Portuguese phonemes with espeak-ng
#!/usr/bin/env run-cargo-script
use std::process::Command;
use std::thread::sleep;
use std::time::Duration;
fn main() {
let phonemes: Vec<&str> = vec!["[[&]]", "[[&/]]", "[[a]]", "[[&~]]", "[[&U~]]", "[[E]]",
"[[e]]", "[[y]]", "[[i]]", "[[i/]]", "[[O]]", "[[o]]", "[[u]]",
"[[U]]", "[[EU]]", "[[w]]", "[[x]]", "[[R]]", "[[s#]]"];
let aux = |s, p| format!("failed to {} proc with phoneme {}", s, p);
for ph in phonemes {
let spawnmsg = aux("exec", ph);
let waitmsg = aux("wait for", ph);
let _ = Command::new("espeak-ng")
.arg("-vpt-pt")
.arg(ph)
.spawn()
.expect(spawnmsg.as_str())
.wait()
.expect(waitmsg.as_str());
sleep(Duration::from_millis(500));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment