Skip to content

Instantly share code, notes, and snippets.

@jacks0n9
Last active March 16, 2021 01:28
Show Gist options
  • Save jacks0n9/c8e0dab01099fb23a136b5e3a2c9fd0e to your computer and use it in GitHub Desktop.
Save jacks0n9/c8e0dab01099fb23a136b5e3a2c9fd0e to your computer and use it in GitHub Desktop.
from urllib.parse import quote
from urllib.request import urlopen
text=input("Input text you want to synthesize: ")
filename=input("What file should I put the audio in: ")
url="https://www.google.com/speech-api/v1/synthesize?lang=en&text="+quote(text)
data=urlopen(url)
audio=data.read()
with open(filename,'wb') as file:
file.write(audio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment