diff --git a/doc/api/hubs_ev3brick.inc b/doc/api/hubs_ev3brick.inc index 376e769..61d942f 100644 --- a/doc/api/hubs_ev3brick.inc +++ b/doc/api/hubs_ev3brick.inc @@ -53,42 +53,34 @@ .. rubric:: Using the speaker + .. automethod:: pybricks._instances.speaker.volume + .. automethod:: pybricks._instances.speaker.beep Example:: # Initialize EV3 at the top of your script - brick = EV3Brick() + ev3 = EV3Brick() # A simple beep - brick.speaker.beep() + ev3.speaker.beep() - # A high pitch (1500 Hz) for one second (1000 ms) at 50% volume - brick.speaker.beep(1500, 1000, 50) + # A high pitch (1500 Hz) for one second (1000 ms) + ev3.speaker.beep(1500, 1000) - .. automethod:: pybricks._instances.speaker.beeps + .. automethod:: pybricks._instances.speaker.play Example:: # Initialize EV3 at the top of your script - brick = EV3Brick() - - # Make 5 simple beeps - brick.speaker.beeps(5) - - .. automethod:: pybricks._instances.speaker.file - - Example:: - - # Initialize EV3 at the top of your script - brick = EV3Brick() + ev3 = EV3Brick() # Play one of the built-in sounds - brick.speaker.file(SoundFile.HELLO) + ev3.speaker.play(SoundFile.HELLO) # Play a sound file from your project folder - brick.speaker.file('mysound.wav') + ev3.speaker.play('mysound.wav') .. rubric:: Using the screen diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 7615e73..a142b85 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -359,35 +359,31 @@ class Display(): class Speaker(): - """Play beeps and sound files using a speaker.""" + """Play beeps and sounds using a speaker.""" - def beep(self, frequency=500, duration=100, volume=30): + def volume(self, volume): + """Set the speaker volume. + + Arguments: + volume (:ref:`percentage`): Volume of the speaker. + """ + pass + + def beep(self, frequency=500, duration=100): """Play a beep/tone. Arguments: frequency (:ref:`frequency`): Frequency of the beep (*Default*: 500). duration (:ref:`time`): Duration of the beep (*Default*: 100). - volume (:ref:`percentage`): Volume of the beep (*Default*: 30). """ pass - def beeps(self, number): - """Play a number of default beeps with a brief pause in between. - - Arguments: - number (int): Number of beeps. - - """ - pass - - def file(self, file_name, volume=100): + def play(self, file_name): """Play a sound file. Arguments: file_name (str): Path to the sound file, including extension. - volume (:ref:`percentage`): Volume of the sound (*Default*: 100). - """ pass