ESC-50 | ESC-50 : Dataset for Environmental Sound Classification | Dataset library
kandi X-RAY | ESC-50 Summary
kandi X-RAY | ESC-50 Summary
ESC-50: Dataset for Environmental Sound Classification
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ESC-50
ESC-50 Key Features
ESC-50 Examples and Code Snippets
Community Discussions
Trending Discussions on ESC-50
QUESTION
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import librosa as lr
import glob
path = r'/content/drive/MyDrive/ESC-50/305 - Coughing/*.ogg'
a = glob.glob(path)
print(len(a))
for file in range(0,len(a),1):
#scale, sr = librosa.load(a[file])
#print(sr)
scale, sr = librosa.load(a[file])
mel_spectrogram = librosa.feature.melspectrogram( scale, sr=sr, n_fft=1024, hop_length=512,
n_mels=228
)
mel_spectrogram.shape
log_mel_spectrogram = librosa.power_to_db((mel_spectrogram))
log_mel_spectrogram.shape
plt.figure(figsize=(10, 5))
librosa.display.specshow(log_mel_spectrogram, x_axis="time",
y_axis="log",
sr=sr)
plt.colorbar(format="%+2.f")
plt.show()
...ANSWER
Answered 2021-Nov-03 at 15:39The values of your spectrogram looks reasonable, and to be generally in the same range for all the audio clips. But you have not specified the color map when plotting, so some of them have different color maps due to the autodetection in librosa. Specify cmap='magma' for librosa.display.specshow and that should not be a problem.
Note that for machine learning, you should not use the plot of the spectrogram, but the spectrogram values directly. If you want an image representation of that, see https://stackoverflow.com/a/57204349/1967571
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ESC-50
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page