Projects / 9 of 9
Google TTS API
Google Tts API (Rust crate)
A Rust crate to interact with Google Text-to-speech API.
Google Text To Speech API in Rust
google-tts-api is a Rust crate to interact with Google Text-to-speech API. The project enables the conversion of plain text or SSML inputs to natural-sounding audio. The goal is to provide a ready-to-go crate with auto-refreshing Google API tokens capability. Additionally, the crate includes a feature to convert the synthesized text audio response from Google into playable content for Discord channels through integration with the songbird crate.
Techs: Rust, Spotify API
Github(opens in a new tab)What I Did
- Implemented the integration with Google’s TTS API using Rust with auto-refreshing token feature by introducing the auto-refreshing token mechanism to ensure uninterrupted access to the service.
- Developed feature to convert Google’s synthesized audio responses into a format compatible with Discord voice channels using the songbird crate. This feature expands the utility of the google-tts-api crate, allowing developers to create applications that can read text aloud in Discord servers, enhancing interactivity and accessibility.
- Ensured the crate’s reliability by writing tests in Rust and utilizing its multi-threading feature for faster tests.
What I Learned
- Integrating with Google Cloud APIs and understanding their authentication mechanisms using service account credentials.
- Handling asynchronous operations and leveraging Rust’s async/await syntax for efficient I/O operations when making API requests.
- Working with different audio formats and encodings, such as MP3 and WAV, to ensure compatibility with various platforms and use cases.
- Designing and implementing a user-friendly API for the crate, considering developer experience and ease of use.
- Managing and refreshing access tokens automatically to ensure uninterrupted access to the Google TTS API.
- Writing comprehensive documentation and examples to facilitate the adoption and usage of the crate by other developers.
- Utilizing Rust’s testing framework and writing unit and integration tests to ensure the reliability and correctness of the crate.
About the project
Overview
google-tts-api is a Rust library providing an interface to Google’s Text To Speech (TTS) API. This library enables Rust applications to convert text into natural-sounding speech using Google’s state-of-the-art deep learning models.
Features
- Interface to Google’s TTS API using Rust.
- Support for various languages and voices.
- Customization of speech parameters (e.g., pitch, speed, volume).
- Support for both plaintext and SSML inputs.