Skip to content

Commit

Permalink
Merge d1825a8 into 8e0cca8
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Apr 13, 2017
2 parents 8e0cca8 + d1825a8 commit e187b39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions librosa/feature/spectral.py
Expand Up @@ -360,6 +360,10 @@ def spectral_contrast(y=None, sr=22050, S=None, n_fft=2048, hop_length=512,
octa = np.zeros(n_bands + 2)
octa[1:] = fmin * (2.0**np.arange(0, n_bands + 1))

if np.any(octa[:-1] >= 0.5 * sr):
raise ParameterError('Frequency band exceeds Nyquist. '
'Reduce either fmin or n_bands.')

valley = np.zeros((n_bands + 1, S.shape[1]))
peak = np.zeros_like(valley)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_features.py
Expand Up @@ -353,6 +353,9 @@ def __test(S, freq, fmin, n_bands, quantile):
# bad quantile
yield __test, S, None, 200, 6, 2

# bands exceed nyquist
yield __test, S, None, 200, 7, 0.02


def test_rmse():

Expand Down

0 comments on commit e187b39

Please sign in to comment.