question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for scipy polyphase resampling

See original GitHub issue

Description

Scipy 0.18 added a polyphase resampler. We could add support for this to core.resample, eg:

y_res = librosa.resample(y, sr_old, sr_new, res_type='polyphase')

Potential complications

  1. This would up the version requirement for scipy from 0.13 to 0.18. We could potentially make this soft.
  2. We’d probably need to expose some new parameters for specifying the window.
  3. We’d need a good way to determine the up and down parameters. If the sampling rates are integer-valued, we can figure this out from the gcd. However, the current API does not require integer sampling rates, and I’d like to keep that as flexible as possible. Perhaps we could only require int-valued rates for this particular mode, and throw a warning / exception if fractional rates are provided.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dpwecommented, May 17, 2017

FWIW, Matlab’s resample also requires integer ratios. I wrote code to find ratios to get arbitrarily close to a resample ratio expressed as a float (I was resampling audio by factors very close to 1 to get time alignment between simultaneous recordings with unsynchronized sample clocks). See the first block (calculating the up/down factors P and Q) in:

https://labrosa.ee.columbia.edu/projects/skewview/rewrite_aligned_audio.m.html

DAn.

On Wed, May 17, 2017 at 10:47 AM, Brian McFee notifications@github.com wrote:

Description

Scipy 0.18 added a polyphase resampler https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.signal.resample_poly.html. We could add support for this to core.resample, eg:

y_res = librosa.resample(y, sr_old, sr_new, res_type=‘polyphase’)

Potential complications

  1. This would up the version requirement for scipy from 0.13 to 0.18. We could potentially make this soft.
  2. We’d probably need to expose some new parameters for specifying the window.
  3. We’d need a good way to determine the up and down parameters. If the sampling rates are integer-valued, we can figure this out from the gcd. However, the current API does not require integer sampling rates, and I’d like to keep that as flexible as possible. Perhaps we could only require int-valued rates for this particular mode, and throw a warning / exception if fractional rates are provided.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/librosa/librosa/issues/576, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhs0TKP0FF-np7ChSvP741388LK0xwKks5r6wiEgaJpZM4Nd-eq .

0reactions
bmcfeecommented, Mar 29, 2019

note: i wound up adding this in #859 primarily to give folks the option of having fast resampling in (i)cqt if they want it.n I opted to only implement integer rates, which are automatically reduced by GCD to minimize overhead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scipy.signal.resample_poly — SciPy v1.9.3 Manual
Resample x along the given axis using polyphase filtering. The signal x is upsampled by the factor up, a zero-phase low-pass FIR filter...
Read more >
Computational Complexity of Polyphase Resampling
I am trying to find a good argument to prefer a polyphase resampling of Scipy over the FFT resampling method. In its documentation...
Read more >
Polyphase Filters and Filterbanks - Kyle - DSPRelated.com
This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using ...
Read more >
Polyphase Resampling Functions - Intel
suffix are intended for fixed rational resampling factor and can provide faster speed. Functions without the suffix build universal resampling filter with ...
Read more >
Resample uniform or nonuniform data to new fixed rate
y = resample( x , tx , fs ) uses a polyphase antialiasing filter to resample the signal at the uniform sample rate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found