File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
lang/en/typeshed/stdlib/microbit Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,18 @@ def set_threshold(event: SoundEvent, value: int) -> None:
54
54
55
55
Example: ``microphone.set_threshold(SoundEvent.LOUD, 250)``
56
56
57
- A high threshold means the event will only trigger if the sound is very loud (>= 250 in the example).
57
+ The ``SoundEvent.LOUD`` event will be triggered when the sound level
58
+ crosses this threshold upwards (from "quiet" to "loud"),
59
+ and ``SoundEvent.QUIET`` event is triggered when crossing the threshold
60
+ downwards (from "loud" to "quiet").
61
+
62
+ If the ``SoundEvent.LOUD`` value set is lower than ``SoundEvent.QUIET``,
63
+ then "quiet" threshold will be decreased to one unit below the "loud"
64
+ threshold. If the ``SoundEvent.QUIET`` value is set higher than
65
+ ``SoundEvent.LOUD``, then the "loud" threshold will be set one unit above.
58
66
59
67
:param event: A sound event, such as ``SoundEvent.LOUD`` or ``SoundEvent.QUIET``.
60
- :param value: The threshold level in the range 0-255.
68
+ :param value: The threshold level in the range 0-255. Values outside this range will be clamped.
61
69
"""
62
70
...
63
71
You can’t perform that action at this time.
0 commit comments