Skip to content

Instantly share code, notes, and snippets.

@Sharon-f
Sharon-f / speechrecognition.py
Created September 27, 2017 09:45
Python program to convert speech to text
import speech_recognition as sr
# obtain path to "Daily_English_Conversation_02_Do_you_speak_English.wav" in the same folder as this script
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "Daily_English_Conversation_02_Do_you_speak_English.wav")
# use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:namelist2.wav
print("Say something!")