Skip to content

Commit 1d6bf8e

Browse files
kattnitannewt
authored andcommitted
Updated frequency minimum requirements in docs and examples (adafruit#444)
Updated frequency minimum requirements in docs and examples
1 parent a9f75a7 commit 1d6bf8e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

shared-bindings/audiobusio/PDMIn.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545
//|
4646
//| Create a PDMIn object associated with the given pins. This allows you to
4747
//| record audio signals from the given pins. Individual ports may put further
48-
//| restrictions on the recording parameters.
48+
//| restrictions on the recording parameters. The overall frequency is
49+
//| determined by `frequency`x`oversample`, and the total must be 1MHz or
50+
//| higher, so `frequency` must be a minimum of 16000.
4951
//|
5052
//| :param ~microcontroller.Pin clock_pin: The pin to output the clock to
5153
//| :param ~microcontroller.Pin data_pin: The pin to read the data from
52-
//| :param int frequency: Target frequency of the resulting samples. Check `frequency` for real value.
54+
//| :param int frequency: Target frequency in Hz of the resulting samples. Check `frequency` for real value
5355
//| :param int bit_depth: Final number of bits per sample. Must be divisible by 8
5456
//| :param bool mono: True when capturing a single channel of audio, captures two channels otherwise
5557
//| :param int oversample: Number of single bit samples to decimate into a final sample. Must be divisible by 8
@@ -61,7 +63,7 @@
6163
//|
6264
//| # Prep a buffer to record into
6365
//| b = bytearray(200)
64-
//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA) as mic:
66+
//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000) as mic:
6567
//| mic.record(b, len(b))
6668
//|
6769
//| Record 16-bit unsigned samples to buffer::
@@ -75,7 +77,7 @@
7577
//| b = array.array("H")
7678
//| for i in range(200):
7779
//| b.append(0)
78-
//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, bit_depth=16) as mic:
80+
//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000, bit_depth=16) as mic:
7981
//| mic.record(b, len(b))
8082
//|
8183
STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {

0 commit comments

Comments
 (0)