@@ -20,7 +20,7 @@ There are three different kinds of audio sources that can be played using the
20202. `Sound Effects <#sound-effects-v2 >`_ (**V2 **), a way to create custom sounds
2121 by configuring its parameters::
2222
23- my_effect = audio.Effect (freq_start=400, freq_end=2500, duration=500)
23+ my_effect = audio.SoundEffect (freq_start=400, freq_end=2500, duration=500)
2424 audio.play(my_effect)
2525
26263. `Audio Frames <##audioframe >`_, an iterable (like a list or a generator)
@@ -45,8 +45,8 @@ Functions
4545 - ``Sound ``: The ``microbit `` module contains a list of
4646 built-in sounds, e.g. ``audio.play(Sound.TWINKLE) ``. A full list can
4747 be found in the `Built in sounds <#built-in-sounds-v2 >`_ section.
48- - ``Effect ``: A sound effect, or an iterable of sound effects, created
49- via the :py:meth: `audio.Effect ` class
48+ - ``SoundEffect ``: A sound effect, or an iterable of sound effects,
49+ created via the :py:meth: `audio.SoundEffect ` class
5050 - ``AudioFrame ``: An iterable of ``AudioFrame `` instances as described
5151 in the `AudioFrame Technical Details <#id2 >`_ section
5252
@@ -114,17 +114,17 @@ Sound Effects **V2**
114114====================
115115
116116.. py :class ::
117- Effect (preset=None, freq_start=400, freq_end=200, duration=500, vol_start=100, vol_end=255, wave=WAVE_SQUARE, fx=None, interpolation=INTER_LINEAR)
117+ SoundEffect (preset=None, freq_start=400, freq_end=200, duration=500, vol_start=100, vol_end=255, wave=WAVE_SQUARE, fx=None, interpolation=INTER_LINEAR)
118118
119- An ``Effect `` instance represents a sound effect, composed by a set of
119+ An ``SoundEffect `` instance represents a sound effect, composed by a set of
120120 parameters configured via the constructor or attributes.
121121
122122 All the parameters are optional, with default values as shown above, and
123123 they can all be modified via attributes of the same name. For example, we
124- can first create an effect ``my_effect = Effect (duration=1000) ``, and then
125- change its attributes ``my_effect.duration = 500 ``.
124+ can first create an effect ``my_effect = SoundEffect (duration=1000) ``,
125+ and then change its attributes ``my_effect.duration = 500 ``.
126126
127- :param preset: An existing Effect instance to use as a base, its values
127+ :param preset: An existing SoundEffect instance to use as a base, its values
128128 are cloned in the new instance, and any additional arguments provided
129129 overwrite the base values.
130130 :param freq_start: Start Frequency in Hertz (Hz), eg: ``400 ``
@@ -180,44 +180,45 @@ Sound Effects **V2**
180180 in frequency. One of the following values: ``INTER_LINEAR ``,
181181 ``INTER_CURVE ``, ``INTER_LOG ``.
182182
183- The arguments used to create any Sound Effect, including the built in effects ,
184- can be inspected by looking at each of the Effect instance attributes, or by
185- converting the instance into a string (which can be done via ``str() ``
183+ The arguments used to create any Sound Effect, including the built in ones ,
184+ can be inspected by looking at each of the SoundEffect instance attributes,
185+ or by converting the instance into a string (which can be done via ``str() ``
186186function, or by using a function that does the conversion automatically like
187187``print() ``).
188188
189189For example, with the :doc: `REPL </devguide/repl >` you can inspect the built
190190in Effects::
191191
192- >>> audio.Effect .CROAK
193- Effect (freq_start=..., freq_end=..., duration=..., vol_start=..., vol_end=..., wave=..., fx=..., interpolation=...)
192+ >>> audio.SoundEffect .CROAK
193+ SoundEffect (freq_start=..., freq_end=..., duration=..., vol_start=..., vol_end=..., wave=..., fx=..., interpolation=...)
194194
195195The built in Effects are immutable, so they cannot be changed. Trying to modify
196- a built in Effect will throw an exception::
196+ a built in SoundEffect will throw an exception::
197197
198- >>> audio.Effect .CLICK.duration = 1000
198+ >>> audio.SoundEffect .CLICK.duration = 1000
199199 Traceback (most recent call last):
200200 File "<stdin>", line 1, in <module>
201201 TypeError: effect cannot be modified
202202
203203But a new one can be created like this::
204204
205- >>> click_clone = Effect (audio.Effect .CLICK)
205+ >>> click_clone = SoundEffect (audio.SoundEffect .CLICK)
206206 >>> click_clone.duration = 1000
207207 >>>
208208
209209Built in Sound Effects
210210----------------------
211211
212212Some pre-created Sound Effects are already available as examples. These can
213- be played directly ``audio.play(audio.Effect.SQUEAK) ``, or used as a base to
214- create new effects ``audio.Effect(audio.Effect.SQUEAK, duration=2000) ``.
213+ be played directly ``audio.play(audio.SoundEffect.SQUEAK) ``,
214+ or used as a base to create new effects
215+ ``audio.SoundEffect(audio.SoundEffect.SQUEAK, duration=2000) ``.
215216
216- * ``audio.Effect .SQUEAK ``
217- * ``audio.Effect .WARBLE ``
218- * ``audio.Effect .CHIRP ``
219- * ``audio.Effect .CROAK ``
220- * ``audio.Effect .CLICK ``
217+ * ``audio.SoundEffect .SQUEAK ``
218+ * ``audio.SoundEffect .WARBLE ``
219+ * ``audio.SoundEffect .CHIRP ``
220+ * ``audio.SoundEffect .CROAK ``
221+ * ``audio.SoundEffect .CLICK ``
221222
222223Sound Effects Example
223224---------------------
@@ -227,10 +228,10 @@ Sound Effects Example
227228 from microbit import *
228229
229230 # Play a built in Sound Effect
230- audio.play(audio.Effect .CHIRP)
231+ audio.play(audio.SoundEffect .CHIRP)
231232
232233 # Create a Sound Effect and immediately play it
233- audio.play(Effect (
234+ audio.play(audio.SoundEffect (
234235 freq_start=400,
235236 freq_end=2000,
236237 duration=500,
@@ -242,7 +243,7 @@ Sound Effects Example
242243 ))
243244
244245 # Play a Sound Effect instance, modify an attribute, and play it again
245- my_effect = Effect (
246+ my_effect = audio.SoundEffect (
246247 preset=audio.CHIRP
247248 freq_start=400,
248249 freq_end=2000,
@@ -253,8 +254,8 @@ Sound Effects Example
253254
254255 # You can also create a new effect based on an existing one, and modify
255256 # any of its characteristics via arguments
256- audio.play(audio.Effect .WARBLE)
257- my_modified_effect = Effect (audio.Effect .WARBLE, duration=1000)
257+ audio.play(audio.SoundEffect .WARBLE)
258+ my_modified_effect = SoundEffect (audio.SoundEffect .WARBLE, duration=1000)
258259 audio.play(my_modified_effect)
259260
260261 # Use sensor data to modify and play the existing Sound Effect instance
@@ -265,12 +266,12 @@ Sound Effects Example
265266
266267 if button_a.is_pressed():
267268 # On button A play an effect and once it's done show an image
268- audio.play(audio.Effect .CHIRP)
269+ audio.play(audio.SoundEffect .CHIRP)
269270 display.show(Image.DUCK)
270271 sleep(500)
271272 elif button_b.is_pressed():
272273 # On button B play an effect while showing an image
273- audio.play(audio.Effect .CLICK, wait=False)
274+ audio.play(audio.SoundEffect .CLICK, wait=False)
274275 display.show(Image.SQUARE)
275276 sleep(500)
276277
0 commit comments