Processing audio data with Python
You've seen how a sound waves can be turned into numbers but what does all that conversion look like?
And how about another similar sound wave? One slightly different?
In this exercise, we're going to use MatPlotLib to plot the sound wave of good_morning against good_afternoon.
To have the good_morning and good_afternoon sound waves on the same plot and distinguishable from each other, we'll use MatPlotLib's alpha parameter.
You can listen to the good_morning audio here and good_afternoon audio here.
Este exercício faz parte do curso
Spoken Language Processing in Python
Instruções do exercício
- Set the title to reflect the plot we are making.
- Add the
good_afternoontime variable (time_ga) and amplitude variable (soundwave_ga) to the plot. - Do the same with the
good_morningtime variable (time_gm) and amplitude variable (soundwave_gm) to the plot. - Set the alpha variable to
0.5.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Setup the title and axis titles
plt.title('Good Afternoon vs. Good ____')
plt.ylabel('Amplitude')
plt.xlabel('Time (seconds)')
# Add the Good Afternoon data to the plot
plt.plot(____, ____, label='Good Afternoon')
# Add the Good Morning data to the plot
plt.plot(____, ____, label='Good Morning',
# Set the alpha variable to 0.5
alpha=____)
plt.legend()
plt.show()