File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
adafruit_circuitplayground Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 51
51
import adafruit_thermistor
52
52
import analogio
53
53
import audioio
54
+ try :
55
+ import audiocore
56
+ except ImportError :
57
+ audiocore = audioio
54
58
import board
55
59
import busio
56
60
import digitalio
@@ -575,7 +579,7 @@ def _generate_sample(self, length=100):
575
579
self ._sine_wave = array .array ("H" , Express ._sine_sample (length ))
576
580
if sys .implementation .version [0 ] >= 3 :
577
581
self ._sample = audioio .AudioOut (board .SPEAKER )
578
- self ._sine_wave_sample = audioio .RawSample (self ._sine_wave )
582
+ self ._sine_wave_sample = audiocore .RawSample (self ._sine_wave )
579
583
else :
580
584
raise NotImplementedError ("Please use CircuitPython 3.0 or higher." )
581
585
@@ -683,7 +687,7 @@ def play_file(self, file_name):
683
687
self ._speaker_enable .value = True
684
688
if sys .implementation .version [0 ] >= 3 :
685
689
with audioio .AudioOut (board .SPEAKER ) as audio :
686
- wavefile = audioio .WaveFile (open (file_name , "rb" ))
690
+ wavefile = audiocore .WaveFile (open (file_name , "rb" ))
687
691
audio .play (wavefile )
688
692
while audio .playing :
689
693
pass
You can’t perform that action at this time.
0 commit comments