load directly an audio file with librosa in dB

993 views Asked by At

Is there a way to directly load an audio file with librosa in dB instead of amplitude as obtained by:

y, sr = librosa.load(filename, sr=None)
1

There are 1 answers

3
Anil_M On

librosa as mentioned in this paper, pulls audio file as one dimensional numpy array.

from the documentation:

An audio signal is represented as a one-dimensional numpy array, denoted as y throughout librosa. Typically the signal y is accompanied by the sampling rate (denoted sr ) which denotes the frequency (in Hz) at which values of y are sampled.

From the code:

>>> type(y)
<type 'numpy.ndarray'>
>>> y
array([-0.00265948, -0.0045677 , -0.00412048, ..., -0.00179085,
       -0.00228079, -0.00238096], dtype=float32)
>>> 

librosa makes use of The array elements of y and sampling rate for its calculations and representation.

You may need to elaborate as to "load directly an audio file with librosa in dB" and it's intended purpose.