Code

Plugins

RS Algorithmic Verb

Retro algorithmic reverb plugin in JUCE with multiple algorithms (including emulations of classic hardware) and more to come.

Includes plate and hall reverbs from Dattorro; Gardner's 1992 room reverbs; 4 feedback delay network reverbs using the "FDN Toolbox"; and two experimental/special-effect reverbs. Recently updated for code clarity and maintainability.

RS Broken Media

Stereo glitch plugin that records a buffer of recent audio and mangles it, giving tape-warping effects, CD skips, bitcrushing, cell phone codecs, and more.

RS Telecom

Lo-fi plugin with options of various telecommunications codecs including Mu-Law and A-Law 8-bit, and GSM 06.10. Work in progress — more codecs and glitching effects coming soon.

Max/MSP Tools and Externals

rs.max

[rs.file2sig~]: import any file as raw binary data and play this data back as a control signal for synthesizing PSK (phase-shift keying)/ASK/FSK/etc. telecommunications signals. See Nathan Ho's post on using digital modulation modes for synthesis to hear the kinds of sounds this produces.

rs.reverb

A collection of Max/MSP algorithmic reverb abstractions, based on classic DSP papers and software.

Command-Line Tools

data2audio

Rust tool to import a folder of files, convert to audio, and normalize/filter out sub-audible frequencies. Processes files in parallel (using rayon), so it's extremely fast even with large batches of files.

This is the same process described in this post, but automated to be much less time-consuming.

mp3glitch

Python tool for glitching MP3s while leaving them playable. Includes many options to shape glitching amount, character, and timbre, and a shell script to automate converting batches of WAV files to MP3 with FFmpeg before glitching.

The mechanics behind this are described in this post, and I discuss using Python to do the glitching in this post.

Grimoire

A grimoire is a book of spells or incantations. This one is my place to keep shell scripts and other short snippets of code I find useful.

Watch Lilypond Output and Open

This Python script and this Bash script allow me to watch the MIDI and PDF files generated from Lilypond and open them in Audacity and the default viewer, respectively every time they change.

Make New Post

This script generates a new post file with the correct file name, directory, title, description, and date. Run ./post "<post-title>" "<post-description>" from the root folder to use, and optionally use -d flag to set a date (YYYY-MM-DD) in the future. A similar script will create an interaction post (e.g., likes, RSVPs, etc.), with flags for different types of interaction.

#!/usr/bin/env bash

isodate=$(date +"%Y-%m-%dT%H:%M:%S%z")
year=$(date +"%Y")
month=$(date +"%m")

while getopts ":d" option; do
	case "${option}" in
	d)
		isodate="${2}T12:30:00$(date +%z)"
		year=$(echo "${isodate}" | cut -c1-4)
		month=$(echo "${isodate}" | cut -c6-7)
		;;
	*)
		echo "Error: invalid flag ${option}"
		;;
	esac
	shift $((OPTIND))
done

if [ ${1+x} ]; then
	name=$1
else
	name="Post"
fi

if [ ${2+x} ]; then
	description=$2
else
	description=""
fi

# tr replace first w/ second; -c means "complement", -d "delete", -s "squeeze repeats"
slug=$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr -cd '[:alnum:] ' | tr -s " " "-")

# -p: make intermediate directories and don't complain if the full path already exists
mkdir -p "pages/posts/$year/$month"

fullpath=pages/posts/$year/$month/$slug.md

cat >>"$fullpath" <<EOF
---
title: "$name"
description: $description
fedi_url: 
og_image: 
og_image_width: 
og_image_height: 
og_image_alt: 
date: $isodate
tags:
  - post
post_series: 
draft: true
indienews: true
---

<link rel="stylesheet" type="text/css" href="/styles/notes-photos.css">

<link rel="stylesheet" type="text/css" href="/styles/code/prism-perf-custom.css" />
<link rel="stylesheet" type="text/css" href="/styles/code/code-tweaks.css" />
EOF

Send Webmentions

Send webmentions from your page to a URL it mentions.

#!/usr/bin/env bash

source_url="$1"
target_url="$2"
endpoint_url=$(curl -i -s "$target_url" | grep 'rel="webmention"' | grep -o -E 'https?://[^ ">]+' | sort | uniq)
curl -i -d "source=$source_url&target=$target_url" "$endpoint_url"

Filter Webmentions

This Python script gets my webmentions, filters out all mentions received over Bridgy (which I use to pull in Mastodon/Bluesky interactions as webmentions), and writes the rest to a file webmentions.json. This is nice because non-Mastodon/Bluesky webmentions are much more interesting to me, but they're much more rare than social media interactions, and tend to get lost in the shuffle. I run ./webmentions.py from my root folder to get the mentions, after which they can be viewed by opening webmentions.json in an editor.

Tea/Coffee Timer

I love tea (my favorite is Bigelow's Vanilla Chai) and I prefer it steeped for a precise length of time. However, I find alarms extremely irritating, with the worst part being that many of them keep going until you turn them off. This script lets me type e.g., ./timer.sh 4m to get a timer that chimes once and then stops. Note that this depends on timer.

timer.sh
#!/usr/bin/env bash

if [ ${1+x} ]; then
    time="$1"
else
    time="4m"
fi

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    # /usr/share/sounds/gnome/default/alerts/string.ogg may be available on GNOME
    # may also look on freesound.org
    # `play` command requires SoX
    timer "$time" && play "/path/to/sound/file"
elif [[ "$OSTYPE" == "darwin"* ]]; then
    timer "$time" && afplay "/System/Library/Sounds/Glass.aiff"
else
    echo "Unknown OS: no ending sound will be played"
    timer "$time"
fi