Skip to content

Instantly share code, notes, and snippets.

View SpotlightKid's full-sized avatar

Christopher Arndt SpotlightKid

View GitHub Profile
@SpotlightKid
SpotlightKid / tapklick.sh
Last active February 14, 2024 21:49
Run klick metronome and tap tempo with enter/return key
#!/bin/bash
#
# Run klick metronome and tap tempo with enter/return key
#
TEMPO="${1:-120}"
cleanup() {
stty echo
oscsend localhost 9001 /klick/metro/stop
@SpotlightKid
SpotlightKid / sendsyx.py
Created August 2, 2023 14:21
Send bytes given on the command line as hexadecimal digit pairs to selected MIDI output
#!/usr/bin/env python3
import sys
from rtmidi.midiutil import open_midioutput
if sys.argv[1:]:
midiout, _ = open_midioutput()
midiout.send_message(bytearray.fromhex(" ".join(sys.argv[1:])))
@SpotlightKid
SpotlightKid / feedinfo.py
Created June 2, 2023 18:53
Examine an RSS feed retrieved from given URL
#!/usr/bin/env python
"""Examine an RSS feed retrieved from given URL."""
import sys
from xml.dom.minidom import parseString as parse_xml
import feedparser
import requests
@SpotlightKid
SpotlightKid / waveformqt.py
Created April 24, 2023 19:02
Display waveform of an audio file using PyQt/QPainter
#!/usr/bin/env python
"""Display waveform of an audio file."""
import argparse
import logging
import sys
from statistics import fmean
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import Qt
@SpotlightKid
SpotlightKid / cchorus.dsp
Last active February 26, 2023 23:31
FAUST versatile stereo chorus effect
declare name "CChorus";
declare version "0.5";
declare author "Christopher Arndt";
declare license "MIT License";
declare description "Versatile stereo chorus effect";
import("stdfaust.lib");
PI = ma.PI;
TWOPI = 2.0 * ma.PI;
@SpotlightKid
SpotlightKid / pthreads_cython.pyx
Last active December 4, 2022 18:59 — forked from jerryvig/pthreads_cython.pyx
Basic demonstration of how to use pthreads (POSIX threads) in Cython.
# cython: language_level=3, boundscheck=False
from cython.operator cimport dereference
from libc.stdio cimport printf
from posix.unistd cimport usleep
cdef extern from "pthread.h" nogil:
ctypedef int pthread_t
ctypedef struct pthread_attr_t:
pass
@SpotlightKid
SpotlightKid / pico_setup.sh
Created December 2, 2022 21:40
pico_setup.sh - Set up a development environment for the Raspberry Pi Pico
#!/bin/bash
#
# pico_setup.sh - Set up a development environment for the Raspberry Pi Pico
#
# See the "Getting started with Raspberry Pi Pico" guide for reference:
#
# https://www.raspberrypi.com/documentation/microcontrollers/c_sdk.html
#
# The script will:
#
import argparse
import logging
import sys
import time
from rtmidi.midiutil import open_midioutput
from rtmidi.midiconstants import *
log = logging.getLogger("midi-send-all")
@SpotlightKid
SpotlightKid / parse_srcinfo.py
Last active April 1, 2022 22:09
Get info from a PKGBUILD file by calling makepkg --printsrcinfo and parsing the output
#!/usr/bin/env python3
import json
import sys
from subprocess import CalledProcessError, run
ARRAY_FIELDS = (
"arch",
"arch",
"b2sums",
@SpotlightKid
SpotlightKid / smfinfo.py
Created July 9, 2021 20:57
Show basic tempo and time/key signature information of a standard MIDI file using miditk-smf
import sys
from miditk.smf.reader import MidiFileReader
from miditk.smf.sequence import MidiSequence, ObjectMidiEventHandler
# This defines callbacks called while parsing the MIDI sequence
# We only need to overwrite the event handlers we want to handle specially
class MySequenceHandler(ObjectMidiEventHandler):
def __init__(self, instance=None, debug=False):