diff --git a/docs/example.rst b/docs/example.rst index a04c974..7532a65 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -113,7 +113,7 @@ resampy allows you to control the design of the filters used in resampling opera x, sr_orig = librosa.load(librosa.ex('trumpet'), sr=None, mono=False) # Resample to 22050Hz using a Hann-windowed sinc-filter - y = resampy.resample(x, sr_orig, sr_new, filter='sinc_window', window=scipy.signal.hann) + y = resampy.resample(x, sr_orig, sr_new, filter='sinc_window', window=scipy.signal.windows.hann) # Or a shorter sinc-filter than the default (num_zeros=64) y = resampy.resample(x, sr_orig, sr_new, filter='sinc_window', num_zeros=32) diff --git a/resampy/core.py b/resampy/core.py index 846dcb2..9db7ce8 100644 --- a/resampy/core.py +++ b/resampy/core.py @@ -81,7 +81,7 @@ def resample( >>> # Resample using a Hann-windowed sinc filter >>> import scipy.signal >>> resampy.resample(x, sr_orig, 22050, filter='sinc_window', - ... window=scipy.signal.hann) + ... window=scipy.signal.windows.hann) array([ 0.011, 0.123, 0.25 , ..., -0.366, -0.25 , -0.123]) >>> # Generate stereo data diff --git a/resampy/filters.py b/resampy/filters.py index fe6a038..c118ea9 100644 --- a/resampy/filters.py +++ b/resampy/filters.py @@ -100,7 +100,7 @@ def sinc_window(num_zeros=64, precision=9, window=None, rolloff=0.945): >>> # A filter with 10 zero-crossings, 32 samples per crossing, and a >>> # Hann window for tapering. >>> halfwin, prec, rolloff = resampy.filters.sinc_window(num_zeros=10, precision=5, - ... window=scipy.signal.hann) + ... window=scipy.signal.windows.hann) >>> halfwin array([ 9.450e-01, 9.436e-01, ..., -7.455e-07, -0.000e+00]) >>> prec @@ -111,7 +111,7 @@ def sinc_window(num_zeros=64, precision=9, window=None, rolloff=0.945): >>> # Or using sinc-window filter construction directly in resample >>> y = resampy.resample(x, sr_orig, sr_new, filter='sinc_window', ... num_zeros=10, precision=5, - ... window=scipy.signal.hann) # doctest: +SKIP + ... window=scipy.signal.windows.hann) # doctest: +SKIP ''' if window is None: diff --git a/scripts/create_filter.py b/scripts/create_filter.py index 85ebf1b..7dce8dd 100755 --- a/scripts/create_filter.py +++ b/scripts/create_filter.py @@ -85,7 +85,7 @@ def parse_arguments(args): def get_window(beta=None, rolloff=None, num_zeros=None): """Build the full window from a specification""" - win = functools.partial(scipy.signal.kaiser, beta=beta) + win = functools.partial(scipy.signal.windows.kaiser, beta=beta) fil = resampy.filters.sinc_window( num_zeros=num_zeros, precision=1, window=win, rolloff=rolloff )[0] @@ -157,7 +157,7 @@ def objective(trial, num_zeros, min_beta, max_beta, min_rolloff, attenuation): print("-" * 40) print(f"Objective value: {study.best_value:g}") - window = functools.partial(scipy.signal.kaiser, beta=study.best_params["beta"]) + window = functools.partial(scipy.signal.windows.kaiser, beta=study.best_params["beta"]) half_win, precision, roll = resampy.filters.sinc_window( num_zeros=params.num_zeros, precision=params.precision,