Skip to content

Commit 422a4df

Browse files
Update docs to sync with changes in commit:
bbcmicrobit/micropython@b129d16 - Update recording default rate from 11k to 7812 - Update AudioTrack doc to mention out-of-range values
1 parent 91eb337 commit 422a4df

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lang/en/typeshed/stdlib/microbit/audio.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class AudioRecording:
169169
def __init__(
170170
self,
171171
duration: int = -1,
172-
rate: int = 11_000
172+
rate: int = 7_812
173173
):
174174
"""Create a new ``AudioRecording``.
175175
@@ -190,6 +190,8 @@ class AudioRecording:
190190
def track(self, start_ms: int = 0, end_ms: int = -1) -> AudioTrack:
191191
"""Create an ``AudioTrack`` instance from a portion of the data in this ``AudioRecording`` instance.
192192
193+
Out-of-range values will be truncated to the recording limits. If ``end_ms`` is lower than ``start_ms``, an empty track will be created.
194+
193195
Example: ``first_second = my_recording.track(0, 1000)``
194196
195197
:param start_ms: (default=0) Where to start of the track in milliseconds.
@@ -212,7 +214,7 @@ class AudioTrack:
212214
213215
When the input buffer has an associated rate (e.g. an ``AudioRecording``
214216
or ``AudioTrack``), the rate is copied. If the buffer object does not have
215-
a rate, the default value of 11_000 is used.
217+
a rate, the default value of 7_812 is used.
216218
217219
Example: ``my_track = AudioTrack(bytearray(4096))``
218220

lang/en/typeshed/stdlib/microbit/microphone.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def sound_level_db() -> int:
8888
"""
8989
...
9090

91-
def record(duration: int, rate: int = 11_000) -> AudioRecording:
91+
def record(duration: int, rate: int = 7_812) -> AudioRecording:
9292
"""Record sound into an ``AudioRecording`` for the amount of time indicated by
9393
``duration`` at the sampling rate indicated by ``rate``.
9494

0 commit comments

Comments
 (0)