Skip to content

Instantly share code, notes, and snippets.

@nhthn
nhthn / MiniPond.sc
Created February 10, 2019 18:29
MiniPond
/*
MiniPond is a tiny variant of the LilyPond note entry syntax.
cdefgab - note name
s - sharp
f - flat
' - octave up
, - octave down
4 - quarter note
2 - half note
@nhthn
nhthn / sclang.py
Created September 13, 2019 05:11
sclang communication test
import sys
import subprocess
proc = subprocess.Popen(
["sclang", "-i", "scqt"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
@nhthn
nhthn / build-supercollider-on-arch.md
Created January 26, 2021 00:43
How I build SuperCollider on Arch
sudo pacman -S cmake jack2 qt5-base qt5-tools qt5-quickcontrols2
git clone --recursive https://github.com/supercollider/supercollider.git

# No help browser
cmake .. -DSC_USE_QTWEBENGINE=OFF

# No emacs
cmake .. -DSC_EL=OFF

No sudo for installation

@nhthn
nhthn / index.scd
Last active July 4, 2024 02:15
Cybernetic Synthesis
(
SynthDef(\cybernetic, {
var snd, index, divide, cutoff;
var freq;
index = MouseY.kr(1, 7000, 1);
freq = MouseX.kr(0.01, 40, 1);
divide = 1;
cutoff = 1;
snd = LocalIn.ar(4);
snd = Latch.ar(snd, PulseDivider.ar(snd.reverse, LPF.ar(snd, 10 * cutoff) * 1e5 * divide));
@nhthn
nhthn / jn_zeros.py
Created January 20, 2022 02:03
Bessel function zeros
import numpy as np
import scipy.special
f0 = scipy.special.jn_zeros(0, 1)[0]
print([list(scipy.special.jn_zeros(n, 10) / f0) for n in range(10)])
@nhthn
nhthn / generative-patch.scd
Created February 7, 2022 23:08
Generative SuperCollider patch
(
SynthDef(\kick, {
var snd;
snd = SinOsc.ar(50 * (1 + (8 * Env.perc(0.001, 0.05).ar) + (2 * Env.perc(0.001, 0.3).ar)));
snd = snd + (SinOsc.ar(200 * (1 + (3 * Env.perc(0.001, 0.05).ar))) * Env.perc(0.001, 0.05).ar);
snd = snd + (Hasher.ar(Sweep.ar) * Env.perc(0.001, 0.01).ar);
snd = snd.tanh;
snd = snd * Env.perc(0.001, 1.0).ar(Done.freeSelf);
snd = snd ! 2;
snd = snd * \amp.kr(1);
(
SynthDef(\kick, {
var snd;
snd = SinOsc.ar(Env([400, 70, 50], [0.05, 0.2]).ar);
snd = snd + (Hasher.ar(Sweep.ar) * Env.linen(0.001, 0.001, 0.001).ar);
snd = snd * Env.perc(0.001, 1).ar(Done.freeSelf);
snd = snd ! 2;
snd = snd * \amp.kr(-10.dbamp);
Out.ar(\out.kr(0), snd);
}).add;
@nhthn
nhthn / ivo-ivanov-type-beat.scd
Created November 19, 2022 17:37
Ivo Ivanov type beat
// Ivo Ivanov ripoff: https://www.youtube.com/shorts/1uukKdBGsY0
(
SynthDef(\kick, {
var snd;
snd = SinOsc.ar(Env.perc(0.001, 0.3, curve: -8).ar.linexp(0, 1, 30, 400));
snd = snd + (SinOsc.ar(XLine.ar(4000, 100, 0.01)) * Env.perc(0.001, 0.01).ar);
snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 8000, 0.5) * 3.dbamp * Env.perc(0.01, 0.03).ar);
snd = snd * Env.perc(0.001, 0.2, curve: -1).ar(Done.freeSelf);
snd = snd * 5.dbamp;
@nhthn
nhthn / trap-generator.scd
Last active March 24, 2025 17:35
TRAP GENERATOR

/*


|_ | | | | / \ | \ | | |/ / \ \ / / _ | | | | | | | || | / _ \ | | | ' / \ V / | | | | | | | | | _ |/ ___ | |\ | . \ | || || | || | || || |// __| _||_\ || _/ _/

500,000 DAMN SUBSCRIBERS ON THE SYNTHDEF CHANNEL

/* This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the