Created
May 23, 2018 18:43
-
-
Save anujdeshpande/bbab1708c4f7acdc2c9e179532d272f2 to your computer and use it in GitHub Desktop.
This python script will create audio clips for something like this - https://github.com/AnirbanBanik1998/Modern_Speak_and_Spell/blob/master/Speech_Processing/accuracy_check/a.txt
This file contains 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 json, os | |
import pprint | |
# Generated voices.json with `aws polly describe-voices > voices.json` | |
with open('voices.json') as json_data: | |
d = json.load(json_data) | |
with open("a.txt") as f: | |
content = f.readlines() | |
# you may also want to remove whitespace characters like `\n` at the end of each line | |
content = [x.strip() for x in content] | |
for e in d["Voices"]: | |
pprint.pprint(e["Name"]) | |
if not os.path.exists(e["Name"]): | |
os.makedirs(e["Name"]) | |
for x in content: | |
print("aws polly synthesize-speech \ | |
--output-format mp3 \ | |
--voice-id "+e["Name"]+" \ | |
--text \""+x+"\"\ | |
"+e["Name"]+"/"+x+".mp3") | |
os.system("aws polly synthesize-speech \ | |
--output-format mp3 \ | |
--voice-id "+e["Name"]+" \ | |
--text \""+x+"\"\ | |
"+e["Name"]+"/"+x+".mp3") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment