Comece agoraComece grátis

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.

Este exercicio faz parte do curso

Spoken Language Processing in Python

Ver curso

exercicio interativo prático

Tente este exercicio completando este código de exemplo.

# 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.____)
Editar e Executar Código