Added functions in the python wrapper for speechd

master
Mohammad Shoaib 2022-01-28 18:34:04 +05:30
parent 4628dce7bb
commit e84d5ab6bf
5 changed files with 40 additions and 10 deletions

View File

@ -0,0 +1,9 @@
import libspeechd
speech = libspeechd.Speech
speech.Initialize(self=speech)
speech.Say(self=speech, text="hello", interrupt=False)
speech.Close(self=speech)

View File

@ -0,0 +1,14 @@
import libspeechd
import time
speech = libspeechd.Speech
speech.Initialize(self=speech)
speech.Say(self=speech, text="This is a very very very long string.", interrupt=False)
time.sleep(1)
speech.Say(self=speech, text="I interrupted :)", interrupt=True)
speech.Close(self=speech)

View File

@ -1,12 +1,18 @@
from multiprocessing.connection import wait
from threading import Thread
from time import time
import speechd
import time
client = speechd.SSIPClient('test')
client.speak("Hello World! this is yusuf")
time.sleep(1)
client.stop()
client.speak("No this is shoaib")
client.close()
class Speech:
client = None
def Initialize(self):
self.client = speechd.SSIPClient('stardew-access')
def Say(self, text, interrupt):
if(self.client is not None):
if(interrupt):
self.client.stop()
self.client.speak(text)
def Close(self):
if(self.client is not None):
self.client.close()

View File

@ -13,6 +13,7 @@
<ItemGroup>
<PackageReference Include="AccessibleOutput" Version="1.0.0" />
<PackageReference Include="AutoHotkey.Interop" Version="1.0.0.1" />
<PackageReference Include="IronPython" Version="2.7.12" />
<PackageReference Include="Lib.Harmony" Version="2.2.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" />
</ItemGroup>