Skip to content

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

Closed
@RufusVS

Description

@RufusVS

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.")

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions