1. Learn
  2. /
  3. Courses
  4. /
  5. Spoken Language Processing in Python

Connected

Exercise

Working with noisy audio

In this exercise, we'll start by transcribing a clean speech sample to text and then see what happens when we add some background noise.

A clean audio sample has been imported as clean_support_call.

Play clean support call.

We'll then do the same with the noisy audio file saved as noisy_support_call. It has the same speech as clean_support_call but with additional background noise.

Play noisy support call.

To try and negate the background noise, we'll take advantage of Recognizer's adjust_for_ambient_noise() function.

Instructions 1/4

undefined XP
  • 1

    Let's transcribe some clean audio. Read in clean_support_call as the source and call recognize_google() on the file.

  • 2

    Let's do the same as before but with a noisy audio file saved as noisy_support_call and show_all parameter as True.

  • 3

    Set the duration parameter of adjust_for_ambient_noise() to 1 (second) so recognizer adjusts for background noise.

  • 4

    A duration of 1 was too long and it cut off some of the audio. Try setting duration to 0.5.