Skip to content

Instantly share code, notes, and snippets.

View madskjeldgaard's full-sized avatar

Mads Kjeldgaard madskjeldgaard

View GitHub Profile
@madskjeldgaard
madskjeldgaard / build-sc3-plugins-pi.sh
Last active February 5, 2025 07:10
Install SuperCollider and SC3-plugins headless on Raspberry Pi
#!/bin/sh
# Taken from: https://github.com/lvm/build-supercollider
###
#
# Variables
#
INSTALL_DIR=/tmp
SUPERCOLLIDER_VER=main
SC3PLUGINS_DIR=$INSTALL_DIR/sc3-plugins
@madskjeldgaard
madskjeldgaard / ndef-setter.scd
Last active April 22, 2020 14:22
Set Ndef using custom event
(
// Create new Ndef setter event type
Event.addEventType(\ndset, {|server|
~type = \set;
~id = Ndef(~key).group;
~args = Ndef(~key).controlKeys(except: ~exceptArgs);
currentEnvironment.play;
})
)
@madskjeldgaard
madskjeldgaard / main.rs
Last active December 22, 2022 15:00
Simple buffer playback in Rust using the rodio crate
use rodio::Sink;
use std::fs::File;
use std::io::BufReader;
fn main() {
// Sound output
let device = rodio::default_output_device().unwrap();
let sink = Sink::new(&device);
// Buffer playback
@madskjeldgaard
madskjeldgaard / newnannou
Last active April 9, 2020 14:12
Nannou project generator bash script
#!/usr/bin/env bash
#
# A script for generating nannou projects
#
# Usage: newnannou <projectname>
# If you set the environment variable NANNOU_DIR to the path
# of your nannou projects folder, this will be used, otherwise
# the target folder is your home folder
#
# by Mads Kjeldgaard 2020
@madskjeldgaard
madskjeldgaard / of-nvim.md
Last active April 5, 2020 15:45
Notes on getting NeoVim and openFrameworks to play nice (work in progress)

Install clang formatting

On Arch Linux I had to install clang to make this work: sudo pacman -Syu clang

There's some really nice autoformatting plugins from Google. Add these to your init.vim and install:

" Code formatting (for c++)
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
@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:}}
@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 / 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 / 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,