I want to get an average amplitude of the sound file for every second. For example the average amplitude of 0-1 sec,1-2 sec, and so on. I tried reducing the sample rate to 1 but the value drops to 0 in that case.
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
import librosa as lr
y, sr = lr.load(file,sr=10)
print(y)
print(len(y))
time = np.arange(0,len(y))/sr
print(len(time))
print(time,y)
print(y)
fig, ax = plt.subplots()
ax.plot(time,y)
ax.set(xlabel='Time(s)',ylabel='sound amplitude')
plt.show()
Note: I'm trying to get the amplitude value in dB. Really new with Librosa, would appreciate any help:)