diff --git a/open_stage_control/modules/custom_module.js b/open_stage_control/modules/custom_module.js index 1122a28..33774cf 100644 --- a/open_stage_control/modules/custom_module.js +++ b/open_stage_control/modules/custom_module.js @@ -309,6 +309,10 @@ module.exports = { return {host, port, address, args} } + if (address === '/sampler') { + return data + } + /* if (['/mixer'].includes(address)) { console.log(data) diff --git a/open_stage_control/seeds_and_ledgers_mixer.json b/open_stage_control/seeds_and_ledgers_mixer.json index 509ee57..b68f9f7 100644 --- a/open_stage_control/seeds_and_ledgers_mixer.json +++ b/open_stage_control/seeds_and_ledgers_mixer.json @@ -52,7 +52,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 270, + "height": 220, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -96,7 +96,7 @@ }, { "type": "matrix", - "top": 270, + "top": 220, "left": 0, "lock": false, "id": "mixer/string/pan", @@ -104,7 +104,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 70, + "height": 50, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -148,7 +148,7 @@ }, { "type": "matrix", - "top": 270, + "top": 220, "left": 340, "lock": false, "id": "mixer/sine/pan", @@ -156,7 +156,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 70, + "height": 50, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -208,7 +208,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 270, + "height": 220, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -260,7 +260,7 @@ "interaction": true, "comments": "", "width": 60, - "height": 340, + "height": 310, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -307,7 +307,7 @@ "interaction": true, "comments": "", "width": "auto", - "height": 330, + "height": 300, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -365,7 +365,7 @@ "interaction": true, "comments": "", "width": 60, - "height": 340, + "height": 310, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -412,7 +412,7 @@ "interaction": true, "comments": "", "width": "auto", - "height": 330, + "height": 300, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -462,7 +462,7 @@ }, { "type": "matrix", - "top": 340, + "top": 270, "left": 0, "lock": false, "id": "mixer/string/mute", @@ -470,7 +470,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 60, + "height": 40, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -514,7 +514,7 @@ }, { "type": "matrix", - "top": 340, + "top": 270, "left": 340, "lock": false, "id": "mixer/sine/mute", @@ -522,7 +522,7 @@ "interaction": true, "comments": "", "width": 280, - "height": 60, + "height": 40, "expand": "false", "colorText": "auto", "colorWidget": "auto", @@ -563,6 +563,364 @@ "onValue": "", "widgets": [], "tabs": [] + }, + { + "type": "panel", + "top": 320, + "left": 0, + "lock": false, + "id": "mixer/bass/panel", + "visible": true, + "interaction": true, + "comments": "", + "width": 280, + "height": 40, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "colorBg": "auto", + "layout": "default", + "justify": "start", + "gridTemplate": "", + "contain": true, + "scroll": true, + "innerPadding": true, + "tabsPosition": "top", + "variables": "@{parent.variables}", + "traversing": false, + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "widgets": [ + { + "type": "fader", + "top": 0, + "left": 0, + "lock": false, + "id": "mixer/bass/volume/master", + "visible": true, + "interaction": true, + "comments": "", + "width": 270, + "height": 30, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "design": "default", + "knobSize": "auto", + "horizontal": true, + "pips": false, + "dashed": false, + "gradient": [], + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "sensitivity": 1, + "steps": "", + "origin": "auto", + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "onTouch": "" + } + ], + "tabs": [] + }, + { + "type": "panel", + "top": 320, + "left": 340, + "lock": false, + "id": "mixer/hdust/panel", + "visible": true, + "interaction": true, + "comments": "", + "width": 280, + "height": 40, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "colorBg": "auto", + "layout": "default", + "justify": "start", + "gridTemplate": "", + "contain": true, + "scroll": true, + "innerPadding": true, + "tabsPosition": "top", + "variables": "@{parent.variables}", + "traversing": false, + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "widgets": [ + { + "type": "fader", + "top": 0, + "left": 0, + "lock": false, + "id": "mixer/hdust/volume/master", + "visible": true, + "interaction": true, + "comments": "", + "width": 270, + "height": 30, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "design": "default", + "knobSize": "auto", + "horizontal": true, + "pips": false, + "dashed": false, + "gradient": [], + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "sensitivity": 1, + "steps": "", + "origin": "auto", + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "onTouch": "" + } + ], + "tabs": [] + }, + { + "type": "file", + "top": 380, + "left": 290, + "lock": false, + "id": "sampler", + "visible": true, + "interaction": true, + "comments": "", + "width": 120, + "height": 40, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "align": "center", + "hidePath": true, + "mode": "open", + "directory": "/home/mwinter/Sketches/seeds_and_ledgers/alot_recs/", + "extension": "*", + "allowDir": false, + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "" + }, + { + "type": "panel", + "top": 380, + "left": 0, + "lock": false, + "id": "mixer/sampler/panel", + "visible": true, + "interaction": true, + "comments": "", + "width": 280, + "height": 40, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "colorBg": "auto", + "layout": "default", + "justify": "start", + "gridTemplate": "", + "contain": true, + "scroll": true, + "innerPadding": true, + "tabsPosition": "top", + "variables": "@{parent.variables}", + "traversing": false, + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "widgets": [ + { + "type": "fader", + "top": 0, + "left": 0, + "lock": false, + "id": "mixer/sampler/volume/master", + "visible": true, + "interaction": true, + "comments": "", + "width": 270, + "height": 30, + "expand": "false", + "colorText": "auto", + "colorWidget": "auto", + "colorStroke": "auto", + "colorFill": "auto", + "alphaStroke": "auto", + "alphaFillOff": "auto", + "alphaFillOn": "auto", + "lineWidth": "auto", + "borderRadius": "auto", + "padding": "auto", + "html": "", + "css": "", + "design": "default", + "knobSize": "auto", + "horizontal": true, + "pips": false, + "dashed": false, + "gradient": [], + "snap": false, + "spring": false, + "doubleTap": false, + "range": { + "min": 0, + "max": 1 + }, + "logScale": false, + "sensitivity": 1, + "steps": "", + "origin": "auto", + "value": "", + "default": "", + "linkId": "", + "address": "auto", + "preArgs": "", + "typeTags": "", + "decimals": 2, + "target": "", + "ignoreDefaults": false, + "bypass": false, + "onCreate": "", + "onValue": "", + "onTouch": "" + } + ], + "tabs": [] } ], "tabs": [] diff --git a/supercollider/seeds_and_ledgers_main.scd b/supercollider/seeds_and_ledgers_main.scd index d476e20..1b05aa0 100644 --- a/supercollider/seeds_and_ledgers_main.scd +++ b/supercollider/seeds_and_ledgers_main.scd @@ -762,8 +762,13 @@ OSCdef(\transport, {arg msg, time, addr, port; ) ( +//synthdefs ~stringModelBusArray = 4.collect({Bus.audio(s, 1)}); ~sineBusArray = 4.collect({Bus.audio(s, 1)}); +~bassBusArray = 1.collect({Bus.audio(s, 1)}); +~hdustBusArray = 1.collect({Bus.audio(s, 1)}); +~samplerBusArray = 2.collect({Bus.audio(s, 1)}); +~sBuf = Buffer.alloc(s, 10, 2); SynthDef(\string_model, {arg freq, gate = 1, sustain, amp, dur, busIndex = 0; var trig, exc, sig1, sig2, noHarms; noHarms = 30; @@ -783,28 +788,74 @@ SynthDef(\sine, {arg freq, gate = 1, sustain, amp, dur, busIndex = 0; }).add; SynthDef(\mixer, {arg freq, gate = 1, sustain, amp, dur, out; - var inputStringModel, inputSine, sig; - inputStringModel = ~stringModelBusArray.collect({arg bus, c; In.ar(bus, 1) * NamedControl.kr(\string_volume_ ++ c, 1, 0.1)}); - inputStringModel = inputStringModel.collect({arg channel, c; Pan2.ar(channel, NamedControl.kr(\string_pan_ ++ c, 1, 0.1) * 2 - 1)}); - inputStringModel = inputStringModel.collect({arg channel, c; channel * NamedControl.kr(\string_mute_ ++ c, 1, 0.1)}); - inputStringModel = Mix.ar(inputStringModel) * NamedControl.kr(\string_volume_master, 1, 0.1); - - inputSine = ~sineBusArray.collect({arg bus, c; In.ar(bus, 1) * NamedControl.kr(\sine_volume_ ++ c, 1, 0.1)}); - inputSine = inputSine.collect({arg channel, c; Pan2.ar(channel, NamedControl.kr(\sine_pan_ ++ c, 1, 0.1) * 2 - 1)}); - inputSine = inputSine.collect({arg channel, c; channel * NamedControl.kr(\sine_mute_ ++ c, 1, 0.1)}); - inputSine = Mix.ar(inputSine) * NamedControl.kr(\sine_volume_master, 1, 0.1); - - sig = Mix.ar([inputStringModel, inputSine] / 2); - Out.ar(0, sig) + var nameSpaces, sigs; + + sigs = [~stringModelBusArray, ~sineBusArray, ~bassBusArray, ~hdustBusArray, ~samplerBusArray].collect({arg busArray, i; + var nameSpace, sig; + nameSpace = ['string', 'sine', 'bass', 'hdust', 'sampler'][i]; + sig = busArray.collect({arg bus, c; In.ar(bus, 1) * NamedControl.kr(\ ++ nameSpace ++ '_volume_' ++ c, 1, 0.1)}); + sig = sig.collect({arg channel, c; Pan2.ar(channel, NamedControl.kr(\ ++ nameSpace ++ '_pan_' ++ c, i / (busArray.size - 1), 0.1) * 2 - 1)}); + sig = sig.collect({arg channel, c; channel * NamedControl.kr(\ ++ nameSpace ++ '_mute_' ++ c, 1, 0.1)}); + sig = Mix.ar(sig) * NamedControl.kr(\ ++ nameSpace ++ '_volume_master', 1, 0.1); + }); + + sigs = Mix.ar(sigs / 4); + Out.ar(0, sigs) +}).add; + +SynthDef(\bass, { + var switches, drone; + switches = {|i| Dust.kr(0.1)} ! 9; + drone = {|i| var harm = pow(2, 2 - (i / 3).trunc), amp = (1 / pow(harm, 2)); + SinOsc.ar(60 * harm + TRand.kr(-3, 3, switches[i]), 0, amp)} ! 9; + Out.ar(~bassBusArray[0], Mix.new(drone) * 0.2); }).add; + +SynthDef(\sampler, { + Out.ar(~samplerBusArray, PlayBuf.ar(2, ~sBuf, BufRateScale.kr(~sBuf), doneAction: 2)) +}).add; + +// main routine +SynthDef(\hdust, { + arg gate = 0; + var hierarchical_dust, low_sine, high_sine, brown_noise, white_noise; + // this triggers the combinations of sources + // it is similar to the Supercollider UGen called dust but with a hierarchical structure + hierarchical_dust = ( + TIRand.kr(0, 1, Impulse.kr(100)) * + TIRand.kr(0, 1, Impulse.kr(10)) * + TIRand.kr(0, 1, Impulse.kr(1)) * + TIRand.kr(0, 1, Impulse.kr(0.1)) + ); + // adjust the multiplier at the end of each line for adjusting levels + // note with each trigger, each source has a 1 in 3 chance of sounding + low_sine = SinOsc.ar(76.midicps / 16) * (TIRand.kr(0, 2, hierarchical_dust) < 1) * 0.1; + high_sine = SinOsc.ar(76.midicps * 8) * (TIRand.kr(0, 2, hierarchical_dust) < 1) * 0.01; + brown_noise = BrownNoise.ar() * (TIRand.kr(0, 2, hierarchical_dust) < 1) * 0.025; + white_noise = WhiteNoise.ar() * (TIRand.kr(0, 2, hierarchical_dust) < 1) * 0.02; + Out.ar(~hdustBusArray[0], + ((low_sine + high_sine + brown_noise + white_noise) ) + ); +}).add; + ) ( -var mixer; +var bass, hdust, sampler, mixer; +bass = Synth.tail(~group, \bass); +hdust = Synth.tail(~group, \hdust); +sampler = Synth.head(~group, \sampler); mixer = Synth.tail(~group, \mixer); OSCdef(\mixer, {arg msg, time, addr, port; mixer.set((msg[1] ++ '_' ++ msg[2] ++ '_' ++ msg[3]), msg[4]) }, \mixer); + +OSCdef(\sampler, {arg msg, time, addr, port; + msg.postln; + sampler.free; + ~sBuf.free; + ~sBuf = Buffer.read(s, msg[1].asString.postln, action: {sampler = Synth.head(~group, \sampler)}); +}, \sampler); ) /* old something