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

Add warning for non-integer resampling frequencies #1490

Merged
merged 3 commits into from May 11, 2021

Conversation

carolineechen
Copy link
Contributor

Add warning and suggestion when the frequency inputs to the resample function are not integer values

cc #1487

"so please manually convert frequencies to integer values that maintain the ratio"
"prior to passing them into the function"
"Example: To downsample a 44100 hz waveform by a factor of 8, you can use"
"`orig_freq=8` and `new_freq=1` instead of `orig_freq=44100` and `new_freq=5512.5`"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can go farther and say it will raise an error in the future.
@cpuhrsch what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine if we throw an exception in the next release, but I'd create a pre-emptive issue for this and link it here so that users can chime in whether they want this or not. The overall topic seems to be "non-integral sampling rates", so maybe we can link to an umbrella issue like that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@carolineechen

Can you plan the future changes and make a note in #1487, then mention that in the message ?

test/torchaudio_unittest/functional/functional_impl.py Outdated Show resolved Hide resolved
test/torchaudio_unittest/functional/functional_impl.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@mthrok mthrok left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@carolineechen carolineechen merged commit 4b2de71 into pytorch:master May 11, 2021
@carolineechen carolineechen deleted the float-resample-warning branch May 11, 2021 14:40
carolineechen pushed a commit to carolineechen/audio that referenced this pull request May 12, 2021
assert len(w) == 1


class FunctionalComplex(TestBaseMixin):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@carolineechen I think this was introduced by mistake.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Addressed in #1524

mthrok pushed a commit that referenced this pull request May 22, 2021
* Remove `class FunctionalComplex` header accidentally re-introduced in #1490
@carolineechen carolineechen mentioned this pull request Jun 1, 2021
6 tasks
mthrok pushed a commit to mthrok/audio that referenced this pull request Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants