Skip to content

Instantly share code, notes, and snippets.

@catfact
catfact / graph_wrap_demo.scd
Last active March 23, 2021 03:53
supercollider graph wrapping
Routine {
s = Server.default;
~make_def = {
arg name, path;
// assume path refers to a .scd, returning a function, returning a ugen graph
// Hz is argument to function
f = this.executeFile(path);
f.postln;
~edo8_ratios = Array.series(8, 0, 12/8).midiratio;
// NB: using augmented 4th for tritone
~pythagorean_ratios = [
1, 256/243, 9/8, 32/27, 81/64, 4/3, 729/512, 3/2, 128/81, 27/16, 16/9, 243/128
];
// for EDO8, our mapping will assign each keyboard degree to the EDO8 interval closest to the corresponding chromatic pythagorean interval. (distance in log2 pitch)
~edo8_map = ~pythagorean_ratios.collect({arg pRat, pIdx;
s = Server.default;
s.waitForBoot { Routine {
~bufSize = 1<<14;
~xfadeFrames = 500;
///////////////////////
// FIXME: ugly, make a data structure
// NB: soundfiles must be stereo
@catfact
catfact / chunked_audio_capture.scd
Last active August 10, 2021 07:14
supercollider: chunked audio capture
// write audio input to multiple, equally sized, contiguous .wav chunks
(
s = Server.default;
s.waitForBoot {
Routine {
~packetFrames = 45056;
~bufFrames = ~packetFrames * 2;
b = Buffer.alloc(s, ~bufFrames, 2);
#include <stdio.h>
#include <stdint.h>
struct state {
uint16_t x;
uint16_t y;
uint16_t z;
};
#include <stdio.h>
#include <stdint.h>
// everything in here assumes ieee754 floats on LE machine
#define EXPO_LSHIFT 23
#define EXPO_MASK (~(0xff << EXPO_LSHIFT))
void xorshift32(uint32_t *x) {
uint32_t y = *x;
local sc = softcut
init = function()
-- mixer settings
audio.level_cut(1.0)
audio.level_adc_cut(1)
-- voice 1: input from ADC channel 1 only, pan hard left
sc.level_input_cut(1, 1, 1.0)
@catfact
catfact / twoclocks.lua
Last active January 25, 2022 15:28
two parallel clocked sequences on norns
clock_1 = nil
clock_2 = nil
sync_1 = 1/4
sync_2 = 1
engine.name = 'PolyPerc'
init = function()
engine.release(0.09);
@catfact
catfact / cut_test_rewind.lua
Created October 1, 2021 03:14
softcut (norns): test rewind while stopped
--- k2: start/stop
--- k3: reset pos
file = '/home/we/dust/audio/zebra/dont_explain_48k.wav'
cut = softcut
state = { playing = false }
t0 = 0
toggle_play = function()
@catfact
catfact / fetch_gh_issues.py
Last active October 6, 2021 02:12
fetch_gh_issues
import github
from datetime import date
import csv
# your auth token here:
g = github.Github("zzooboobeeebooblaammana")
repo = g.get_repo("monome/norns")
open_issues = repo.get_issues(state='open')
datestr = date.today().strftime('%y%m%d')