fakeyou

Crates.iofakeyou
lib.rsfakeyou
version0.1.1
sourcesrc
created_at2023-05-18 12:40:22.592654
updated_at2023-05-18 22:43:08.159811
descriptionLibrary to use FakeYou's AI TTS services
homepage
repositoryhttps://github.com/chnoma/fakeyou.rs
max_upload_size
id867867
size18,494
Adrian Arnett (chnoma)

documentation

https://docs.rs/crate/fakeyou/

README

fakeyou

crates.io fakeyou documentation

An easy, synchronous Rust library to access FakeYou's AI TTS services

This library is a personal project and has no association with storyteller.ai

Usage

The first step in using this API is to authenticate.
In these examples, we are using a model token which is already known to us.
These will take some time to finish, due to the API's queue

use fakeyou;

fn main() {
    let fake_you = fakeyou::authenticate("user_name", "password").unwrap();
    fake_you.generate_file_from_token("Hello!", "TM:mc2kebvfwr1p", "hello.wav").unwrap();
}

You may also stream the resulting audio directly to an audio playback library, such as rodio:

use std::io::Cursor;
use rodio::{Decoder, OutputStream, source::Source, Sink};
use fakeyou;

fn main() {
    // rodio setup
    let (_stream, stream_handle) = OutputStream::try_default().unwrap();
    let sink = Sink::try_new(&stream_handle).unwrap();

    // actual API use
    let fake_you = fakeyou::authenticate("user_name", "password").unwrap();
    let bytes = fake_you.generate_bytes_from_token("Hello!", "TM:mc2kebvfwr1p").unwrap();

    // play resulting audio
    let cursor = Cursor::new(bytes);
    let decoder = Decoder::new(cursor).unwrap();
    sink.append(decoder);
    sink.sleep_until_end();
}

License

CC0 1.0 Universal

Commit count: 8

cargo fmt