Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Alman cowboy

View GitHub Profile
@cowboy
cowboy / cowboy-launchkey-mini-mk3-supercharger.c
Last active Sep 6, 2022
Launchkey Mini MK3 Supercharger (USB MIDI) - for Teensy 4.1
View cowboy-launchkey-mini-mk3-supercharger.c
// To give your project a unique name, this code must be
// placed into a .c file (its own tab). It can not be in
// a .cpp file or your main sketch (the .ino file).
#include "usb_names.h"
// Edit these lines to create your own name. The length must
// match the number of characters in your custom name.
#define MIDI_NAME {'C','B',' ','S','u','p','e','r',' ','L','a','u','n','c','h','k','e','y'}
@cowboy
cowboy / teensy-41-usbmidi-issue
Created Aug 23, 2022
Teensy 4.1 USB MIDI issue: note on/off messages get dropped when enough keys are pressed/released simultaneously (MIDI controller connected to USB host port, PC running MIDI OX connected to micro USB port)
View teensy-41-usbmidi-issue
// Settings:
// Tools > Board = "Teensy 4.1"
// Tools > USB Type to "MIDI"
#include <USBHost_t36.h> // access to USB MIDI devices (plugged into 2nd USB port)
// Create the ports for USB devices plugged into Teensy's 2nd USB port (via hubs)
USBHost myusb;
USBHub hub1(myusb);
MIDIDevice midiDevice(myusb);
@cowboy
cowboy / cowboy-midi-sustain-filter.c
Last active Aug 18, 2022
USB MIDI "proxy" that converts Note On + Sustain + Note Off => Note On + "Sustained" Note Off for devices that don't handle Sustain (CC 64) well
View cowboy-midi-sustain-filter.c
// To give your project a unique name, this code must be
// placed into a .c file (its own tab). It can not be in
// a .cpp file or your main sketch (the .ino file).
#include "usb_names.h"
// Edit these lines to create your own name. The length must
// match the number of characters in your custom name.
#define MIDI_NAME {'C', 'o', 'w', 'b', 'o', 'y', ' ', 'F', 'i', 'l', 't', 'e', 'r'}
@cowboy
cowboy / cowboy.scad
Last active Jun 21, 2022
OpenSCAD utility modules
View cowboy.scad
// ===============================================================
// Misc utilities for OpenSCAD
// 2022 "Cowboy" Ben Alman
//
// https://gist.github.com/cowboy/0a536021bcf1d07b2a59e808dcddd278
// ===============================================================
// Epsilon value for merging solids
eps=0.001;
View cowboy-midi-to-clock-run.ino
// ===============================================================
// MIDI to 24 PPQN Clock + Run (USB MIDI) - Teensy LC Firmware
// "Cowboy" Ben Alman, 2022
// https://gist.github.com/cowboy/1af3a69d4b6cae6a099fcf76431bda02
// ===============================================================
int PPQN = 24;
int RUN_PIN = 26;
int RUN_LED_PIN = 20;
@cowboy
cowboy / run-in-console.js
Last active Oct 29, 2021
Amits Launch Pad Pro Light Show Editor - Unofficial Launchpad Mini Mk3 support
View run-in-console.js
// Run this in the console at https://midi.amitszone.com/LPP_LIGHTSHOW_BUILDER/
// to get it to work with the Launchpad Mini Mk3. It may work with other new
// Launchpads, I'm not sure (If it does, comment below, thanks!)
(() => {
// Create mapping of Launchpad Pro -> Mini Mk3 notes
// (This is only the mapping for the 8x8 grid area)
const noteMap = {}
for (let i = 1; i <= 8; i++) {
for (let j = 1; j <= 8; j++) {
@cowboy
cowboy / handtrack-detection.html
Last active Oct 18, 2021
Hand tracking detection in OBS Studio
View handtrack-detection.html
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// ===========================================================================
// Hand detection in OBS Studio
// by "Cowboy" Ben Alman - 2021
// https://gist.github.com/cowboy/275360358a2c25fbeafa770ad0efcd25
// ===========================================================================
//
@cowboy
cowboy / bit-string-encoding.js
Last active Oct 12, 2021
bit-string-encoding.js
View bit-string-encoding.js
// https://codesandbox.io/s/bit-string-compression-zydb3?file=/src/App.js
const name = 'test_example'
const width = 48
const height = 48
const arr = [
0xffffff000000,
0x8000017ffffe,
0xbffffd400002,
0xa00005400002,
@cowboy
cowboy / cowboy-akai-force-rec-pedal-matrix.ino
Last active Nov 1, 2021
Akai Force Rec Pedal w/ 8x8 Matrix Display (USB MIDI) - for Teensy LC
View cowboy-akai-force-rec-pedal-matrix.ino
// ===============================================================
// Akai Force Rec Pedal w/ 8x8 Matrix Display (USB MIDI) - for Teensy LC
// "Cowboy" Ben Alman, 2021
// https://gist.github.com/cowboy/6c2230d54aea58577c5b7953ea86aebe
// ===============================================================
// Why does this exist?
//
// I designed this to circumvent an issue with the Akai Force where receiving
// an MMC Rec message signals that the loop should end at the end of the
@cowboy
cowboy / cowboy-akai-force-rec-pedal.ino
Last active Sep 28, 2021
Akai Force Rec Pedal (USB MIDI) - for Teensy LC
View cowboy-akai-force-rec-pedal.ino
// ===============================================================
// Akai Force Rec Pedal (USB MIDI) - for Teensy LC
// "Cowboy" Ben Alman, 2021
// https://gist.github.com/cowboy/5ad43d0d369c79b6d6538f076698e17a
// ===============================================================
// Why does this exist?
//
// I designed this to circumvent an issue with the Akai Force where receiving
// an MMC Rec message signals that the loop should end at the end of the