Skip to content

Instantly share code, notes, and snippets.

View dcooperdalrymple's full-sized avatar

Cooper Dalrymple dcooperdalrymple

View GitHub Profile
"""
Hardware
========
Input
-----
Connect input jack sleeve to ground and tip to LIN1.
For a clearer signal, use a single-ended op-amp buffer (ie: TL072) before LIN1 to fix impedence issues.
If you plug the signal directly into LIN1, but you will lose a lot of the top end.
import board
import analogbufio
import array
import audiobusio
import audiocore
import audiodelays
import audiomixer
import digitalio
import time
@dcooperdalrymple
dcooperdalrymple / analogbufio_loopback.py
Last active October 24, 2024 16:17
CircuitPython Audio Input/Output Loopback
import board
import analogbufio
import array
import audiobusio
import audiocore
import digitalio
import time
BUFFER_SIZE = 1024 # Lower buffer size = lower latency, but too low can cause digital artifacts
SAMPLE_RATE = 48000
@dcooperdalrymple
dcooperdalrymple / code.py
Created November 20, 2023 21:29
Example of Basic MIDI Sampler using CircuitPython's synthio
# CircuitPython synthio Sampling Example
# 2023 Cooper Dalrymple - me@dcdalrymple.com
import time
import board
import audiomixer, synthio
import math
import ulab, ulab.numpy as numpy
import adafruit_wave
@dcooperdalrymple
dcooperdalrymple / ring_waveform_loop-test.py
Created November 20, 2023 15:38
Demonstration of CircuitPython synthio.Note Experimental Ring Loop Parameters
# synthio.Note ring_waveform_loop_start & ring_waveform_loop_end Test
# 2023 Cooper Dalrymple - me@dcdalrymple.com
import time
import board
import audiomixer
import synthio
import ulab.numpy as np
# for PWM audio with an RC filter
@dcooperdalrymple
dcooperdalrymple / loop-test.py
Last active November 20, 2023 15:30
Demonstration of CircuitPython synthio.Note Experimental Loop Parameters
# synthio.Note waveform_loop_start & waveform_loop_end Test
# 2023 Cooper Dalrymple - me@dcdalrymple.com
import time
import board
import audiomixer
import synthio
import ulab.numpy as np
# for PWM audio with an RC filter
@dcooperdalrymple
dcooperdalrymple / code.py
Last active June 28, 2023 13:14
CircuitPython synthio Portamento with Single Shot LFO Example
# CircuitPython synthio Portamento with Single Shot LFO Example
# 2023 Cooper Dalrymple - me@dcdalrymple.com
# GPL v3 License
import board, time
import random, math
from audiobusio import I2SOut
from audiomixer import Mixer
import synthio
import ulab.numpy as numpy
@dcooperdalrymple
dcooperdalrymple / code.py
Created June 26, 2023 20:04
CircuitPython synthio Note.bend Range Demonstration
# CircuitPython synthio Portamento Example
# 2023 Cooper Dalrymple - me@dcdalrymple.com
# GPL v3 License
import board, time
import random
from audiobusio import I2SOut
from audiomixer import Mixer
import synthio
import ulab.numpy as numpy
@dcooperdalrymple
dcooperdalrymple / code.py
Last active June 28, 2023 13:16
CircuitPython synthio Portamento Example
# CircuitPython synthio Portamento Example
# 2023 Cooper Dalrymple - me@dcdalrymple.com
# GPL v3 License
import board, time
import random, math
from audiobusio import I2SOut
from audiomixer import Mixer
import synthio
import ulab.numpy as numpy
@dcooperdalrymple
dcooperdalrymple / code.py
Created June 20, 2023 19:58
CircuitPython synthio Monophonic MIDI Synthesizer
# CircuitPython synthio Monophonic MIDI Synthesizer
# 2023 Cooper Dalrymple - me@dcdalrymple.com
# GPL v3 License
import time
import math
import board
from digitalio import DigitalInOut, Direction, Pull