-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode_echo.py
More file actions
31 lines (25 loc) · 853 Bytes
/
code_echo.py
File metadata and controls
31 lines (25 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 6_effects/code_echo.py
# part of todbot circuitpython synthio tutorial
# 14 Apr 2025 - @todbot / Tod Kurt
import time, random
import synthio
import audiodelays
from synth_setup import mixer, synth, SAMPLE_RATE, CHANNEL_COUNT, knobA
echo1 = audiodelays.Echo(
mix = 0.5,
max_delay_ms = 300,
delay_ms = 300,
decay = 0.8,
sample_rate = SAMPLE_RATE, # note we need these, just like for audiomixer
channel_count = CHANNEL_COUNT,
)
mixer.voice[0].play(echo1) # plug effect into the mixer (unplugs synth)
echo1.play(synth) # and plug synth into effect
while True:
midi_note = random.randint(36,64) # knobA controls echo mix
echo1.mix = knobA.value/65535
print("playing %d mix: %.2f" % (midi_note,echo1.mix))
synth.press(midi_note)
time.sleep(0.1)
synth.release(midi_note)
time.sleep(1)