Skip to content

play_tone function should not raise Value error on frequency of 0 #20

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

Closed
RufusVS opened this issue Sep 4, 2021 · 2 comments
Closed

Comments

@RufusVS
Copy link
Contributor

RufusVS commented Sep 4, 2021

Currently in the library, if a zero frequency is specified to play_tone, a ValueError is thrown. In most other similar implementations, a value of 0 simply represents silence, or rest, for the duration specified. There is no reason for this implementation to be different. Also, this change is not likely to affect any user's existing code.

Current Code:

def play_tone(frequency, duration):
        """..."""
        if frequency <= 0:
            raise ValueError("The frequency has to be greater than 0.")

Suggested change:

def play_tone(frequency, duration):
        """..."""
        if frequency < 0:
            raise ValueError("Negative frequencies are not allowed.")
@tekktrik
Copy link
Member

I believe this issue should be closed now that PR #21 is merged!

@FoamyGuy
Copy link
Contributor

Thank you @tekktrik

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

3 participants