librosa.C_weighting

librosa.C_weighting(frequencies, min_db=-80.0)[source]

Compute the C-weighting of a set of frequencies.

Parameters
frequenciesscalar or np.ndarray [shape=(n,)]

One or more frequencies (in Hz)

min_dbfloat [scalar] or None

Clip weights below this threshold. If None, no clipping is performed.

Returns
C_weightingscalar or np.ndarray [shape=(n,)]

C_weighting[i] is the C-weighting of frequencies[i]

Examples

Get the C-weighting for CQT frequencies

>>> import matplotlib.pyplot as plt
>>> freqs = librosa.cqt_frequencies(108, librosa.note_to_hz('C1'))
>>> weights = librosa.C_weighting(freqs)
>>> fig, ax = plt.subplots()
>>> ax.plot(freqs, weights)
>>> ax.set(xlabel='Frequency (Hz)', ylabel='Weighting (log10)',
...        title='C-Weighting of CQT frequencies')
../_images/librosa-C_weighting-1.png