Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 1cf58b57f5 |
1 changed files with 6 additions and 2 deletions
|
|
@ -51,6 +51,10 @@ import adafruit_lis3dh
|
||||||
import adafruit_thermistor
|
import adafruit_thermistor
|
||||||
import analogio
|
import analogio
|
||||||
import audioio
|
import audioio
|
||||||
|
try:
|
||||||
|
import audiocore
|
||||||
|
except ImportError:
|
||||||
|
audiocore = audioio
|
||||||
import board
|
import board
|
||||||
import busio
|
import busio
|
||||||
import digitalio
|
import digitalio
|
||||||
|
|
@ -575,7 +579,7 @@ class Express: # pylint: disable=too-many-public-methods
|
||||||
self._sine_wave = array.array("H", Express._sine_sample(length))
|
self._sine_wave = array.array("H", Express._sine_sample(length))
|
||||||
if sys.implementation.version[0] >= 3:
|
if sys.implementation.version[0] >= 3:
|
||||||
self._sample = audioio.AudioOut(board.SPEAKER)
|
self._sample = audioio.AudioOut(board.SPEAKER)
|
||||||
self._sine_wave_sample = audioio.RawSample(self._sine_wave)
|
self._sine_wave_sample = audiocore.RawSample(self._sine_wave)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Please use CircuitPython 3.0 or higher.")
|
raise NotImplementedError("Please use CircuitPython 3.0 or higher.")
|
||||||
|
|
||||||
|
|
@ -683,7 +687,7 @@ class Express: # pylint: disable=too-many-public-methods
|
||||||
self._speaker_enable.value = True
|
self._speaker_enable.value = True
|
||||||
if sys.implementation.version[0] >= 3:
|
if sys.implementation.version[0] >= 3:
|
||||||
with audioio.AudioOut(board.SPEAKER) as audio:
|
with audioio.AudioOut(board.SPEAKER) as audio:
|
||||||
wavefile = audioio.WaveFile(open(file_name, "rb"))
|
wavefile = audiocore.WaveFile(open(file_name, "rb"))
|
||||||
audio.play(wavefile)
|
audio.play(wavefile)
|
||||||
while audio.playing:
|
while audio.playing:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue