I am trying to get db values from .wav file python using this formula:
dbs = [20 * np.log10(np.sqrt(np.mean(chunk ** 2))) for chunk in chunks]
The issue I am facing is I am getting NaN values in dbs list because of negative values coming from np.mean(chunk**2).
How can I resole this issue?
nanis because of this. you can map negative values ofnp.mean(chunk ** 2)to 1 so itslog10will be 0.The issue I am facing is I am getting NaN values in dbs list because of negative values coming from np.mean(chunk**2).