Crate elevenlabs_rs

Source
Expand description

An unofficial lib crate for ElevenLabs.

ElevenLabs’ website

ElevenLabs’ API reference

§Example

§Text to Speech

use elevenlabs_rs::{ElevenLabsClient, Result, DefaultVoice, Model};
use elevenlabs_rs::endpoints::genai::tts::{TextToSpeech, TextToSpeechBody};
use elevenlabs_rs::utils::play;

#[tokio::main]
async fn main() -> Result<()> {
    let client = ElevenLabsClient::from_env()?;

    let txt = "Hello! 你好! Hola! नमस्ते! Bonjour! \
        こんにちは! مرحبا! 안녕하세요! Ciao! Cześć! Привіт! வணக்கம்!";

    let body = TextToSpeechBody::new(txt)
       .with_model_id(Model::ElevenMultilingualV2);

    let endpoint = TextToSpeech::new(DefaultVoice::Brian, body);

    let speech = client.hit(endpoint).await?;

    play(speech)?;

    Ok(())
}

Modules§

endpoints
error
utils

Macros§

pin_mut
Pins a value on the stack.

Structs§

Bytes
A cheaply cloneable and sliceable chunk of contiguous memory.
ElevenLabsClient
VoiceSettings
Voice settings

Enums§

DefaultVoice
Language
Language
LegacyVoice
Model
OutputFormat
See Elevenlabs documentation on supported output formats.

Traits§

StreamExt
An extension trait for Streams that provides a variety of convenient combinator functions.

Type Aliases§

Result