-
Notifications
You must be signed in to change notification settings - Fork 24
play_tone function should not raise Value error on frequency of 0 #67
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
Comments
@kattni What do you think the right way of doing rests is? |
|
Blocking vs. non-blocking is a wrinkle, but here's my original post on the subject: The gist being:
Is more intuitive and less clunky than:
(Also requiring the need to import time, which might not have been necessary) |
I agree that in this case it is simpler. However, I'm not sure that it's better in the case where frequency is the result of a computation that shouldn't return zero but does due to an error. Input validation can make it easier to find bugs. I'm not sure allowing zero frequency is better for all cases. |
Fixed via #68. |
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:
Suggested change:
The text was updated successfully, but these errors were encountered: