LoslegenKostenlos loslegen

Using the SpeechRecognition library

To save typing speech_recognition every time, we'll import it as sr.

We'll also setup an instance of the Recognizer class to use later.

The energy_threshold is a number between 0 and 4000 for how much the Recognizer class should listen to an audio file.

energy_threshold will dynamically adjust whilst the recognizer class listens to audio.

Diese Übung ist Teil des Kurses

Spoken Language Processing in Python

Kurs anzeigen

Anleitung zur Übung

  • Import the speech_recognition library as sr.
  • Setup an instance of the Recognizer class and save it to recognizer.
  • Set the recognizer.energy_threshold to 300.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Importing the speech_recognition library
import ____ as ____

# Create an instance of the Recognizer class
____ = sr.____()

# Set the energy threshold
recognizer.____ = ____
Code bearbeiten und ausführen