Skip to content

Commit 14860a7

Browse files
docs: Remove SoundEffect preset constructor parameter, and add copy() method.
1 parent c0a2909 commit 14860a7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

docs/audio.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Sound Effects **V2**
114114
====================
115115

116116
.. py:class::
117-
SoundEffect(preset=None, freq_start=500, freq_end=2500, duration=500, vol_start=255, vol_end=0, wave=WAVE_SQUARE, fx=None, interpolation=INTER_LOG)
117+
SoundEffect(freq_start=500, freq_end=2500, duration=500, vol_start=255, vol_end=0, wave=WAVE_SQUARE, fx=None, interpolation=INTER_LOG)
118118

119119
An ``SoundEffect`` instance represents a sound effect, composed by a set of
120120
parameters configured via the constructor or attributes.
@@ -124,9 +124,6 @@ Sound Effects **V2**
124124
can first create an effect ``my_effect = SoundEffect(duration=1000)``,
125125
and then change its attributes ``my_effect.duration = 500``.
126126

127-
:param preset: An existing SoundEffect instance to use as a base, its values
128-
are cloned in the new instance, and any additional arguments provided
129-
overwrite the base values.
130127
:param freq_start: Start Frequency in Hertz (Hz), eg: ``400``
131128
:param freq_end: End Frequency in Hertz (Hz), eg: ``2000``
132129
:param duration: Duration of the sound (ms), eg: ``500``
@@ -189,7 +186,7 @@ function, or by using a function that does the conversion automatically like
189186
For example, with the :doc:`REPL </devguide/repl>` you can inspect the built
190187
in Effects::
191188

192-
>>> audio.SoundEffect.CROAK
189+
>>> print(audio.SoundEffect.CROAK)
193190
SoundEffect(freq_start=..., freq_end=..., duration=..., vol_start=..., vol_end=..., wave=..., fx=..., interpolation=...)
194191

195192
The built in Effects are immutable, so they cannot be changed. Trying to modify
@@ -202,7 +199,7 @@ a built in SoundEffect will throw an exception::
202199

203200
But a new one can be created like this::
204201

205-
>>> click_clone = SoundEffect(audio.SoundEffect.CLICK)
202+
>>> click_clone = audio.SoundEffect.CLICK.copy()
206203
>>> click_clone.duration = 1000
207204
>>>
208205

@@ -213,8 +210,7 @@ Built in Sound Effects
213210

214211
Some pre-created Sound Effects are already available as examples. These can
215212
be played directly ``audio.play(audio.SoundEffect.SQUEAK)``,
216-
or used as a base to create new effects
217-
``audio.SoundEffect(audio.SoundEffect.SQUEAK, duration=2000)``.
213+
or they can be cloned as a base to create new effects.
218214

219215
* ``audio.SoundEffect.SQUEAK``
220216
* ``audio.SoundEffect.WARBLE``
@@ -257,7 +253,8 @@ Sound Effects Example
257253
# You can also create a new effect based on an existing one, and modify
258254
# any of its characteristics via arguments
259255
audio.play(audio.SoundEffect.WARBLE)
260-
my_modified_effect = SoundEffect(audio.SoundEffect.WARBLE, duration=1000)
256+
my_modified_effect = audio.SoundEffect.WARBLE.copy()
257+
my_modified_effect.duration=1000
261258
audio.play(my_modified_effect)
262259

263260
# Use sensor data to modify and play the existing Sound Effect instance

0 commit comments

Comments
 (0)