Skip to content

Instantly share code, notes, and snippets.

@todbot
Last active June 28, 2023 02:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todbot/53bfa7333ac7c1fcff8eaf0f547556ff to your computer and use it in GitHub Desktop.
Save todbot/53bfa7333ac7c1fcff8eaf0f547556ff to your computer and use it in GitHub Desktop.
Got a Pico and two pots? Now you got a drone synth. In CircuitPython of course
# synthio_two_knob_drone_synth.py -- Got a Pico and two pots? Now you got a drone synth
# 5 Jun 2023 - @todbot / Tod Kurt
# video demo: https://www.youtube.com/watch?v=KsSRaKjhmHg
import time, random, board, analogio, audiopwmio, synthio
knob1 = analogio.AnalogIn(board.GP26)
knob2 = analogio.AnalogIn(board.GP27)
audio = audiopwmio.PWMAudioOut(board.GP10)
synth = synthio.Synthesizer(sample_rate=22050)
audio.play(synth)
note1 = synthio.Note(frequency=100)
note2 = synthio.Note(frequency=200)
synth.press((note1,note2))
while True:
note1.frequency = synthio.midi_to_hz( knob1.value / 512 )
note2.frequency = synthio.midi_to_hz( knob2.value / 512 )
@RobCranfill
Copy link

RobCranfill commented Jun 28, 2023

Thank you! I kinda remembered seeing that somewhere in your stuff, so my apologies for not remembering where that was. But then I’ve gotten so much good info from your various projects… :-]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment