-
-
Save dataf3l/9a61acb89975b9bc22829bfe2f96082f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
texts = [{'text':"hola", 'lang':'es'}, | |
{'text':"hello",'lang':'en'}, | |
{'text':"你好",'lang':'zh'}, | |
{'text':"disfruta este audio",'lang':'es'}, | |
{'text':"enjoy this audio",'lang':'en'}, | |
{'text':"享受这个音频",'lang':'zh'}, | |
{'text':"aprende un nuevo idioma",'lang':'es'}, | |
{'text':"learn a new language",'lang':'en'}, | |
{'text':"学习一门新的语言",'lang':'zh'}] | |
voices = {} | |
voices["zh"] = "Ting-Ting" | |
voices["es"] = "Monica" | |
voices["en"] = "Alex" | |
for segment in texts: | |
print(segment["lang"]) | |
print(segment["text"]) | |
voice = voices[segment["lang"]] | |
subprocess.call(["say", "-v", voice, segment["text"]]) | |
print("------") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment