Created
June 6, 2023 00:40
-
-
Save todbot/dc7890b90208aef2761e2c7858db773a to your computer and use it in GitHub Desktop.
trying out new synthio filter PR, knobs control frequency and resonance, in CircuitPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# synthio_filter_test.py -- trying out new filter PR, knobs control frequency and resonance | |
# 5 Jun 2023 - @todbot / Tod Kurt | |
import time, random, board, analogio, audiopwmio, synthio | |
audio = audiopwmio.PWMAudioOut(board.GP10) | |
synth = synthio.Synthesizer(sample_rate=22050) | |
audio.play(synth) | |
knob1 = analogio.AnalogIn(board.GP26) | |
knob2 = analogio.AnalogIn(board.GP27) | |
note1 = synthio.Note(frequency=110) | |
synth.press(note1) | |
while True: | |
lpf_f = 10 + knob1.value / 32 | |
lpf_q = knob2.value / 20000 | |
note1.filter = synth.low_pass_filter(lpf_f, lpf_q) | |
print(lpf_f, lpf_q) | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment