Skip to content

Commit f80d6be

Browse files
committed
sync up synth_setup across examples
1 parent 3ca111b commit f80d6be

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

2_modulation/synth_setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import analogio
1111

1212
SAMPLE_RATE = 44100
13+
CHANNEL_COUNT = 2
1314
BUFFER_SIZE = 2048
1415

1516
# what we have plugged into the breadboard or pico_test_synth
@@ -24,10 +25,10 @@
2425
audio = audiobusio.I2SOut(bit_clock=i2s_bck_pin, word_select=i2s_lck_pin, data=i2s_dat_pin)
2526

2627
# add a mixer to give us a buffer
27-
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=2, buffer_size=BUFFER_SIZE)
28+
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT, buffer_size=BUFFER_SIZE)
2829

2930
# make the actual synthesizer
30-
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=2)
31+
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT)
3132

3233
# plug the mixer into the audio output
3334
audio.play(mixer)

3_filters/synth_setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import analogio
1111

1212
SAMPLE_RATE = 44100
13+
CHANNEL_COUNT = 2
1314
BUFFER_SIZE = 2048
1415

1516
# what we have plugged into the breadboard or pico_test_synth
@@ -24,10 +25,10 @@
2425
audio = audiobusio.I2SOut(bit_clock=i2s_bck_pin, word_select=i2s_lck_pin, data=i2s_dat_pin)
2526

2627
# add a mixer to give us a buffer
27-
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=2, buffer_size=BUFFER_SIZE)
28+
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT, buffer_size=BUFFER_SIZE)
2829

2930
# make the actual synthesizer
30-
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=2)
31+
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT)
3132

3233
# plug the mixer into the audio output
3334
audio.play(mixer)

4_oscillators_waveforms/synth_setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import analogio
1111

1212
SAMPLE_RATE = 44100
13+
CHANNEL_COUNT = 2
1314
BUFFER_SIZE = 2048
1415

1516
# what we have plugged into the breadboard or pico_test_synth
@@ -24,10 +25,10 @@
2425
audio = audiobusio.I2SOut(bit_clock=i2s_bck_pin, word_select=i2s_lck_pin, data=i2s_dat_pin)
2526

2627
# add a mixer to give us a buffer
27-
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=2, buffer_size=BUFFER_SIZE)
28+
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT, buffer_size=BUFFER_SIZE)
2829

2930
# make the actual synthesizer
30-
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=2)
31+
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT)
3132

3233
# plug the mixer into the audio output
3334
audio.play(mixer)

5_midi/synth_setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import analogio
1111

1212
SAMPLE_RATE = 44100
13+
CHANNEL_COUNT = 2
1314
BUFFER_SIZE = 2048
1415

1516
# what we have plugged into the breadboard or pico_test_synth
@@ -24,10 +25,10 @@
2425
audio = audiobusio.I2SOut(bit_clock=i2s_bck_pin, word_select=i2s_lck_pin, data=i2s_dat_pin)
2526

2627
# add a mixer to give us a buffer
27-
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=2, buffer_size=BUFFER_SIZE)
28+
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT, buffer_size=BUFFER_SIZE)
2829

2930
# make the actual synthesizer
30-
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=2)
31+
synth = synthio.Synthesizer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT)
3132

3233
# plug the mixer into the audio output
3334
audio.play(mixer)

0 commit comments

Comments
 (0)