The object setup in the code is the same as above.
For Feather M0 Express, ItsyBitsy M0 Express and Metro M0 Express, no changes are needed for the code to work.
For Feather M4 Express, comment out
audio = audiobusio.I2SOut(board.D1, board.D0, board.D9)
and uncomment
# audio =
audiobusio.I2SOut(board.D1, board.D10, board.D11)
.
For Metro M4 Express, comment out
audio = audiobusio.I2SOut(board.D1, board.D0, board.D9)
and uncomment
# audio =
audiobusio.I2SOut(board.D3, board.D3, board.D8)
.
Now you'll hear the wave file play through and loop. Remember, listen for it without headphones on your ears first as
the volume is quite high.
There's plenty you can do with this example. Try playing a different wave file, or, instead of including
while audio.playing:
pass
, include a
time.sleep()
to have it play for a specified number of seconds. Check out the
Audio Out page in the
CircuitPython Essentials guide
(https://adafru.it/BRj)
for
pause
and
resume
features.
Where's my I2S?
We mentioned earlier that the supported M0 boards have multiple I2S pin combinations available to you. The M4
boards have one option. Either way, if you'd like to know what options are available to you, copy the following code
into your code.py, connect to the serial console, and check out the output.
These are the results from the ItsyBitsy M0 Express.
import audioio
import board
import audiobusio
wave_file = open("StreetChicken.wav", "rb")
wave = audioio.WaveFile(wave_file)
# For Feather M0 Express, ItsyBitsy M0 Express, Metro M0 Express
audio = audiobusio.I2SOut(board.D1, board.D0, board.D9)
# For Feather M4 Express
# audio = audiobusio.I2SOut(board.D1, board.D10, board.D11)
# For Metro M4 Express
# audio = audiobusio.I2SOut(board.D3, board.D9, board.D8)
while True:
audio.play(wave)
while audio.playing:
pass
For more information about I2SOut, check out https://circuitpython.readthedocs.io/en/latest/shared-
bindings/audiobusio/I2SOut.html
© Adafruit Industries
https://learn.adafruit.com/adafruit-i2s-stereo-decoder-uda1334a
Page 43 of 45
Содержание UDA1334A
Страница 1: ...Adafruit I2S Stereo Decoder UDA1334A Created by lady ada Last updated on 2019 01 30 06 56 56 PM UTC...
Страница 3: ...Adafruit Industries https learn adafruit com adafruit i2s stereo decoder uda1334a Page 3 of 45...
Страница 12: ...Adafruit Industries https learn adafruit com adafruit i2s stereo decoder uda1334a Page 12 of 45...