|
37 | 37 | #include "sam/reciter.h"
|
38 | 38 | #include "sam/sam.h"
|
39 | 39 |
|
| 40 | +// The default `mode` for say/pronounce/sing can be configured externally. |
| 41 | +// The allowed values are: |
| 42 | +// - 0 = traditional micro:bit v1, 15625Hz (not supported with USE_DEDICATED_AUDIO_CHANNEL) |
| 43 | +// - 1 = standard sampling fidelity, 19000Hz |
| 44 | +// - 2 = standard sampling fidelity, 19000Hz, with sample smoothing |
| 45 | +// - 3 = higher sampling fidelity, 38000Hz |
| 46 | +// - 4 = higher sampling fidelity, 38000Hz, with sample smoothing |
| 47 | +#ifndef MICROPY_PY_SPEECH_DEFAULT_MODE |
| 48 | +#define MICROPY_PY_SPEECH_DEFAULT_MODE (1) |
| 49 | +#endif |
| 50 | + |
40 | 51 | // If disabled, pipe speech through audio module output.
|
41 | 52 | // If enabled, use a dedicated audio mixer channer with a double buffer.
|
42 | 53 | #define USE_DEDICATED_AUDIO_CHANNEL (1)
|
@@ -386,7 +397,7 @@ STATIC mp_obj_t articulate(mp_obj_t phonemes, mp_uint_t n_args, const mp_obj_t *
|
386 | 397 | { MP_QSTR_mouth, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_MOUTH} },
|
387 | 398 | { MP_QSTR_throat, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_THROAT} },
|
388 | 399 | { MP_QSTR_debug, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
|
389 |
| - { MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, |
| 400 | + { MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = MICROPY_PY_SPEECH_DEFAULT_MODE} }, |
390 | 401 | { MP_QSTR_volume, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 4} },
|
391 | 402 | { MP_QSTR_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(µbit_pin_default_audio_obj)} },
|
392 | 403 | };
|
|
0 commit comments