|
45 | 45 | //| |
46 | 46 | //| Create a PDMIn object associated with the given pins. This allows you to |
47 | 47 | //| 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. |
49 | 51 | //| |
50 | 52 | //| :param ~microcontroller.Pin clock_pin: The pin to output the clock to |
51 | 53 | //| :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 |
53 | 55 | //| :param int bit_depth: Final number of bits per sample. Must be divisible by 8 |
54 | 56 | //| :param bool mono: True when capturing a single channel of audio, captures two channels otherwise |
55 | 57 | //| :param int oversample: Number of single bit samples to decimate into a final sample. Must be divisible by 8 |
|
61 | 63 | //| |
62 | 64 | //| # Prep a buffer to record into |
63 | 65 | //| 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: |
65 | 67 | //| mic.record(b, len(b)) |
66 | 68 | //| |
67 | 69 | //| Record 16-bit unsigned samples to buffer:: |
|
75 | 77 | //| b = array.array("H") |
76 | 78 | //| for i in range(200): |
77 | 79 | //| 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: |
79 | 81 | //| mic.record(b, len(b)) |
80 | 82 | //| |
81 | 83 | 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