Created
January 29, 2017 20:31
-
-
Save hexvolt/fccec9a0f62616b9ad608dbb4f04cad0 to your computer and use it in GitHub Desktop.
Small script to get the .mp3 pronunciations of the phrases specified in the .csv file
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 csv | |
from gtts import gTTS | |
from tempfile import TemporaryFile | |
FILE_NAME = '{{input_file_name}}.csv' | |
def main(): | |
with open(FILE_NAME, 'r') as input_file: | |
reader = csv.reader(input_file) | |
for row in reader: | |
phrase = row[0].strip() | |
mp3_file_name = '_'.join(phrase.split()) + '.mp3' | |
print(mp3_file_name) | |
tts = gTTS(text=phrase, lang='en') | |
with open(mp3_file_name, 'w') as output_file: | |
tts.write_to_fp(output_file) | |
if __name__ == '__main__': | |
main() |
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
argparse==1.2.1 | |
gTTS==1.1.7 | |
gTTS-token==1.1.1 | |
requests==2.12.4 | |
wsgiref==0.1.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment