LoslegenKostenlos loslegen

Adjusting audio parameters

During your exploratory data analysis, you may find some of the parameters of your audio files differ or are incompatible with speech recognition APIs.

Don't worry, PyDub has built-in functionality which allows you to change various attributes.

For example, you can set the frame rate of your audio file calling set_frame_rate() on your AudioSegment instance and passing it an integer of the desired frame rate measured in Hertz.

In this exercise, we'll practice altering some audio attributes.

Diese Übung ist Teil des Kurses

Spoken Language Processing in Python

Kurs anzeigen

Interaktive Übung

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

# Import audio file
wav_file = AudioSegment.from_file(file="wav_file.wav")

# Create a new wav file with adjusted frame rate
wav_file_16k = wav_file.____(____)

# Check the frame rate of the new wav file
print(wav_file_16k.____)
Code bearbeiten und ausführen