This is a simple Rust application that converts text into speech using Google Translate's Text-to-Speech service and plays the generated audio through the default audio output device on your system. The application utilizes the rodio
crate for audio playback and communicates with the TTS service using HTTP requests.
- Convert text to speech using Google Translate's TTS service.
- Play the generated audio through the default audio output device.
- Support for both direct text input and file-based TTS playback.
- Graceful termination using Ctrl+C signal handler.
- Rust programming language: Install Rust
- Dependencies:
rodio
,cpal
,ctrlc
,base64
,urlencoding
,ureq
(specified inCargo.toml
)
- Clone this repository:
git https://github.com/icsboyx/rust_tts.git
cd rust-tts-app
- Build and run the application:
cargo build; cargo run
- Follow the on-screen instructions to input text for text-to-speech conversion. Press Ctrl+C to terminate the application.
The application uses Google Translate's TTS service for audio generation. If you encounter issues or want to customize the service, refer to the tts.rs module.
let tts_lang = "it"; // default language
let tts_slow = "false"; // default fast
let tts_tld = "it"; // default top domain (TLD)
Contributions are welcome! If you find a bug or want to add new features, feel free to create a pull request.
This project was inspired by the Twitch channel of Prof. Andrea Pollini and the supportive Twitch community. Thanks to their encouragement and feedback!
This project is licensed under the MIT License - see the LICENSE for details.