Crates.io | aristech-tts-client |
lib.rs | aristech-tts-client |
version | |
source | src |
created_at | 2024-10-22 09:57:08.22034 |
updated_at | 2024-12-04 07:39:57.740972 |
description | A Rust client library for the Aristech Text-to-Speech API |
homepage | https://github.com/aristech-de/tts-clients/blob/main/rust/README.md |
repository | https://github.com/aristech-de/tts-clients |
max_upload_size | |
id | 1418453 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is the Rust client implementation for the Aristech TTS-Server.
To use the client in your project, add it to your Cargo.toml
or use cargo
to add it:
cargo add aristech-tts-client
use aristech_tts_client::{get_client, synthesize, SpeechRequest, SpeechRequestOption, TlsOptions};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let client = get_client(
"https://tts.example.com",
Some(TlsOptions::default()),
).await?;
let request = SpeechRequest {
text: "Text to speak.".to_string(),
options: Some(SpeechRequestOption {
voice_id: "anne_en_GB".to_string(),
..SpeechRequestOption::default()
}),
..SpeechRequest::default()
};
let data = synthesize(&mut client, request).await?;
std::fs::write("output.wav", data).expect("Unable to write file");
Ok(())
}
There are several examples in the examples directory:
You can run the examples directly using cargo
like this:
.env
file in the rust directory:HOST=tts.example.com
# The credentials are optional but probably required for most servers:
TOKEN=your-token
SECRET=your-secret
# The following are optional:
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
# If neither credentials nor an explicit root certificate are provided,
# you can still enable SSL by setting the SSL environment variable to true:
# SSL=true
# VOICE_ID=some-available-voice-id
cargo run --example file
To build the library, run:
cargo build