Skip to content

Instantly share code, notes, and snippets.

@mzero
mzero / dmastall.ino
Created December 26, 2021 05:20
Sketch for Curcuit Playground Express board demonstrating bug in FreeTouch library
/* DMA Stall
This sketch will demonstrate how the FreeTrouch library code makes reads to
PTC peripheral registers without the required Read-Synchronization. While
such reads succeed, they stall the AHB-APB Bridge C.
This is normally not an issue - but if there are other accesses going through
that bridge, then they will be stalled as well. A common example is to use the
DMAC to transfer data to the DAC or from the ADC. These peripherals are on
the same bridge (C). Stalls caused by non-scyhcronized reading seem to be on
#include <Arduino.h>
class DebouncedSwitch {
public:
DebouncedSwitch(int p, int mode=INPUT_PULLDOWN) : pin(p), nextValidAt(0) {
pinMode(pin, mode);
state = nextState = digitalRead(pin);
}
bool update() {
@mzero
mzero / probeDisplay.ino
Created August 27, 2020 15:48
Example of reading four probes via Adafruit IO, and displaying in rotation on a display.
/**
*** Probes & Data storage
**/
AdafruitIO_Feed *probe1 = io.feed("probe_one");
AdafruitIO_Feed *probe2 = io.feed("probe_two");
AdafruitIO_Feed *probe3 = io.feed("probe_three");
AdafruitIO_Feed *probe4 = io.feed("probe_four");
const int numberOfProbes = 4;
#include "RTClib.h"
#include <Adafruit_MCP23017.h>
#define NUM_ONES_LEDS 4
RTC_DS3231 rtc;
Adafruit_MCP23017 mcpMinutes;
Adafruit_MCP23017 mcpHours;
Adafruit_MCP23017 mcpMonths;
Adafruit_MCP23017 mcpDayLow;
Adafruit_MCP23017 mcpDayHigh;
#include "RTClib.h"
#include <Adafruit_MCP23017.h>
#define NUM_ONES_LEDS 4
enum {
pinFirst = 0,
pinLast = 15,
pinJanuary = 0,
pinFebruary,
@mzero
mzero / flash-test.ino
Created July 7, 2020 21:27
Feather Express flash tester
#include <Adafruit_SPIFlash.h>
namespace {
// ===
// === Test Data Generation and Checking
// ===
const size_t BLOCKSIZE = 512;
@mzero
mzero / snd-digitakt.md
Created October 29, 2019 17:08
digitakt usb audio driver on RaspberryPi

building the linux digitakt usb driver

needed to install

sudo apt install flex bison libssl-dev libncurses5-dev bc

clone kernel sources

cd
mkdir kernel

cd kernel/

@mzero
mzero / ddp-to-kunaki.py
Created April 9, 2019 00:14
Convert DDP mastered CDs to Kunaki's CUE format
"""Convert DDP mastered CDs to Kunaki's CUE format.
tl;dr:
python ddp-to-kunaki.py my-cool-cd-ddp-dir my-cool-cd-kunaki
This will produce two files:
my-cool-cd-kunaki.CUE <-- the markers
my-cool-cd-kunaki.iso <-- the audio (*not* an ISO format file!)
@mzero
mzero / start_pbj_sc.sh
Created August 18, 2018 15:45
Start SuperCollider script from the Pisound button
#!/bin/sh
. /usr/local/pisound/scripts/common/common.sh
log "starting pbj"
flash_leds 1
killall scsynth
killall sclang
rm -f /tmp/sclang-*.log 2>/dev/null || true

These are instructions for building a stand alone, headless, music computer based on the Pisound audio card and a RaspberryPi 3.

I use this set up in my live performance rig where it does all of the following without breaking a sweat:

  • Audio effects
  • stutter gate (beat sync'd)