Posted inData Science

Visualize audio using python into waveplot

Thumbnail article

Visualize audio using python into waveplot

Audio can be visualize into a several form. One of the visualization called waveplot. Waveplots visualize the loudness of the audio at a given time. Visualization can be done easily using python library called librosa. Librosa usually used for music and audio analysis. It provides the building blocks necessary to create music information retrieval systems. The code below is used to install the librosa library.

pip install librosa

The code below is used to display audio into waveplot. We are using .au file. You can use another audio format too.

import librosa
import librosa.display
y, sr = librosa.load('pop.00007.au') 
librosa.display.waveplot(y, sr=sr)

First we need to import the library. The third line is used to read the audio. It is returning audio signal and sample rate value. By using librosa.display.waveplot the audio can be visualize. y is an audio time series (mono or stereo), and sr is a sampling rate of y. If y is monophonic, a filled curve is drawn between [-abs(y), abs(y)]. If y is stereo, the curve is drawn between [-abs(y[1]), abs(y[0])], so that the left and right channels are drawn above and below the axis, respectively. Waveplot This is the link of the audio visualization code which written in python. https://github.com/Garudabyte/audio-visualization We highly recommend you to run the program in jupyter notebook. You can install jupyter notebook by following the instruction in the link below. https://garudabyte.com/how-to-open-ipynb-file/ You can also see another audio visualization in the link below. https://garudabyte.com/visualize-audio-using-python-into-spectrogram/ https://garudabyte.com/visualize-audio-using-python-into-chromagram/

Leave a Reply