#bindings #output-stream #text #basic #rodio #playing #flite

fliters

basic rust bindings for flite c library

3 releases

0.1.8 Jan 20, 2025
0.1.7 Mar 25, 2024
0.1.0 Jan 22, 2024

#368 in Audio

Download history 51/week @ 2024-12-01 100/week @ 2024-12-08 30/week @ 2024-12-15 26/week @ 2024-12-22 15/week @ 2024-12-29 19/week @ 2025-01-05 6/week @ 2025-01-12 119/week @ 2025-01-19 8/week @ 2025-02-02

133 downloads per month

MIT license

15MB
146K SLoC

C 145K SLoC // 0.0% comments Visual Studio Project 283 SLoC Rust 181 SLoC // 0.0% comments Visual Studio Solution 46 SLoC

Contains (Cab file, 12KB) extern/flite/flite.v11.suo

fliters

rust bindings for the flite c library

Usage

Check out /examples directory for more examples.

// standard example
use fliters;

fn main() {
  fliters::tts("hello, world!").play();
}
// Controlling the output stream. (i.e. playing and pausing)
use fliters;
use rodio::{OutputStream, Sink};

fn main() {
    let (_stream, handle) = OutputStream::try_default().unwrap();
    let sink = Sink::try_new(&handle).unwrap();
    let fwav = fliters::tts("play this audio with some stream controls");
    let decoder = fwav.get_decoder();
    sink.append(decoder);
    sink.play();
    std::thread::sleep(std::time::Duration::from_secs(1));
    sink.pause();
    std::thread::sleep(std::time::Duration::from_secs(3));
    sink.play();
    sink.sleep_until_end();
}

Check out the make_waveform example to see how we go from text -> 16-bit samples -> (time, amplitude) pairs -> wave form visualization in your terminal!

cargo run --example make_waveform

image

Tested on

  • MacOS Sonoma 14.2
  • Debian (bookworm)

Roadmap

  • basic tts api
  • control output stream with play
  • optimize build (include only necessary c files)
  • customize voice (defaults to slt right now)
  • debian linux amd64 support
  • jetson orin support

Installation

Linux Dependencies

On linux, rodio relies on cpal and cpal needs alsa development files to build. You can see rodio's repo for more info.

sudo apt install libasound2-dev

crate

Add this to your cargo.toml: fliters = "0.1.8"

If you install the crate, but encounter build errors, try to specify the repo as the dependency. Submit an issue in the meantime while I investigate.

fliters = { git = "https://github.com/jackycamp/flite-rs" }

Building

# clone the repository
git clone https://github.com/jackycamp/flite-rs.git

# If you want the git submodules on first clone
git clone --recursive https://github.com/jackycamp/flite-rs.git

# do the build
cd flite-rs && cargo build

# run an example
cargo run --example tts

Dependencies

~0.9–32MB
~408K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy