I constructed a simple app to recognize the speech and speak the results. But when i made a APK out of a python file through Buildozer, The tts worked out but the stt i.e the speech recognition didn't worked. The speech-to-text and the TTS library i used here is the Plyer
here is the code:
import kivy
from kivy.app import App
from kivy.uix.switch import Switch
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.image import Image
class SwitchContainer(GridLayout):
def __init__(self, **kwargs):
super(SwitchContainer, self).__init__(**kwargs)
self.cols = 1
self.add_widget(Label(text="speech recognizer", pos_hint= {'x': 5, 'y':
5,"right":5,"top":50},font_size= '90sp'))
self.settings_sample = Switch(active=False)
self.add_widget(self.settings_sample)
self.settings_sample.bind(active=switch_callback)
def switch_callback(switchObject, switchValue):
print('Value of sample settings is:', switchValue)
if(switchValue):
from plyer import tts
tts.speak('hello, will you please tell me the port')
try:
from plyer import stt
stt.start()
sst.stop()
from plyer import tts
tts.speak(stt.results)
except Exception as e:
from plyer import tts
tts.speak(' sir,its not working')
else:
print("off")
class SwitchExample(App):
def build(self):
return SwitchContainer()
# Run the kivy app
if __name__ == '__main__':
SwitchExample().run()
The GUI of this app consist only a button when switched on the speech is recognized and the results are spoken out through TTS or if any error is found it tell that "sir it's not working. What's wrong am i doing over here.