Display audio signal samples using Python!

Code snippet to stem an audio signal in Python


  1. In the main() function, we generate a sine and pass the initial 40 samples into the “stem and save” function.
  2. In the stem_signal() function, we mostly adjust the figure’s properties. We adjust the limits of the figure to include all samples. Lines starting with ax turn off the ugly frame of the plot.
  3. In the save() function, we create the output directory and then save the figure in it with high quality and transparent background.

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!