Skip to content

Commit a904c66

Browse files
authored
Merge branch 'master' into fix-cal-id-pyportal
2 parents 49b9b78 + 602ac4d commit a904c66

File tree

60 files changed

+154
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+154
-91
lines changed

ABC_Soundboards_for_NeoTrellis/code.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import time
44
import board
55
import audioio
6+
import audiocore
67
import adafruit_fancyled.adafruit_fancyled as fancy
78
import adafruit_trellism4
89

@@ -76,7 +77,7 @@
7677
with audioio.AudioOut(board.A1, right_channel=board.A0) as audio:
7778
try:
7879
f = open(SAMPLE_FOLDER+SAMPLES[27][0], "rb") # Use 02.wav as welcome
79-
wave = audioio.WaveFile(f)
80+
wave = audiocore.WaveFile(f)
8081
audio.play(wave)
8182
swirl = 0 # we'll swirl through the colors in the gradient
8283
while audio.playing:
@@ -99,7 +100,7 @@
99100
bits_per_sample = None
100101
sample_rate = None
101102
with open(SAMPLE_FOLDER+SAMPLES[0][0], "rb") as f:
102-
wav = audioio.WaveFile(f)
103+
wav = audiocore.WaveFile(f)
103104
print("%d channels, %d bits per sample, %d Hz sample rate " %
104105
(wav.channel_count, wav.bits_per_sample, wav.sample_rate))
105106

@@ -117,7 +118,7 @@
117118
filename = SAMPLE_FOLDER+v[0]
118119
try:
119120
with open(filename, "rb") as f:
120-
wav = audioio.WaveFile(f)
121+
wav = audiocore.WaveFile(f)
121122
print(filename,
122123
"%d channels, %d bits per sample, %d Hz sample rate " %
123124
(wav.channel_count, wav.bits_per_sample, wav.sample_rate))
@@ -162,7 +163,7 @@ def stop_playing_sample(playback_details):
162163
try:
163164
filename = SAMPLE_FOLDER+SAMPLES[sample_num][0]
164165
f = open(filename, "rb")
165-
wav = audioio.WaveFile(f)
166+
wav = audiocore.WaveFile(f)
166167

167168
# is something else playing? interrupt it!
168169
if currently_playing['voice'] != None:

Adafruit_Prop_Maker_FeatherWing/Prop_Maker_Audio_Simpletest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import digitalio
44
import board
55
import audioio
6+
import audiocore
67

78
WAV_FILE_NAME = "StreetChicken.wav" # Change to the name of your wav file!
89

@@ -12,7 +13,7 @@
1213

1314
with audioio.AudioOut(board.A0) as audio: # Speaker connector
1415
wave_file = open(WAV_FILE_NAME, "rb")
15-
wave = audioio.WaveFile(wave_file)
16+
wave = audiocore.WaveFile(wave_file)
1617

1718
audio.play(wave)
1819
while audio.playing:

Adafruit_UDA1334A/CircuitPython_I2S_Tone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
import array
33
import math
4-
import audioio
4+
import audiocore
55
import board
66
import audiobusio
77

@@ -18,7 +18,7 @@
1818
# audio = audiobusio.I2SOut(board.D1, board.D10, board.D11)
1919
# For Metro M4 Express
2020
# audio = audiobusio.I2SOut(board.D3, board.D9, board.D8)
21-
sine_wave_sample = audioio.RawSample(sine_wave)
21+
sine_wave_sample = audiocore.RawSample(sine_wave)
2222

2323
while True:
2424
audio.play(sine_wave_sample, loop=True)

Adafruit_UDA1334A/CircuitPython_I2S_Wave.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import audioio
1+
import audiocore
22
import board
33
import audiobusio
44

55
wave_file = open("StreetChicken.wav", "rb")
6-
wave = audioio.WaveFile(wave_file)
6+
wave = audiocore.WaveFile(wave_file)
77

88
# For Feather M0 Express, ItsyBitsy M0 Express, Metro M0 Express
99
audio = audiobusio.I2SOut(board.D1, board.D0, board.D9)

Animatronic_Hand/binary_counting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import time
44
from digitalio import DigitalInOut, Direction, Pull
55
import audioio
6+
import audiocore
67
import board
78
from adafruit_crickit import crickit
89

@@ -22,7 +23,7 @@
2223
cpx_audio = audioio.AudioOut(board.A0)
2324
def play_file(wavfile):
2425
with open(wavfile, "rb") as f:
25-
wav = audioio.WaveFile(f)
26+
wav = audiocore.WaveFile(f)
2627
cpx_audio.play(wav)
2728
while cpx_audio.playing:
2829
pass

CP101_StateMachines/brute-force/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import busio
2222
import adafruit_ds3231
2323
import audioio
24+
import audiocore
2425
import pulseio
2526
from adafruit_motor import servo
2627
import neopixel
@@ -227,7 +228,7 @@ def shower(time_now):
227228

228229
def start_playing(fname):
229230
sound_file = open(fname, 'rb')
230-
wav = audioio.WaveFile(sound_file)
231+
wav = audiocore.WaveFile(sound_file)
231232
audio.play(wav, loop=False)
232233

233234
def stop_playing():

CP101_StateMachines/classes/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import busio
2222
import adafruit_ds3231
2323
import audioio
24+
import audiocore
2425
import pulseio
2526
from adafruit_motor import servo
2627
import neopixel
@@ -191,7 +192,7 @@ def shower(machine, time_now):
191192

192193
def start_playing(fname):
193194
sound_file = open(fname, 'rb')
194-
wav = audioio.WaveFile(sound_file)
195+
wav = audiocore.WaveFile(sound_file)
195196
audio.play(wav, loop=False)
196197

197198
def stop_playing():

CPX_DAC_Guide/scope_xy_adafruitlogo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import board
3636
import audioio
37+
import audiocore
3738
import analogio
3839

3940
### Vector data for logo
@@ -95,7 +96,7 @@ def addpoints(points, min_dist):
9596
### 32768 and 32000 exhibit this bug but 25000 so far appears to be a
9697
### workaround, albeit a mysterious one
9798
### https://github.com/adafruit/circuitpython/issues/1992
98-
### Using "h" for audioio.RawSample() DAC range will be 20268 to 45268
99+
### Using "h" for audiocore.RawSample() DAC range will be 20268 to 45268
99100
dac_x_min = 0
100101
dac_y_min = 0
101102
dac_x_max = 25000
@@ -129,7 +130,7 @@ def addpoints(points, min_dist):
129130

130131
### A0 will be x, A1 will be y
131132
if use_wav:
132-
print("Using audioio.RawSample for DACs")
133+
print("Using audiocore.RawSample for DACs")
133134
dacs = audioio.AudioOut(board.A0, right_channel=board.A1)
134135
else:
135136
print("Using analogio.AnalogOut for DACs")
@@ -166,7 +167,7 @@ def addpoints(points, min_dist):
166167
if use_wav:
167168
### 200k (maybe 166.667k) seems to be practical limit
168169
### 1M permissible but seems same as around 200k
169-
output_wave = audioio.RawSample(rawdata,
170+
output_wave = audiocore.RawSample(rawdata,
170171
channel_count=2,
171172
sample_rate=200 * 1000)
172173

CPX_Sound_Box/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import board
33
from digitalio import DigitalInOut, Direction, Pull
44
import audioio
5+
import audiocore
56
import neopixel
67

78
filename = "electrons.wav"
@@ -37,7 +38,7 @@ def simpleCircle(wait):
3738
def play_file(playname):
3839
print("Playing File " + playname)
3940
wave_file = open(playname, "rb")
40-
with audioio.WaveFile(wave_file) as wave:
41+
with audiocore.WaveFile(wave_file) as wave:
4142
with audioio.AudioOut(board.A0) as audio:
4243
audio.play(wave)
4344
while audio.playing:

Cat_Treat_Dispenser/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
22
import board
33
import audioio
4+
import audiocore
45
from adafruit_crickit import crickit
56

67
print("Cat Feeder")
@@ -10,7 +11,7 @@
1011
# audio output
1112
cpx_audio = audioio.AudioOut(board.A0)
1213
f = open("activate.wav", "rb")
13-
wav = audioio.WaveFile(f)
14+
wav = audiocore.WaveFile(f)
1415

1516
while True:
1617
if crickit.touch_1.value:

Christmas_Soundboard/code.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
22
import board
33
import audioio
4+
import audiocore
45
import adafruit_fancyled.adafruit_fancyled as fancy
56
import adafruit_trellism4
67
from color_names import * # pylint: disable=wildcard-import,unused-wildcard-import
@@ -56,7 +57,7 @@
5657
with audioio.AudioOut(board.A1, right_channel=board.A0) as audio:
5758
try:
5859
f = open("welcome.wav", "rb")
59-
wave = audioio.WaveFile(f)
60+
wave = audiocore.WaveFile(f)
6061
audio.play(wave)
6162
swirl = 0 # we'll swirl through the colors in the gradient
6263
while audio.playing:
@@ -81,7 +82,7 @@
8182
bits_per_sample = None
8283
sample_rate = None
8384
with open(SAMPLE_FOLDER+SAMPLES[0][0], "rb") as f:
84-
wav = audioio.WaveFile(f)
85+
wav = audiocore.WaveFile(f)
8586
print("%d channels, %d bits per sample, %d Hz sample rate " %
8687
(wav.channel_count, wav.bits_per_sample, wav.sample_rate))
8788

@@ -102,7 +103,7 @@
102103
filename = SAMPLE_FOLDER+v[0]
103104
try:
104105
with open(filename, "rb") as f:
105-
wav = audioio.WaveFile(f)
106+
wav = audiocore.WaveFile(f)
106107
print(filename,
107108
"%d channels, %d bits per sample, %d Hz sample rate " %
108109
(wav.channel_count, wav.bits_per_sample, wav.sample_rate))
@@ -147,7 +148,7 @@ def stop_playing_sample(playback_details):
147148
try:
148149
filename = SAMPLE_FOLDER+SAMPLES[sample_num][0]
149150
f = open(filename, "rb")
150-
wav = audioio.WaveFile(f)
151+
wav = audiocore.WaveFile(f)
151152

152153
# is something else playing? interrupt it!
153154
if currently_playing['voice'] != None:

CircuitPython_Star_Gazer/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@
6868
# music!
6969
if PLAY_SOUND_ON_CHANGE:
7070
import audioio
71+
import audiocore
7172
wave_file = open("coin.wav", "rb")
72-
wave = audioio.WaveFile(wave_file)
73+
wave = audiocore.WaveFile(wave_file)
7374

7475
# we'll save the value in question
7576
last_value = value = 0

CircuitPython_WeatherCloud/code.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import time
22
import random
33
import audioio
4+
import audiocore
45
import board
56
import busio
67
from digitalio import DigitalInOut
@@ -16,7 +17,7 @@
1617
button.switch_to_input(pull=digitalio.Pull.UP)
1718

1819
wave_file = open("sound/Rain.wav", "rb")
19-
wave = audioio.WaveFile(wave_file)
20+
wave = audiocore.WaveFile(wave_file)
2021
audio = audioio.AudioOut(board.A0)
2122

2223

@@ -130,17 +131,17 @@
130131
if weather_type == 'Sunny':
131132
palette = sunny_palette
132133
wave_file = open("sound/Clear.wav", "rb")
133-
wave = audioio.WaveFile(wave_file)
134+
wave = audiocore.WaveFile(wave_file)
134135
has_sound = True
135136
if weather_type == 'Clouds':
136137
palette = cloudy_palette
137138
wave_file = open("sound/Clouds.wav", "rb")
138-
wave = audioio.WaveFile(wave_file)
139+
wave = audiocore.WaveFile(wave_file)
139140
has_sound = True
140141
if weather_type == 'Rain':
141142
palette = cloudy_palette
142143
wave_file = open("sound/Rain.wav", "rb")
143-
wave = audioio.WaveFile(wave_file)
144+
wave = audiocore.WaveFile(wave_file)
144145
raining = True
145146
has_sound = True
146147
if weather_type == 'Thunderstorm':
@@ -152,7 +153,7 @@
152153
if weather_type == 'Snow':
153154
palette = cloudy_palette
154155
wave_file = open("sound/Snow.wav", "rb")
155-
wave = audioio.WaveFile(wave_file)
156+
wave = audiocore.WaveFile(wave_file)
156157
snowing = True
157158
has_sound = True
158159
weather_refresh = time.monotonic()
@@ -204,6 +205,6 @@
204205
wave_file = open("sound/Thunderstorm1.wav", "rb")
205206
elif Thunder == 2:
206207
wave_file = open("sound/Thunderstorm2.wav", "rb")
207-
wave = audioio.WaveFile(wave_file)
208+
wave = audiocore.WaveFile(wave_file)
208209
audio.play(wave)
209210
next_bolt_time = time.monotonic() + random.randint(5, 15) # between 5 and 15 s

Circuit_Playground_Express_Rocket_Lamp/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import neopixel
1515
import digitalio
1616
import audioio
17+
import audiocore
1718

1819
# enables the speaker for audio output
1920
spkrenable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
@@ -49,7 +50,7 @@ def play_audio():
4950
#open the file
5051
wave_file = open("liftoff.wav", "rb")
5152
#play the file
52-
with audioio.WaveFile(wave_file) as wave:
53+
with audiocore.WaveFile(wave_file) as wave:
5354
with audioio.AudioOut(board.A0) as audio:
5455
audio.play(wave)
5556
#wait until audio is done

Circuit_Playground_Express_USB_MIDI/cpx-basic-synth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import digitalio
3939
import audioio
40+
import audiocore
4041
import board
4142
import usb_midi
4243
import neopixel
@@ -90,7 +91,7 @@ def waveform_sawtooth(length, waves, volumes):
9091
* twopi
9192
+ math.pi))
9293
for idx in list(range(length))])
93-
waves.append((audioio.RawSample(waveraw), waveraw))
94+
waves.append((audiocore.RawSample(waveraw), waveraw))
9495

9596
# Make some square waves of different volumes volumes, generated with
9697
# n=10;[round(math.sqrt(x)/n*32767*n/math.sqrt(n)) for x in range(1, n+1)]

Crickit_Hello_World/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
import audioio
3+
import audiocore
34
import board
45
import neopixel
56
from adafruit_crickit import crickit
@@ -10,7 +11,7 @@
1011
# Start playing the file (in the background)
1112
def play_file(wavfile):
1213
audio_file = open(wavfile, "rb")
13-
wav = audioio.WaveFile(audio_file)
14+
wav = audiocore.WaveFile(audio_file)
1415
speaker.play(wav)
1516
while speaker.playing:
1617
pass

Crickit_Sparky_Automaton/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import random
44
import board
55
import audioio
6+
import audiocore
67
from adafruit_crickit import crickit
78

89
# Sparky automaton
@@ -31,7 +32,7 @@
3132
def play_file(wavfile):
3233
print("Playing", wavfile)
3334
with open(wavfile, "rb") as f:
34-
wav = audioio.WaveFile(f)
35+
wav = audiocore.WaveFile(f)
3536
a.play(wav)
3637
while a.playing: # turn servos, motors, etc. during playback
3738
mouth_servo.angle = MOUTH_END

0 commit comments

Comments
 (0)