Skip to content

Instantly share code, notes, and snippets.

View IrregularShed's full-sized avatar
🤦‍♂️
Remember the good old days, when we had a future?

Steve Anderson IrregularShed

🤦‍♂️
Remember the good old days, when we had a future?
View GitHub Profile
@todbot
todbot / wavetable_render_code.py
Last active February 11, 2024 18:35
Render wavetables for synthio to PyGamer display in CircuitPython
# wavetable_render_code.py - Render wavetables to PyGamer display
#
# 27 Aug 2023 - @todbot / Tod Kurt
#
# This code is currently a mess but it does function. :)
# video demo: https://www.youtube.com/watch?v=O9iZOytzOHg
#
# Needs wavetables in WAV format from http://waveeditonline.com/
# loaded in the "/wav" directory. Just download a few and stash them in "/wav"
#
@gamblor21
gamblor21 / drums.py
Created May 31, 2023 23:53
Drums for Circuitpython synthio
import ulab.numpy as np
import random
import synthio
SAMPLE_SIZE = 200
sinwave1 = np.array(np.sin(np.linspace(0, 2*np.pi, SAMPLE_SIZE, endpoint=False)) * 32767, dtype=np.int16)
sinwave2 = np.array(np.sin(np.linspace(np.pi/2, 2.5*np.pi, SAMPLE_SIZE, endpoint=False)) * 32767, dtype=np.int16)
downwave = np.linspace(32767, -32767, num=3, dtype=np.int16)
noisewave = np.array([random.randint(-32767, 32767) for i in range(SAMPLE_SIZE)], dtype=np.int16)
@todbot
todbot / synthio_midi_synth.py
Last active February 20, 2024 18:01
pretty usable MIDI-controlled synth using synthio in CircuitPython
# 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_algosong1.py
Last active July 18, 2023 13:54
A little algorithmic song made with CircuitPython's upcoming synthio ability
# 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 / wavetable_synthio_synth.py
Last active November 15, 2023 21:21
Demonstrate new synthio.Synthesizer as wavetable MIDI synth in CircuitPython
#
# wavetable_synthio_synth.py -- Demonstrate new synthio.Synthesizer as wavetable MIDI synth
# 15 Apr 2023 - @todbot / Tod Kurt
# video demo: https://www.youtube.com/watch?v=uUnS3nR2K-8
#
# Hooked up to generic I2S DAC
# Uses two pots:
# knobA - selects the base wave
# knobB - selects the mix between base wave and next wave
#
@sandyjmacdonald
sandyjmacdonald / code.py
Last active July 31, 2023 07:22
CircuitPython USB MIDI to serial MIDI converter for Raspberry Pi Pico (RP2040)
# CircuitPython USB MIDI to serial MIDI converter for Raspberry Pi Pico (RP2040).
# IMPORTANT! Should *only be used for MIDI in*, i.e. from USB devices to hardware
# MIDI synths, and *not* in the opposite direction. Doing so could risk damage to
# the microcontroller, your computer, or both.
# Wire a 10Ω resistor from the Tx pin on the Raspberry Pi Pico or other
# RP2040 board to the 3.5mm stereo jack tip, a 33Ω resistor from the 3v3 pin on
# the Raspberry Pi Pico to the 3.5mm stereo jack ring, and the ground pin on the
# Raspberry Pi Pico to the 3.5mm stereo jack sleeve.
@Gadgetoid
Gadgetoid / Makefile
Last active August 25, 2023 01:50
Pi 400 KB
CFLAGS_ALL=-I../libusbgx/build/include -I../bcm2835-1.68/build/include -L../bcm2835-1.68/build/lib -I../lua-5.4.0/src -L../libusbgx/build/lib -L../libserialport/build/lib -L../lua-5.4.0/src -lpng -lz -lpthread -llua -lm -lbcm2835 -ldl
pi400: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig -DPI400_USB
pi400: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
pi400test: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig
pi400test: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
@todbot
todbot / esp32s2-test.py
Last active December 29, 2023 07:00
CircuitPython WiFi example for ESP32-S2-WROOM Saola
# esp32s2-test.py -- small WiFi test program for ESP32-S2 CircuitPython 6
# taken from https://www.reddit.com/r/circuitpython/comments/ianpm8/using_wifi_when_running_on_esp32s2saola1_board/
#
import time
import ipaddress
import wifi
import socketpool
import ssl
import adafruit_requests
@Ircama
Ircama / LgMagicRemoteKeys.md
Last active April 28, 2024 23:48
Replacing Netflix and Amazon keys of the webOS LG TV LG Magic Remote with other apps

Replacing Netflix and Amazon keys of the webOS LG TV LG Magic Remote with other apps

This procedure allows substituting one or both Netflix and Amazon keys of the Magic Remote Control Unit with other apps or TV control menus of the webOS LG TV.

Netflix and Amazon keys can be found just over the Red-Green-Yellow-Blue color buttons of such remote.

Assumption for this procedure is that you accept to uninstall the apps related to the keys to be substituted. Example: if you want to replace the Netflix key, you need to uninstall Netflix (possibly, you are not using Netflix if you do not need such key).

To uninstall Netflix or Amazon Prime, press the Home key of the Magic Remote, select the "LG Content Store" app, press "APP" at the top of the screen, press "My Apps", press the "Rem

@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages