Skip to content

Commit

Permalink
removed more calls to logamplitude
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Dec 7, 2016
1 parent 89c64ba commit cb1aa7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions librosa/core/harmonic.py
Expand Up @@ -71,8 +71,8 @@ def salience(S, freqs, h_range, weights=None, aggregate=None,
(1025, 646)
>>> import matplotlib.pyplot as plt
>>> plt.figure()
>>> librosa.display.specshow(librosa.logamplitude(S_sal**2,
... ref=S_sal.max()**2),
>>> librosa.display.specshow(librosa.amplitude_to_db(S_sal,
... ref=np.max),
... sr=sr, y_axis='log')
>>> plt.tight_layout()
"""
Expand Down Expand Up @@ -185,8 +185,8 @@ def interp_harmonics(x, freqs, h_range, kind='linear', fill_value=0, axis=0):
>>> plt.figure()
>>> for i, _sh in enumerate(S_harm, 1):
... plt.subplot(3, 2, i)
... librosa.display.specshow(librosa.logamplitude(_sh**2,
... ref=S.max()**2),
... librosa.display.specshow(librosa.amplitude_to_db(_sh,
... ref=S.max()),
... sr=sr, y_axis='log')
... plt.title('h={:.3g}'.format(h_range[i-1]))
... plt.yticks([])
Expand Down Expand Up @@ -292,8 +292,8 @@ def harmonics_1d(harmonic_out, x, freqs, h_range, kind='linear',
>>> plt.figure()
>>> for i, _sh in enumerate(S_harm, 1):
... plt.subplot(3,2,i)
... librosa.display.specshow(librosa.logamplitude(_sh**2,
... ref=S.max()**2),
... librosa.display.specshow(librosa.amplitude_to_db(_sh,
... ref=S.max()),
... sr=sr, y_axis='log')
... plt.title('h={:.3g}'.format(h_range[i-1]))
... plt.yticks([])
Expand Down
4 changes: 2 additions & 2 deletions librosa/feature/spectral.py
Expand Up @@ -13,7 +13,7 @@

from ..core.time_frequency import fft_frequencies
from ..core.audio import zero_crossings, to_mono
from ..core.spectrum import logamplitude, power_to_db, _spectrogram
from ..core.spectrum import power_to_db, _spectrogram
from ..core.constantq import cqt, hybrid_cqt
from ..core.pitch import estimate_tuning

Expand Down Expand Up @@ -391,7 +391,7 @@ def spectral_contrast(y=None, sr=22050, S=None, n_fft=2048, hop_length=512,
if linear:
return peak - valley
else:
return logamplitude(peak) - logamplitude(valley)
return power_to_db(peak) - power_to_db(valley)


def spectral_rolloff(y=None, sr=22050, S=None, n_fft=2048, hop_length=512,
Expand Down
2 changes: 1 addition & 1 deletion librosa/onset.py
Expand Up @@ -419,7 +419,7 @@ def onset_strength_multi(y=None, sr=22050, S=None, lag=1, max_size=1,
S = np.abs(feature(y=y, sr=sr, **kwargs))

# Convert to dBs
S = core.logamplitude(S)
S = core.power_to_db(S)

# Retrieve the n_fft and hop_length,
# or default values for onsets if not provided
Expand Down

0 comments on commit cb1aa7d

Please sign in to comment.