griimnak
You're a slave to the money then you die
py-tts-script
I think someone here would find use in this script
This is a ~40 line Python script that returns text to speech.
Works with Python2 & 3, and requires no pip modules.
Tested on Windows and Linux, unfortunately I don't have a mac to test this on but I'm sure it should work like linux.
Source:
Usage
or use it as a module
How it works
If you're on linux or mac you may need to install the `say` package.
For windows, no packages are needed. It uses powershell's built in speech synthesizer
I think someone here would find use in this script
This is a ~40 line Python script that returns text to speech.
Works with Python2 & 3, and requires no pip modules.
Tested on Windows and Linux, unfortunately I don't have a mac to test this on but I'm sure it should work like linux.
Source:
You must be registered for see links
Usage
Bash:
python speak.py "Hello world"
or use it as a module
Python:
import speak
speak.speak_windows("Hello world")
# speak.speak_linux("Hello world")
How it works
If you're on linux or mac you may need to install the `say` package.
For windows, no packages are needed. It uses powershell's built in speech synthesizer
Python:
import os
import sys
""" usage: python speak.py "Hello world"
or use as a module:
import speak
speak.speak_windows("Hello world")
"""
__version__ = "0.1.0"
__author__ = "github.com/griimnak"
__all__ = ["speak_windows", "speak_linux"]
def speak_windows(speech):
os.system(
"powershell.exe -ExecutionPolicy ByPass "+
"param([String]$text='"+speech+"'); Add-Type -AssemblyName System.speech;"+
"$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;"+
"$speak.SelectVoice('Microsoft Zira Desktop'); $speak.Speak($text)"
)
def speak_linux(speech):
os.system('say "'+speech+'"')
def _cli_output(arg):
print('[working]')
if os.name == 'nt':
return speak_windows(arg)
return speak_linux(arg)
if __name__ == '__main__':
try:
_cli_output(sys.argv[1])
except IndexError:
print('''
usage: python speak.py "Hello world"
or use as a module:
import speak
speak.speak_windows("Hello world")''')
exit()