Skip to content

Instantly share code, notes, and snippets.

View BenHamm's full-sized avatar

Ben Hamm BenHamm

  • OctoML
  • Seattle, WA
View GitHub Profile
import speech_recognition as sr
from text_to_speech import text_to_speech #a different module, but you can guess what it does
import pygame
pygame.mixer.init()
def capture_speech():
r = sr.Recognizer()
with sr.Microphone() as source: # use the default microphone as the audio source
pygame.mixer.Sound("open_mic.wav").play() #play a prompt sound so that the user knows that they can speak
import speech_recognition as sr
import time
import sys
sys.stdout = open('/dev/null', 'w')
from text_to_speech import text_to_speech
import pygame
sys.stdout = sys.__stdout__
pygame.mixer.init()
@BenHamm
BenHamm / ConVarThread.py
Last active March 24, 2019 22:27
Threading condition vars
import threading
import time
condition = threading.Condition()
def lock_door():
global condition
while True:
print("Lock Thread: Door lock armed")