Skip to content

Instantly share code, notes, and snippets.

@tatecarson
tatecarson / MIDIoutPattern.scd
Created January 19, 2017 01:28
This explains how to
/*
How to send midi to other software such as live !
make sure the IAC bus is turned on
check out this if you don't know how
https://help.ableton.com/hc/en-us/articles/209774225-Using-virtual-MIDI-buses-in-Live
*/
//initialize the midi client
MIDIClient.init;
//Setup for concert hall
//add outputbuss channels
s.options.numOutputBusChannels = 22;
//reboot to initialize
s.reboot;
//run this to use ATK examples in the concert hall
//make this into class
s.boot;
b = Buffer.alloc(s, 512,1);
d = Buffer.read(s, Platform.resourceDir +/+ "sounds/FW_kick loop_150bpm_3.wav");
SynthDef(\tremolo, {arg inbus=0, outbus=0, freq=1, strength=1, obufnum,
bufnum = 0, rate = 1, trigger = 1, startPos = 1, loop = 1;
var fx, sig, mod;
(
{
~files.do{|filename,i|
[i, filename].postln;
e = SCMIRAudioFile(filename, [[MFCC, 13], [Chromagram, 12]]);
e.extractFeatures();
e.extractOnsets();
SynthDef(\gran_2b, { |out = 0, pos = 0, sndBuf = 0, windowBuf = 1, granDur = 0.1,
rate = 1, loop = 1, panMax = 0, amp = 0, bpFreq = 500, bpRQ = 0.5, bpWet = 1,
ltime = 1|
var window, granSrc, src;
granSrc = PlayBuf.ar(2, sndBuf, BufRateScale.kr(sndBuf) * rate,
1, round(pos * BufFrames.kr(sndBuf)), loop, 2);
window = BufRd.ar(1, windowBuf,
EnvGen.ar(Env([0, BufFrames.kr(windowBuf)], [granDur]),
doneAction: 2), loop, 4);
src = (BPF.ar(granSrc, bpFreq, bpRQ, mul: (bpRQ ** -1) * (400 / bpFreq ** 0.5)) *
SynthDef(\klankDrone, {|out = 0, klankfreqs = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
klankamps = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
rings = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], pan = 0, bufnum, rate = 1
amp = 0.2, ffreq = 440, saturation = 1, klankmix = 0, pointer, warpRate = 1, droneMix = 0
pos = 0, envTime = 1, atk = 0.5, rel = 0.5, susLevel = 1, envCurve = 1, masterDist = 0.5,
wdrop = 20, wmode = 1|
var sig, localBuf, record, droned, klank;
var e = EnvGen.kr(Env.new([0, susLevel, 0], [atk, rel].normalizeSum, envCurve), timeScale: envTime, doneAction:2);
var i = PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*rate, startPos: BufFrames.kr(bufnum)*pos);
var z = Klank.ar(`[klankfreqs, klankamps, rings], i);
SpearRead {
//originally written by Lukas Nowak
*new { |filePath, time|
^super.new.initClass(filePath, time)
}
initClass { |filePath, time|
var file;
var freq = List.new;