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.
This exercise is part of the course
Spoken Language Processing in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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.____)