Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
doing the blink1

Tod Kurt todbot

💭
doing the blink1
View GitHub Profile
@todbot
todbot / synthio_rude_noises0.py
Last active May 24, 2023 00:45
rude noises using synthio in CircuitPython
View synthio_rude_noises0.py
# synthio_rude_noises0.py -- rude noises using synthio
# 23 May 2023 - @todot / Tod Kurt
import board
import audiobusio, audiomixer, synthio
import ulab.numpy as np
SAMPLE_RATE = 28000 # clicks @ 36kHz & 48kHz on rp2040
SAMPLE_SIZE = 512
SAMPLE_VOLUME = 32000 # 0-32767 I think
@todbot
todbot / dual_i2s_player.py
Last active May 20, 2023 05:50
Demonstrate using two I2S stereo DACs at once on RP2040 / Raspberry Pi Pico in CircuitPython
View dual_i2s_player.py
# dual_i2s_player.py -- demonstrate using two I2S stereo DACs at once on RP2040 / Raspberry Pi Pico
# 19 May 2023 - @todbot / Tod Kurt
# video of this code: https://www.youtube.com/watch?v=CgqECxhqJEo
import time, board, audiocore, audiobusio
# qtpy rp2040 pins
# in this case, board.* names just match silkscreen, don't indicate functionality
lck1_pin, bck1_pin, dat1_pin = board.MISO, board.MOSI, board.SCK
lck2_pin, bck2_pin, dat2_pin = board.SCL, board.SDA, board.TX
@todbot
todbot / synthio_midi_synth.py
Last active May 25, 2023 06:58
pretty usable MIDI-controlled synth using synthio in CircuitPython
View synthio_midi_synth.py
# synthio_midi_synth.py - pretty usable MIDI-controlled synth using synthio in CircuitPython
# 11 May 2023 - @todbot / Tod Kurt
# Uses cheapie PCM5102 DAC on QTPY RP2040
# Video demo: https://www.youtube.com/watch?v=N-PbbWWDE6k
# Features:
# - midi velocity controls attack rate (gentle press = slow, hard press = fast)
# - notes have small random detune on all oscillators to reduce phase stacking
# - adjustable number of detuned oscillators per note 1-5 (midi controller 83)
# - five selectable waveforms: saw, squ, sin, noisy sin, noise (midi controller 82)
# - vibrato depth on mod wheel (midi controller 1)
@todbot
todbot / synthio_note_waveform_demo.py
Last active May 19, 2023 11:12
Show new synthio.Note API that allows different waveform per Note!
View synthio_note_waveform_demo.py
# synthio_note_waveform_demo.py --
# 10 May 2023 - @todbot / Tod Kurt
# Uses cheapie PCM5102 DAC on QTPY RP2040
import time,random
import board, analogio
import audiobusio, audiomixer
import synthio
import ulab.numpy as np
# qtpy rp2040 SPI pins
@todbot
todbot / synthio_note_vibrato_demo.py
Last active May 11, 2023 01:08
Show new synthio.Note API that has per-note envelope, waveform, vibrato, tremolo, and frequency
View synthio_note_vibrato_demo.py
# synthio_note_vibrato_demo.py --
# 10 May 2023 - @todbot / Tod Kurt
# Uses cheapie PCM5102 DAC on QTPY RP2040
import time,random
import board, analogio
import audiobusio, audiomixer
import synthio
import ulab.numpy as np
# qtpy rp2040 SPI pins
@todbot
todbot / synthio_algosong1.py
Last active May 25, 2023 07:00
A little algorithmic song made with CircuitPython's upcoming synthio ability
View synthio_algosong1.py
# synthio_algosong1.py -- A little algorithmic song made with CircuitPython's upcoming synthio ability
# 7 May 2023 - @todbot / Tod Kurt
# Uses a cheapie PCM5102 I2S DAC on a QTPY RP2040
import time,random
import board, analogio
import audiobusio, audiomixer
import synthio
import ulab.numpy as np
# qtpy rp2040 SPI pins
@todbot
todbot / synthio_lfo_test.py
Last active May 6, 2023 01:59
trying out a simple LFO for synthio but my setup is currently output garbage
View synthio_lfo_test.py
import time
import board, analogio
import audiobusio, audiomixer
import synthio
import ulab.numpy as np
# qtpy rp2040 SPI pins
lck_pin, bck_pin, dat_pin = board.MISO, board.MOSI, board.SCK
class LFO():
@todbot
todbot / midi_env_synthio_synth.py
Last active May 3, 2023 20:01
Demonstrate cool new CircuitPython synthio.Synthesizer as wavetable MIDI synth, using new synthio.Envelope feature
View midi_env_synthio_synth.py
#
# midi_env_synthio_synth.py -- Demonstrate new synthio.Synthesizer as wavetable MIDI synth
# using new synthio.Envelope feature in https://github.com/adafruit/circuitpython/pull/7862
#
# 30 Apr 2023 - @todbot / Tod Kurt
#
# Hooked up to generic I2S DAC
# - MIDI key velocity controls attack & release times
# - MIDI modwheel (CC1) controls wave mix between saw and a granular AKWF wave
#
@todbot
todbot / picodvi_test.py
Created April 27, 2023 00:09
picodvi test in CircuitPython
View picodvi_test.py
# picodvi_test.py -- picodvi test on Feather RP2040
# 26 Apr 2023 - @todbot / Tod Kurt
# demo at: https://www.youtube.com/live/Gcw8rOYaO8U?feature=share&t=893
import time, random
import board, displayio, vectorio
display = board.DISPLAY
print("display width, height:", display.width, display.height)
@todbot
todbot / space_dvi_seesaw_test.py
Created April 27, 2023 00:07
test out picodvi + seesaw in CircuitPython
View space_dvi_seesaw_test.py
# space_dvi_seesaw_test.py -- test out picodvi + seesaw in CircuitPython
# 26 Apr 2023 - @todbot / Tod Kurt
# demo at https://www.youtube.com/live/Gcw8rOYaO8U?feature=share&t=916
import time, random, math
import board, displayio, vectorio
import terminalio
from adafruit_display_text import bitmap_label as label
from adafruit_seesaw.seesaw import Seesaw
ss = Seesaw(board.I2C())