Transcribing Audio in Python
Israel-Lopes
Posted on December 13, 2022
Dependencies
- build-essential
- portaudio19-dev
- pyaudio
sudo apt-get install build-essential
sudo apt install portaudio19-dev
pip install pyaudio
Example
import speech_recognition as sr
r = sr.Recognizer()
while True:
# Initialize the microphone
with sr.Microphone() as source:
print("Speak!!: ")
audio = r.listen(source)
try:
# do the transcription
transcription = r.recognize_google(audio, language='en-US')
print(transcription)
except sr.UnknownValueError:
print("Didn't understand the audio")
except sr.RequestError:
print("request error")
💖 💪 🙅 🚩
Israel-Lopes
Posted on December 13, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024