MidiHydrogen : MidiHandler {
- classvar gmrock;
- *new {|name='Hydrogen', midiNames=#["Hydrogen", ["Hydrogen Midi-In", "Hydrogen Midi-Out"]], reveal=true|
- ^super.newCopyArgs(name, midiNames, reveal).midiInit.controlInit;
- }
-
- *initClass {
- gmrock = IdentityDictionary[
- \bass -> 36,
- \side -> 37,
- \snare -> 38,
- \clap -> 39,
- \rim -> 40,
- \tomfloor -> 41,
- \hatclosed -> 42,
- \tomlow -> 43,
- \hatpedal -> 44,
- \tomhigh -> 45,
- \hatopen -> 46,
- \cowbell -> 47,
- \ride -> 48,
- \ccrash -> 49,
- \ride2 -> 50,
- \splash -> 51,
- \hatsemiopen -> 52,
- \bell -> 53,
- ];
- gmrock.know = true;
+ *new {|name='Hydrogen', midiNames=#["Hydrogen", ["IAC Driver", "Bus 1"]], reveal=true|
+ ^super.newCopyArgs(name, midiNames, reveal).controlInit;
}
controlInit {
+ midiout = MIDIOut.newByName("IAC Driver", "Bus 1").latency_(0);
+ idin = MIDIClient.sources.detect{|i| (i.device == "Hydrogen").and(["Hydrogen"].includesEqual(i.name))}.uid;
midiout.latency_(Server.default.latency);
"Hydrogen is connected to supercollider";
}
\type, \midi,
\midiout, this.midiout,
\midicmd, \noteOn,
- \chan, 1,
+ \chan, 0,
)
}
// ==== Server setup
+//ServerOptions.outDevices
+s.options.outDevice = "Aggregate Device";
//s.options.outDevice = "MA WFRIENDZ";
//s.options.outDevice = "MacBook Air Speakers";
//s.options.outDevice = "External Headphones";
//s.options.outDevice = "EDIFIER R1080BT";
-s.options.outDevice = "Scarlett 2i4 USB";
+//s.options.outDevice = "Scarlett 2i4 USB";
+//s.options.outDevice = "Bose Mini II SE SoundLink";
//s.options.inDevice = "MacBook Air Microphone";
-s.options.inDevice = "Scarlett 2i4 USB";
+//s.options.inDevice = "Scarlett 2i4 USB";
+s.options.inDevice = "Aggregate Device";
s.options.maxNodes = 128 * 1024;
s.options.maxSynthDefs = 32 * 1024;
s.options.memSize = 1024 * 1024;
s.options.numBuffers = 32 * 1024;
s.options.numAudioBusChannels = 32 * 1024;
s.options.numControlBusChannels = 256 * 1024;
-s.options.numInputBusChannels = 2;
-s.options.numOutputBusChannels = 4;
+s.options.numInputBusChannels = 17;
+s.options.numOutputBusChannels = 20;
+s.options.numWireBufs = 128;
+s.options.hardwareBufferSize = 64;
+
+s.recHeaderFormat = "wav";
+s.latency = 0.4;
+
+Platform.case(
+ \osx, {
+ thisProcess.platform.recordingsDir = "/Users/genio/stock/audio/supercollider";
+ },
+ \linux, { "Linux".postln },
+ \windows, { "Windows".postln }
+);
+
+// global nice variables
+
+a = (
+ outs: 20,
+ s: 16, // speakers output
+ h: 18, // headpohens output
+ v: 0, // virtual output first bus
+ m: 16, // microphone input
+ e: 0, // external software input
+);
+
+// hydrogen drum machine constants
+b = (
+ bass: 36,
+ side: 37,
+ snare: 38,
+ clap: 39,
+ rim: 40,
+ tomfloor: 41,
+ hatclosed: 42,
+ tomlow: 43,
+ hatpedal: 44,
+ tomhigh: 45,
+ hatopen: 46,
+ cowbell: 47,
+ ride: 48,
+ ccrash: 49,
+ ride2: 50,
+ splash: 51,
+ hatsemiopen: 52,
+ bell: 53,
+);
// ==== Midi setup
~midiup = {
};
~midiup.value;
+try {
+ ~macbookMidiOut = MIDIOut.newByName("IAC Driver", "Bus 1").latency_(s.latency);
+} {
+ "Cannot connect to macbook midi out".postln;
+};
+
+m = (
+ hydrogenOut: ~macbookMidiOut,
+ abletonOut: ~macbookMidiOut,
+ ardourOut: ~macbookMidiOut,
+);
+
+// Fader
+
+SynthDef(\fader, {|in, out, amp=1.0|
+ var sig;
+ sig = In.ar(in, 2);
+ Out.ar(out, sig*amp);
+}).add;
+
+// Other stuff
+
+// A simple triangle wave synth in stereo with panning and a simple low pass filter
+// This synthDef was written by Mads Kjeldgaard and requires the sc3 plugins
+/*
+s.doWhenBooted{
+ SynthDef.new(\default, {
+ arg dur, attack=0.01, release=1.0,
+ t_gate=1, out, freq=442, cutoff=5500,
+ rq=1, pan=0.0, amp=0.5;
+ var env = EnvGen.kr(Env.perc(attack, release), t_gate, timeScale: dur, doneAction: 2);
+ var sig = DPW3Tri.ar(freq: freq, mul: env);
+ sig = RLPF.ar(sig, cutoff.clip(20.0, 20000.0), rq.clip(0.0,1.0));
+ sig = Pan2.ar(sig, pan);
+ Out.ar(out, sig * amp);
+ }).add;
+};
+
+s.waitForBoot {
+ ~clean = SuperClean(2, s);
+ ~clean.loadSoundFiles; // hot swap in samples from anywhere!
+ ~clean.loadSoundFiles("~/gart/media/Хахомо");
+ s.sync; // optionally: wait for samples to be read
+ ~clean.start([0,2,4]); // first 8 out looks like [0,2,4,6]
+ SuperClean.default = ~clean;
+ "[ SuperClean up + running ]".postln;
+};
+*/
+
// ==== Scales
// == Tunings
// == Sources
// fm synth
-SynthDef(\bino, { |
+SynthDef(\bino, {|
out=0, gate=1, freq=440, modFreq=440, amp=1, release=1.0, maxIndex=1
|
var sig, modIndex, env;