Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resample type option added in pitch_shift() #863

Merged
merged 3 commits into from
Apr 18, 2019
Merged

resample type option added in pitch_shift() #863

merged 3 commits into from
Apr 18, 2019

Conversation

tae898
Copy link
Contributor

@tae898 tae898 commented Apr 15, 2019

Reference Issue

What does this implement/fix? Explain your changes.

As for resampling, 'kaiser_best' can take twice as much time as 'kaiser_fast'. This can be a bottle neck in some applications where a lot of resampling calls are made. It'd be nice if this is made optional.

Any other comments?


This change is Reviewable

@bmcfee bmcfee added the enhancement Does this improve existing functionality? label Apr 15, 2019
@bmcfee bmcfee added this to the 0.7.0 milestone Apr 15, 2019
@bmcfee bmcfee self-requested a review April 15, 2019 18:01
@bmcfee
Copy link
Member

bmcfee commented Apr 15, 2019

Thanks @tae898 for this! Changes so far seem good, though I think it should also be applied to time_stretch for consistency of API. Also, we should preserve the current default behavior (kaiser_best) so that there are no surprises going forward, and give a documentation example for how to do it quickly. Can you take care of those requests?

There's also a bit of overlap (in scope) with (WIP) pr #857, where res_type modes have been expanded. I suspect this one will merge before #857, so I'm happy to smooth over the differences over there.

@@ -287,13 +290,15 @@ def pitch_shift(y, sr, n_steps, bins_per_octave=12):
... bins_per_octave=24)
'''

if bins_per_octave < 1 or not np.issubdtype(type(bins_per_octave), np.integer):
if bins_per_octave < 1 or not np.issubdtype(type(bins_per_octave),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why git diff picks up these two lines? did anything change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like OP's text editor automatically wrapped a line here. NBD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why git diff picks up these two lines? did anything change?

Oh yeah cuz I made a new line before np.integer to comply with the "80 char per line limit"

@tae898
Copy link
Contributor Author

tae898 commented Apr 17, 2019

Thanks @tae898 for this! Changes so far seem good, though I think it should also be applied to time_stretch for consistency of API. Also, we should preserve the current default behavior (kaiser_best) so that there are no surprises going forward, and give a documentation example for how to do it quickly. Can you take care of those requests?

There's also a bit of overlap (in scope) with (WIP) pr #857, where res_type modes have been expanded. I suspect this one will merge before #857, so I'm happy to smooth over the differences over there.

Thanks for the feedback. Btw, what do you mean by that it should also be applied to 'time_stretch"? time_stretch() doesn't call core.resample, but only pitch_shift() does. So I don't think I can add, or there is no need to add, an optional 'res_type' argument to it?

@bmcfee
Copy link
Member

bmcfee commented Apr 17, 2019

Thanks for the feedback. Btw, what do you mean by that it should also be applied to 'time_stretch"? time_stretch() doesn't call core.resample, but only pitch_shift() does.

sorry, you're completely correct! (I was thinking of a similar pair of functions in a separate project.)

Copy link
Member

@bmcfee bmcfee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great, except the comment below. Once that's resolved, I'm happy to merge. Thanks again!

librosa/effects.py Outdated Show resolved Hide resolved
Copy link
Member

@bmcfee bmcfee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lostanlen)

Copy link
Member

@bmcfee bmcfee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dismissed @lostanlen from a discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @bmcfee)

Copy link
Member

@bmcfee bmcfee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@bmcfee
Copy link
Member

bmcfee commented Apr 18, 2019

LGTM, thanks again for implementing this! :shipit:

@bmcfee bmcfee merged commit 6df3316 into librosa:master Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Does this improve existing functionality?
Development

Successfully merging this pull request may close these issues.

None yet

3 participants