Back to Browse

How To Plot Magnitude Spectrum of Audio Signal with Python and Matplotlib | Tutorial for Beginners

2.4K views
Mar 29, 2024
26:20

👉 GET THE AUDIO PLUGIN DEVELOPER CHECKLIST: https://thewolfsound.com/checklist/ ✅ SOURCE CODE: https://thewolfsound.com/how-to-plot-magnitude-spectrum-of-audio-signals-with-python-and-matplotlib/ 🍊 Check out the sponsor JUCE C++ Framework: https://docs.juce.com/master/tutorial_new_projucer_project.html ✅ Sign up for WolfSound's newsletter: https://thewolfsound.com/newsletter/ ✅ Please subscribe to WolfSound to let the little Wolf 🐺 grow: https://www.youtube.com/c/WolfSoundAudio?sub_confirmation=1 🎧 Listen to my music: https://thewolfofficial.com/ Hi, my name is Jan Wilczek. I am an audio programmer and a researcher. Welcome to WolfSound! WolfSound's mission is to provide high-quality, informative, and entertaining videos, articles, and courses on how to process sound by exploring mathematics, applying algorithms, and creating code in various programming languages. Topics include sound synthesis, digital signal processing, programming languages for audio (C, C++, Python, Rust), and audio effects. I am also sharing tips on how to learn fast and effectively. Make sure to visit https://www.thewolfsound.com/. WolfSound enables everybody to learn about audio programming! ABOUT THE VIDEO In digital signal processing (DSP), we often compute the discrete Fourier transform (DFT) of an audio signal, for example, using the Fast Fourier Transform (FFT). This tutorial shows you how to easily display the magnitude of the DFT, the magnitude spectrum, using the Matplolib library in Python. The script includes examples of how to include decibels full-scale (dBFS) scaling of the magnitude axis and a logarithmic frequency axis for a better interpretability of the graph. In the video: ✅ Which libraries to use ✅ How to effortlessly compute the FFT of an audio signal ✅ Step-by-step writing of the plot_magnitude_spectrum functions ✅ How to plot the magnitude in decibels full-scale (dBFS) ✅ How to plot the frequency axis logarithmically which corresponds to our perception of pitch ✅ How to mark the frequency axis using the ISO-standardized octave band marks ✅ How to adjust the figure to your needs (colors, labels, font size, markersize and more) ✅ How to export your figure to a .png file with transparent background effortlessly ✅ How to adjust the limits of the plot properly for optimal readability Example speech comes from LibriSpeech: https://www.openslr.org/12/. ABOUT ME My name is Jan Wilczek. I am an audio programmer, a researcher in the field of music technology, and a musician. Through articles and videos from WolfSound, you will easily understand the main concepts of sound processing using software. My full story: https://youtu.be/0kBpcACGM6g FOLLOW WOLFSOUND ONLINE ✅ Blog: https://www.thewolfsound.com/ ✅ LinkedIn: https://www.linkedin.com/in/jan-wilczek-audio-programmer/ ✅ Twitter: https://twitter.com/wilczek_jan ✅ Facebook: https://www.facebook.com/JanWilczekWolfSound ✅ Instagram: https://www.instagram.com/janwolfwilczek/ ✅ Pinterest: https://pl.pinterest.com/jawitrle/ TIME CODES 00:00 Introduction 00:40 Installing necessary libraries using a virtual environment 02:12 Reading an example audio file with soundfile 04:07 Calculating the magnitude spectrum (absolute value of the FFT) 07:00 Plot magnitude spectrum with linear magnitude and frequency axis 12:46 How to save the figure as a file 16:20 Plot the magnitude in decibels 21:02 Plot the frequency axis logarithmically 24:44 Bonus: How to easily create audio plugins and musical apps #audio #python

Download

0 formats

No download links available.

How To Plot Magnitude Spectrum of Audio Signal with Python and Matplotlib | Tutorial for Beginners | NatokHD