Format of storage of audio frequency when extracted from an audio file using librosa

Viewed 15

I have used librosa to extract the frequency from an audio file. My code is:

import numpy as np

audio_name = 'C:\\Users\\USER\\Desktop\\Songs\\abc.wav'
hop_length = 512
window_size = 2048

import librosa
y, sr = librosa.load(audio_name)    # y=time series(one-dimensional NumPy floating point array), sr= sampling rate of y, that is, the number of samples per second of audio. By default, all audio is mixed to mono and resampled to 22050 Hz at load time
window = np.hanning(window_size)
out = librosa.core.spectrum.stft(y, n_fft=window_size, hop_length=hop_length, window=window)
out = 2 * np.abs(out) / np.sum(window)

# MFCC
d = np.abs(librosa.stft(y))**2
mfccs = librosa.feature.mfcc(y=y, sr=sr, S=d)
# print("MFCC is: \n", mfccs)

# MFCC to Mel
mel = librosa.feature.inverse.mfcc_to_mel(mfccs[:10])
print("Mel is: \n", mel)

# Mel to Hz
freq = librosa.mel_to_hz(mel)
print("Frequency is: \n", freq)

Now the output of the frequency is in the form of a 2 dimensional array as shown below:

Frequency is: 
 [[66.666664 66.666664 66.666664 ... 66.667015 66.66668  66.666664]
 [66.666664 66.666664 66.666664 ... 66.667015 66.66668  66.666664]
 [66.666664 66.666664 66.666664 ... 66.66701  66.66667  66.666664]
 ...
 [66.666664 66.666664 66.666664 ... 66.66666  66.666664 66.666664]
 [66.666664 66.666664 66.666664 ... 66.66666  66.666664 66.666664]
 [66.666664 66.666664 66.666664 ... 66.66666  66.666664 66.666664]]

My question is does each sub-list contain a single note and if so, is it represented by the predominant local pulse or am I messing stuff up?

Please please help for I am completely new to audio-processing.

0 Answers
Related