Skip to content

Instantly share code, notes, and snippets.

@kindohm
kindohm / no-value.scd
Last active January 1, 2024 21:59
DMK's synthdef "no value without utility"
SynthDef.new(\DFM1ping, { |out, freq = 440, attack = 1, release = 1, gain = 1, pan = 0,
resonance = 0, sustain = 2, transitionTime = 0.875,
disProb = 0, disMult =0, ringzAmp = 1, pulseAmp = 0 |
var sig, env, resonanceEnv ;
freq = freq.clip(20, 20000);
env = EnvGen.kr(Env.new([0, 1, 1, 0], [attack, sustain, release], \sine)) ; // An envelope for some stuff. Mostly amplitude. It goes up, then holds there, then goes down again.
resonanceEnv = EnvGen.ar(Env.new([resonance, resonance, resonance, 0.9], [attack, sustain, release], curve: \sine)) ; // An envelope for the resonance.
sig = DFM1.ar(BrownNoise.ar(1)*Decay.ar(Impulse.ar(0.01),0.1),freq,resonanceEnv) ; // This filter is a special treat. It has character. Get the SC3 plugins now.
sig = sig + (Ringz.ar(Dust2.ar(freq.range(0.0,0.0009765625)),freq,attack+sustain+release,ringzAmp) * 0.00025) ; // Ringz is a ringing filter.
@kindohm
kindohm / midi-monitor-uno.ino
Created December 29, 2023 16:49
Arduino MIDI monitor with UNO support
/*
// Simple DIY Electronic Music Projects
// diyelectromusic.wordpress.com
//
// Simple MIDI Serial Monitor
// https://diyelectromusic.wordpress.com/2022/04/06/simple-midi-serial-monitor/
//
MIT License
Copyright (c) 2020 diyelectromusic (Kevin)
@kindohm
kindohm / in-out.ino
Created December 23, 2023 20:12
arduino MIDI input and output that works
#include <MIDI.h>
#define MIDI_HW_SERIAL2 1
// ---- Definitions for MIDI INPUT devices ----
//
#ifdef MIDI_HW_SERIAL2
@kindohm
kindohm / input.ino
Created December 23, 2023 18:20
Arduino MIDI input
# original code is from
# https://www.notesandvolts.com/2015/02/midi-for-arduino-input-test.html
#include <MIDI.h> // Add Midi Library
#define LED 13 // Arduino Board LED is on Pin 13
//Create an instance of the library with default name, serial port and settings
MIDI_CREATE_DEFAULT_INSTANCE();
@kindohm
kindohm / ard-midi-clock-pot.ino
Created December 19, 2023 02:31
arduino micro midi clock with pot
#define MIDI_CLOCK 0xF8
#define MIDI_CLOCK_PIN 1
// Define the MIDI baud rate
#define MIDI_BAUD_RATE 31250
unsigned long previousMicros = 0;
unsigned long intervalBetweenTempoChanges = 2000; // 2 seconds in microseconds
unsigned long lastTempoChangeTime = 0;
@kindohm
kindohm / gist:4643056
Last active November 28, 2023 18:23
converts .wav files to base64 encoded text
//crude and incomplete but it works
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var constants = require('constants');
var size = 0;
var encoded = '';
var fileName = '';
var wavFileName = '';
var base64FileName = '';
@kindohm
kindohm / breaks.rb
Last active August 22, 2021 16:08
Sonic Pi Breaks
# mashing up breakbeats in Sonic Pi
# resulting audio: https://soundcloud.com/kindohm/sonic-pi-breaks
# this var changes the playback speed of the breaks,
# which in turn controls the loop sleep time and overall tempo
rate = 1
# samples paths
samples = []
samples.push("C:\\tidal-samples\\samples\\akuma\\Half Baked break a.wav")
@kindohm
kindohm / scratch.tidal
Created December 28, 2020 15:43
max in tidal
do
let nn num = stack [speed (segment 1 $ range 0.5 3 $ (cF 1 num)) # s "arpy", s "drum" ]
step1 = nn "96"
step2 = nn "98"
step3 = nn "100"
step4 = nn "70"
step5 = nn "72"
step6 = nn "74"
step7 = nn "76"
step8 = nn "78"
@kindohm
kindohm / lime.hs
Created August 12, 2018 23:32
Lime code
bps (140/120)
do
let spat = "[1.2 ~ ~ ~ ~ ~ 0.4 ~ ~ ~]"
let fpat = "[0 ~ ~ ~ ~ ~ 127 ~ ~ ~]"
let dpat = "[0 ~ ~ ~ ~ ~ 3 ~ ~ ~]"
let mod p = spaceOut [1,1.1,0.9,0.95,1.7,1.25,0.8,1.65,1,0.7,0.823,1.5,1,2,1.8] $ p
d1 $ mod $ gain spat # note "-12" # s "midi" # midichan 15
d2 $ mod $ control fpat # ctlNum 100 # s "midi" # midichan 15 # midicmd "control"
d3 $ mod $ midinote dpat # s "midi" # gain 1.2
do
d1
$ limit
$ stack [
-- kick
, gain "{1@9 1@6 1@7 1@8}%2" # midichan 1 # note "c3"
-- pad swell
, gain "{1@15 1@16 1@13 1@12 1@14}%4" # midichan 3 # note "c3"
-- pad
, slow "<2 3 4 5>" $ (0.5 ~>) $ midichan 7 # note "c3"