Skip to content

Instantly share code, notes, and snippets.

View madskjeldgaard's full-sized avatar

Mads Kjeldgaard madskjeldgaard

View GitHub Profile
snippet h "header"
/*
`!v expand('%:t')`
`!v strftime("%Y-%m-%d")`
By: `!v g:snips_author`, `!v g:snips_contact`
*/
endsnippet
@madskjeldgaard
madskjeldgaard / particularlybalint.scd
Last active June 21, 2019 16:30
Particular example for Balint
// boot server
s.boot;
// Init particular
p = Particular.new;
// Load a buffer with sound
b = Buffer.read(s, "~/path/to/sound.wav");
// Number of outputs, this can be fun play with in patterns
@madskjeldgaard
madskjeldgaard / balintthelivecoder.scd
Created June 21, 2019 16:57
Livecoding time stretch
// Try live coding this, Balint! Change some parameters and then reevalute
(
Ndef(\balintthedragon, {
arg buffer, // If you don't set the buffer argument, it will automatically take whatever buffer you have loaded in your server
grainsize=0.5,
rate=0.001,
freqScale=0.25,
volume=1,
rand=0.1;
(
// This will automatically create a bus and map it accordingly in the Pbind
// Try changing each node proxy and listen to the pattern change
// You still have to do all operations to the lfo's data inside of the
// nodeproxies
Ndef(\lfo1, {SinOsc.kr(0.1)});
Ndef(\mousefreq, {MouseX.kr().exprange(20,12000)});
Pbind(
\amp, Ndef(\lfo),
@madskjeldgaard
madskjeldgaard / safe-benjolin.scd
Last active July 1, 2024 11:38
A safer version of Alejandro Olartes benjolin

/* Instrument inspired from Rob Hordijk's Benjolin, it requires sc3-plugins (PulseDPW, SVF and DFM1)

outSignal: 1-triangle osc1, 2-square osc1, 3-triangle osc2, 4-pulse osc2, 5-XOR output, 6-Filter output

@madskjeldgaard
madskjeldgaard / default-synth.scd
Created October 18, 2019 10:49
An alternative default synth for SuperCollider
/*
The default synth def sound in SC can be tiresome.
You can change it simply by making a new SynthDef called \default which will overwrite the other one.
To make this change permanent, add it to your startup file.
*/
// A simple triangle wave synth in stereo with panning and a simple low pass filter
(
@madskjeldgaard
madskjeldgaard / crazy-christmas.scd
Last active November 11, 2019 21:07
notes from sc meetup november 11th 2019
/*
Crazy chaotic notes from SuperCollider meetup november 11th 2019 at Notam
waaaa
*/
// Change default synth: https://www.madskjeldgaard.dk/how-to-change-the-default-synth-in-supercollider/
// Pbindf + Pkey
(
Pdef(\henrik,
@madskjeldgaard
madskjeldgaard / gen_pat_file.scd
Last active March 9, 2020 15:09
Generative SuperCollider files containing random patterns
/*
Generate SuperCollider file containing simple random pattern
*/
(
// Time stamp
~stamp = Date.getDate.stamp;
// This goes in the duration key of the pattern
~dur = "Pseq(%)".format(Array.rand(10, 0.1,10.0));
@madskjeldgaard
madskjeldgaard / quarantine-live2.scd
Created March 15, 2020 17:05
Code for the Quarantine livestream #2
/*
Code from the Quarantine Livestream #2
A small gui program controlling a pattern
*/
(
var numSliders = 4;
var numButtons = 2;
@madskjeldgaard
madskjeldgaard / cpp.snippets
Last active April 18, 2020 00:07
Simple and sensible snippet for openframeworks classes in Vim/Ultisnips
snippet ofclass "Class for open frameworks"
#include "${1:`!p snip.rv = snip.basename`}.h"
$1::$1(){}
void $1::setup(){${2:}}
void $1::update(){${3:}}
void $1::draw(){${4:}}