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

No fast pitch-shift ratios could be computed for the given sample rate and transpose range. #151

Closed
Crazylov3 opened this issue Jul 2, 2022 · 13 comments

Comments

@Crazylov3
Copy link

I use PitchShift wih min=-0.9 and max = 1.1, then it raise No fast pitch-shift ratios could be computed for the given sample rate and transpose range.. I dont face with this error when use cpu version github. Do you have any plan to fix it?

@iver56
Copy link
Collaborator

iver56 commented Jul 2, 2022

Hey

Does it work if you use 0.9 instead of -0.9?

@iver56
Copy link
Collaborator

iver56 commented Jul 2, 2022

And what do you mean with cpu version github? Are you refering to https://github.com/iver56/audiomentations?

@iver56
Copy link
Collaborator

iver56 commented Jul 2, 2022

What's the sample rate?

@Crazylov3
Copy link
Author

Hey

Does it work if you use 0.9 instead of -0.9?

No, It doesn't

@Crazylov3
Copy link
Author

What's the sample rate?
it is 8000

@Crazylov3
Copy link
Author

And what do you mean with cpu version github? Are you refering to https://github.com/iver56/audiomentations?

Yep, that what i mean.

@iver56
Copy link
Collaborator

iver56 commented Jul 2, 2022

Oh, that is indeed a low sample rate. Maybe you can use audiomentations for now then, since it works there

@KentoNishi Have you tried torch-pitch-shift with sr=8000?

@Crazylov3
Copy link
Author

Torch-pitch-shift works fine, thank you!

@iver56
Copy link
Collaborator

iver56 commented Jul 2, 2022

Good :) torch-audiomentations actually depends on torch-pitch-shift, but uses its get_fast_shifts feature. So yeah, if you use torch-pitch-shift directly without get_fast_shifts, it'll probably work.

@KentoNishi
Copy link
Contributor

Good to hear that it works!

@AliKarimi95
Copy link

AliKarimi95 commented Aug 23, 2022

I have the same issue (version=0.11.0) with sample_rate = 16000 and (min, max)=(-0.2, 0,2). However, when the range changed to (-0.5, 0.5), the error didn't appear. In my case, the original dataset is piano sounds, so too much altering pitches can produce invalid data. Therefore, increasing the range is not a solution.
I have also tested torch_pith_shift. It works sometimes, but due to extensive memory consumption, the program crashed randomly for some shift values (for example, -0.16093115439744646).

Also, the running time dramatically increased after using PitchShift transform. In my laptop and using six other transformations, the average augmentation time per example (10s) is

setting average augmentation time per example (s)
without PitchShift 0.026
with PitchShift 0.232
with pitch_shift function of torch_pith_shift 3.951

@KentoNishi
Copy link
Contributor

Pitch shifts are generally pretty intensive operations so I'm not too surprised about the increase in execution time. Regarding speed issues with some pitch shift factors, unfortunately some factors aren't ideal for speed, so the rate of data transfer to the GPU becomes the bottleneck. In your specific case, it may be better to apply cpu-based pitch shift instead.

@iver56
Copy link
Collaborator

iver56 commented Aug 23, 2022

That's an interesting use case, AliKarimi95

Note: Although the pitch shift transform in torch-audiomentations can be comparatively fast on GPU, it is slow on CPU. When running pitch shift on CPU, the one in audiomentations is roughly 3x as fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants