diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-10 18:21:02 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-15 19:52:38 -0700 |
| commit | 3f5028c666008f58785e86dd477065e3ca99d99f (patch) | |
| tree | 5b9ff5065012189e028499e15483610aaa36a4bb /shared-bindings/audioio | |
| parent | 292ba89ac2cf6b93828597e5c4baff4845432ee8 (diff) | |
atmel-samd: Support wav file playback. Tested up to 16bit 22.1khz. Must be mono file!
SD card support may work but likely needs buffer tuning. Its untested.
Fixes #105
Diffstat (limited to 'shared-bindings/audioio')
| -rw-r--r-- | shared-bindings/audioio/AudioOut.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 81117abb2..a765994d5 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -71,6 +71,26 @@ //| time.sleep(1) //| sample.stop() //| +//| Playing a wave file from flash:: +//| +//| import board +//| import audioio +//| import digitalio +//| +//| # Required for CircuitPlayground Express +//| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE) +//| speaker_enable.switch_to_output(value=True) +//| +//| f = open("cplay-5.1-16bit-16khz.wav", "rb") +// +//| a = audioio.AudioOut(board.A0, f) +//| +//| print("playing") +//| a.play() +//| while a.playing: +//| pass +//| print("stopped") +//| STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 2, 2, true); mp_obj_t pin_obj = args[0]; |
