Automatically choose correct speaker for language (via macOS's "say")
When I call trans like this on MacOS
$ trans -speak Dumpfbacke
Dumpfbacke
Dumpfbacke
Translations of Dumpfbacke
[ Deutsch -> English ]
Dumpf Backe
Dumpfbacke, dumbass
It correctly detects the text as German, yet it uses the English voice "Alex" to say it, which leads to an incorrect pronunciation.
It automatically should select the German voice "Anna" to say it!
I'm not knowledgeable about German, but it sounds German to me. Could you please report what you hear in the following URLs?
- https://translate.googleapis.com/translate_tts?ie=UTF-8&client=gtx&tl=de&q=Dumpfbacke
- https://translate.googleapis.com/translate_tts?ie=UTF-8&client=gtx&tl=en&q=Dumpfbacke
For me (1) is a female voice saying Dumpfbacke in German (correctly), and this is the URL trans uses; (2) is a female voice pronouncing it like "dump-f-bucky" in English.
It's known that Google Translate's TTS voice varies depending on locations. So if you hear English or a male voice, that's probably an IP-specific issue.
On macOS it's using the native say command and not the Google API
Oh, if you insist on using macOS's own speech synthesizer then I'm unable to fix it. I'm not sure what voices say supports since I don't use a mac.
If you want to use Google's TTS voice (which is way better than say), you may just install either mpv, mplayer or mpg123. I believe they're all available via Homebrew.
So this are all available voices:
| Voice | Lang Code |
|---|---|
| Alex | en_US |
| Alice | it_IT |
| Alva | sv_SE |
| Amelie | fr_CA |
| Anna | de_DE |
| Carmit | he_IL |
| Damayanti | id_ID |
| Daniel | en_GB |
| Diego | es_AR |
| Ellen | nl_BE |
| Fiona | en-scotland |
| Fred | en_US |
| Ioana | ro_RO |
| Joana | pt_PT |
| Jorge | es_ES |
| Juan | es_MX |
| Kanya | th_TH |
| Karen | en_AU |
| Kyoko | ja_JP |
| Laura | sk_SK |
| Lekha | hi_IN |
| Luca | it_IT |
| Luciana | pt_BR |
| Maged | ar_SA |
| Mariska | hu_HU |
| Mei-Jia | zh_TW |
| Melina | el_GR |
| Milena | ru_RU |
| Moira | en_IE |
| Monica | es_ES |
| Nora | nb_NO |
| Paulina | es_MX |
| Samantha | en_US |
| Sara | da_DK |
| Satu | fi_FI |
| Sin-ji | zh_HK |
| Tessa | en_ZA |
| Thomas | fr_FR |
| Ting-Ting | zh_CN |
| Veena | en_IN |
| Victoria | en_US |
| Xander | nl_NL |
| Yelda | tr_TR |
| Yuna | ko_KR |
| Yuri | ru_RU |
| Zosia | pl_PL |
| Zuzana | cs_CZ |
You choose them by calling say -v Alice.
Shouldn't be too hard to implement, right?
Thanks for the info. This will be implemented in the future.
Oh, if you insist on using macOS's own speech synthesizer then I'm unable to fix it. I'm not sure what voices
saysupports since I don't use a mac.
So you recommend doing this instead: trans -brief -play -player mpv :fr "Hello World" ?
Would be nice to have this in the README for macOS users.