I am working with liberosa and I need to get the estimate dB out of a few audio files. I thought I could easly use the librosa.amplitude_to_db function but I have a problem.
I don't knowe what I did wrong. What do I need to do to solve this problem? I use the librosa.amplitude_to_db function and I am geting strange Spectrograms. like this image and when I make a Spectrogramme of the amplitude of the same audio recording I get this image. this is the code I use with the function.
# importing library
import librosa
import numpy as np
import matplotlib.pyplot as plt
# path to files
pathAudio = "Path to the audio files"
files = librosa.util.find_files(pathAudio)
files = np.asarray(files)
# load al audio recordings
for i in files:
data = librosa.load(i, sr=None, mono=True)
data = data[0]
#trim audio recordings(remove all zero)
data = librosa.effects.trim(data)
data = data[0]
# convert all ampletudie to dB
db = librosa.amplitude_to_db(data)
data = data[0]
# plot Spectrogramme
fig, ax = plt.subplots()
librosa.display.waveshow(db)
ax.set_title("audio_name")
ax.set_ylabel("dB")
ax.set_xlabel("time")
plt.show()
I don't knowe how to get a dB which can be use or is this a useful dB?
thank you in advance.