

time_series is a one-dimensional array that represents the time when each sample was taken. mple_rate is how much samples are taken per period. Librosa.load() is reading the given file and keeps the information about the file for later uses. Here is a code which returns a 2-dimensional array of frequencies magnitude corresponding to a certain time: # getting information from the file time_series, sample_rate = librosa.load(filename) # getting a matrix which contains amplitude values according to frequency and time indexes stft = np.abs(librosa.stft(time_series, hop_length=512, n_fft=2048*4)) # converting the matrix to decibel matrix spectrogram = librosa.amplitude_to_db(stft, ref=np.max) Librosa has very useful functions that help us to analyze sounds.


In my project, I used Pygame(graphical) and Librosa(sounds). Implementation in Pythonīefore you start to code, you need to install a graphical library and a sound analyzer library. While the music goes on, those bars will move up or down, depends on the amplitude of the frequency. The easiest way to visualize that is by drawing a row of bars. The vibration is defined by frequency and amplitude - speed and loudness. Sounds are frequent vibrations that our ear detects. We need to know how music consists of and how to visualize those parts.
