Plot any audio signal using Python!
Code snippet to plot an audio signal in Python
Explanation:
- Function
plot_signal()
plots the given signal using the passed-in time base (if given). - Function
plot_signal_and_save()
callsplot_signal()
and then saves the figure to the disk while making sure that theoutput_path
exists. You can show the figure withplt.show()
but when you use it, you won’t be able to save the figure as a file. - The
main()
function generates an example waveform (with time), plots it and saves to the disk usingplot_signal_and_save()
.
Code explanation video
Watch how this code was written and why I included particular lines in this explainer video:
Want to know what knowledge from digital signal processing in needed for audio programming? Check out my free Audio Plugin Developer Checklist!
Comments powered by Talkyard.