Skip to content

Instantly share code, notes, and snippets.

@Deathcrash
Last active June 29, 2023 10:55
Show Gist options
  • Save Deathcrash/d7d58086b5c2891b4b6508af623e3adc to your computer and use it in GitHub Desktop.
Save Deathcrash/d7d58086b5c2891b4b6508af623e3adc to your computer and use it in GitHub Desktop.
audio play python
from gtts import gTTS
import os
import subprocess
from subprocess import check_output
text = "Global warming is the long-term rise in the average temperature of the Earth’s climate system"
language = "en"
speech = gTTS(text=text, lang=language, slow=False)
speech.save("text.mp3")
os.system('nircmd mediaplay 10000 text.mp3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment