#google-translate #tts #url #api #service #retrieve #voice-rss

tts-urls

Format URLs to retrieve audio from TTS (text to speech) services like Google Translate or VoiceRSS

4 releases (1 stable)

1.0.0 Jan 30, 2021
0.3.0 Jan 23, 2021
0.2.1 May 3, 2020
0.2.0 Apr 28, 2020

#829 in Audio

23 downloads per month

MIT license

15KB
322 lines

tts-urls

This crate formats URLs to retrieve audio from TTS (text to speech) services like Google Translate or VoiceRSS.

Examples

Google Translate TTS:

let url = tts_urls::google_translate::url("Hello, World!", "en");
assert_eq!(url, "https://translate.google.com/translate_tts?ie=UTF-8&q=Hello%2C%20World%21&tl=en&tk=418730.60457&client=webapp");

VoiceRSS:

use tts_urls::voicerss::VoiceRSSOptions;
let key = "key";

let url = VoiceRSSOptions::new()
    .language("de-de")
    .audio_format("32khz_16bit_stereo")
    .codec("mp3")
    .url(key, "Hallo Welt!");
assert_eq!(url, "http://api.voicerss.org/?key=key&hl=de-de&c=mp3&f=32khz_16bit_stereo&src=Hallo%20Welt%21");

Credits

This crate started out as a fork of google_translate_tts.


lib.rs:

This crate formats URLs to retrieve audio from TTS (text to speech) services like Google Translate or VoiceRSS.

Examples

Google Translate TTS:

let url = tts_urls::google_translate::url("Hello, World!", "en");
assert_eq!(url, "https://translate.google.com/translate_tts?ie=UTF-8&q=Hello%2C%20World%21&tl=en&tk=418730.60457&client=webapp");

VoiceRSS:

use tts_urls::voicerss::{VoiceRSSOptions, Language, Codec};
let key = "key";

let url = VoiceRSSOptions::new()
    .language(Language::German)
    .audio_format("32khz_16bit_stereo")
    .codec(Codec::MP3)
    .url(key, "Hallo Welt!");
assert_eq!(url, "http://api.voicerss.org/?key=key&hl=de-de&c=MP3&f=32khz_16bit_stereo&src=Hallo%20Welt%21");

Dependencies

~14KB