How to use the stt.Google function in stt

To help you get started, we’ve selected a few stt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thomasweng15 / E.V.E. / jarvis / jarvis.py View on Github external
def main():
	speaker = tts.Google()

	# test internet connection
	if not internet_on():
		speaker.play_wav("./jarvis/wav/internet_err.wav")
		return

	try:
		speaker.play_wav("./jarvis/wav/yes.wav")

		audioInput = Microphone()
		audioInput.listen()

		# init new Voice class associated with audio 
		speech_to_text = stt.Google(audioInput)

		# convert audio file into text and init a new Job class with text
		recorded_text = speech_to_text.get_text()
		job = Job(recorded_text)

		# parse commands 
		first_word = (recorded_text.split(' ')[0]).lower() 
		second_word = ""

		if recorded_text.find(' ') >= 1:
			second_word = (recorded_text.split(' ')[1]).lower()

		# initialize controller for web browser
		controller = webbrowser.get()

		# execute commands based on first word in query
github thomasweng15 / E.V.E. / brain / listen.py View on Github external
def listen(self):
		try:
			audioInput = Microphone()
			audioInput.listen()
	 
			speech_to_text = stt.Google(audioInput)
			recorded_text = speech_to_text.get_text()
			job = Job(recorded_text)

			controller = webbrowser.get() # initialize controller for web browser

			# parse first and second words in command
			first_word = (recorded_text.split(' ')[0]).lower() 
			if recorded_text.find(' ') >= 1:
				second_word = (recorded_text.split(' ')[1]).lower()
			else:
				second_word = ""

			# execute commands based on first word in query
			if first_word == "stop" or first_word == "no" \
					or recorded_text.find('no stop') != -1:
				print "---Accidental recording---"
github thomasweng15 / E.V.E. / hal-e / hal-e.py View on Github external
def listen():
	print "Initializing..."
	speaker = tts.Google()
	
	if not internet_on():
		print("No Internet connection.")
		speaker.play_wav("./hal-e/wav/internet_err.wav")
		return

	speaker.play_wav("./hal-e/wav/yes.wav")

	try:
		audioInput = Microphone()
		audioInput.listen()
 
		speech_to_text = stt.Google(audioInput)

		recorded_text = speech_to_text.get_text()
		job = Job(recorded_text)

		# parse first and second words in command
		first_word = (recorded_text.split(' ')[0]).lower() 
		if recorded_text.find(' ') >= 1:
			second_word = (recorded_text.split(' ')[1]).lower()
		else:
			second_word = ""

		# initialize controller for web browser
		controller = webbrowser.get()

		# execute commands based on first word in query
		if first_word == "open":
github thomasweng15 / E.V.E. / brain / brain.py View on Github external
def set_job(self):
		"""
		Send audio input to Google's Speech to text
		engine to be interpreted, and then init a Job class 
		with the returned text if successful. 

		"""
		speech_to_text = stt.Google(self.audioInput)
		try:
			recorded_text = speech_to_text.get_text().lower()
			return Job(recorded_text)
		except NotUnderstoodException:
			print "Sorry, I didn't get that."
			self.speaker.play_wav("./wav/didntget.wav")
			return None
		except ConnectionLostException:
			print "No connection."
			self.speaker.play_wav("./wav/internet_err.wav")
			return None

stt

A library for doing speech recognition using a Coqui STT model

MPL-2.0
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis