diff --git a/supercollider/cicc_gui.scd b/supercollider/cicc_gui.scd index a132f76..b55ca4f 100644 --- a/supercollider/cicc_gui.scd +++ b/supercollider/cicc_gui.scd @@ -3,14 +3,14 @@ ~generateGUI = { var win, clockStringFunc, metronomeStringFunc, metronomeColorFunc, masterView, faderView, tabs; var tabButtonReset, transportButton, mixerButton, startPos = 0; - var partAbbr = ["guitar", "accompHigh", "accomLow", "interlude"]; - var trackNames = ["guitar", "high", "low", "interlude"]; + var partAbbr = ["guitar", "accompHigh", "accompLowLower", "accompLowUpper", "interlude"]; + var trackNames = ["guitar", "high", "low 1", "low 2", "interlude"]; var partVols, partMutes, partPans; var masterMute, masterVol; - partVols = [1, 1, 1, 1]; - partMutes = [1, 1, 1, 1]; - partPans = [0, 0, 0, 0]; + partVols = [1, 1, 1, 1, 1]; + partMutes = [1, 1, 1, 1, 1]; + partPans = [0, 0, 0, 0, 0]; masterMute = 1; masterVol = 1; @@ -40,7 +40,8 @@ win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 500), false).front; masterView = { var view, masterIndicators, master, generator, transport, ranSeed, startPosText, - prevSectionButton, prevSubsectionButton, playStopButton, nextSubsectionButton, nextSectionButton, clock, metronome; + prevSectionButton, prevSubsectionButton, playStopButton, nextSubsectionButton, nextSectionButton, + sectionDisplay, clock, metronome; OSCFunc({ arg msg, time; { @@ -55,6 +56,32 @@ OSCFunc({ arg msg, time; {metronome.string = ""}.defer},'/measureClockReset', s.addr); + ~updateSection = {arg shift, stop = true; + if(((~currentSection + shift) >= 0) && ((~currentSection + shift) < ~patterns.size), { + var section, subSection; + if(~isPlaying, { + if(stop, {~patterns[~currentSection].stop}); + }); + ~currentSection = (~currentSection + shift).trunc(shift.abs); + section = ((~currentSection / 4) + 1).asInteger; + subSection = ((~currentSection % 4) + 1).asInteger; + sectionDisplay.string = "section: " ++ section.asString ++ "." ++ subSection.asString; + if(~isPlaying, { + ~play.set(\sel, ~currentSection % 2); + ~patterns[~currentSection].play(quant: 0) + }, { + /* + var measure, beat; + measure = 1; + beat = 1; + clock.string = clockStringFunc.value(measure, beat); + metronome.stringColor = metronomeColorFunc.value(beat); + metronome.string = metronomeStringFunc.value(beat); + */ + }); + }); + }; + view = View(win); generator = HLayout( Button(view).states_([["generate"]]).action_({ @@ -69,28 +96,10 @@ nil); transport = HLayout( prevSectionButton = Button(view).states_([["<<", Color.black]]).action_({| pState | - if((~currentSection - 4) >= 0, { - if(~isPlaying, { - ~patterns[~currentSection].stop; - ~currentSection = (~currentSection - 4).trunc(4); - ~play.set(\sel, ~currentSection % 2); - ~patterns[~currentSection].play(quant: 0) - },{ - ~currentSection = ~currentSection - 1; - }) - }); + ~updateSection.value(-4); }), prevSubsectionButton = Button(view).states_([["<", Color.black]]).action_({| pState | - if((~currentSection - 1) >= 0, { - if(~isPlaying, { - ~patterns[~currentSection].stop; - ~currentSection = (~currentSection - 1); - ~play.set(\sel, ~currentSection % 2); - ~patterns[~currentSection].play(quant: 0) - },{ - ~currentSection = ~currentSection - 1; - }) - }) + ~updateSection.value(-1); }), playStopButton = Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_( /* @@ -112,28 +121,10 @@ } ), nextSubsectionButton = Button(view).states_([[">", Color.black]]).action_({| pState | - if((~currentSection + 1) < ~patterns.size, { - if(~isPlaying, { - ~patterns[~currentSection].stop; - ~currentSection = (~currentSection + 1); - ~play.set(\sel, ~currentSection % 2); - ~patterns[~currentSection].play(quant: 0) - },{ - ~currentSection = ~currentSection + 1; - }) - }) + ~updateSection.value(1); }), nextSectionButton = Button(view).states_([[">>", Color.black]]).action_({| pState | - if((~currentSection + 4) < ~patterns.size, { - if(~isPlaying, { - ~patterns[~currentSection].stop; - ~currentSection = (~currentSection + 4).trunc(4); - ~play.set(\sel, ~currentSection % 2); - ~patterns[~currentSection].play(quant: 0) - },{ - ~currentSection = ~currentSection - 1; - }) - }) + ~updateSection.value(4); }), StaticText(view).string_("start time"), [Slider(view, Rect(0, 0, 30, 5)).action_( @@ -146,6 +137,7 @@ nil); view.layout_(HLayout( [VLayout(generator, nil, + sectionDisplay = StaticText(win).string_("section: 1.1").font_(Font("Monaco", 70)), HLayout(clock = StaticText(win).string_(" 1.1").font_(Font("Monaco", 200)), StaticText(win).string_("|").font_(Font("Monaco", 200)), metronome = StaticText(win).string_([-30, -105, -104].asAscii).font_(Font("Monaco", 300)).stringColor_(Color.red)), @@ -155,13 +147,13 @@ var view, masterIndicators, trackIndicators, master, tracks; view = View(win); masterIndicators = {LevelIndicator()} ! 2; - trackIndicators = {LevelIndicator()} ! 4; + trackIndicators = {LevelIndicator()} ! 5; OSCFunc.new({arg msg; { {|i| masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer}, '/masterLevels', s.addr); OSCFunc.new({arg msg; { - {|i| trackIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 4}.defer}, + {|i| trackIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 5}.defer}, '/trackLevels', s.addr); master = HLayout( @@ -193,7 +185,7 @@ StaticText(view).string_(trackNames[part]).align_(\center) ), nil) - } ! 4; + } ! 5; view.layout_(HLayout(master, nil, *tracks))}; tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; }; win.layout = VLayout( diff --git a/supercollider/cicc_sonifier.scd b/supercollider/cicc_sonifier.scd index 4326f09..c73d6fc 100644 --- a/supercollider/cicc_sonifier.scd +++ b/supercollider/cicc_sonifier.scd @@ -1,26 +1,22 @@ ( //busses ~masterBus = Bus.audio(s, 1); -~guitarBusA = Bus.audio(s, 1); -~guitarBusB = Bus.audio(s, 1); -~accompHighBusA = Bus.audio(s, 1); -~accompHighBusB = Bus.audio(s, 1); -~accompLowBusA = Bus.audio(s, 1); -~accompLowBusB = Bus.audio(s, 1); - ~guitarBus = Bus.audio(s, 1); ~accompHighBus = Bus.audio(s, 1); -~accompLowBus = Bus.audio(s, 1); - +~accompLowLowerBusA = Bus.audio(s, 1); +~accompLowUpperBusA = Bus.audio(s, 1); +~accompLowLowerBusB = Bus.audio(s, 1); +~accompLowUpperBusB = Bus.audio(s, 1); SynthDef(\masterPlayerControl, { arg sel = 0, masterVol = 1, masterMute = 1, guitarVol = 1, guitarPan = 0, guitarMute = 1, accompHighVol = 1, accompHighPan = 0, accompHighMute = 1, - accompLowVol = 1, accompLowPan = 0, accompLowMute = 1; - var guitarSig, accompHighSig, accompLowSig, - guitarSigPanned, accompHighSigPanned, accompLowSigPanned, + accompLowLowerVol = 1, accompLowLowerPan = 0, accompLowLowerMute = 1, + accompLowUpperVol = 1, accompLowUpperPan = 0, accompLowUpperMute = 1; + var guitarSig, accompHighSig, accompLowLowerSig, accompLowUpperSig, + guitarSigPanned, accompHighSigPanned, accompLowLowerSigPanned, accompLowUpperSigPanned, masterSig, imp; //guitarSig = SelectX.ar(sel, [In.ar(~guitarBusA), In.ar(~guitarBusB)]) * guitarVol; @@ -30,17 +26,24 @@ SynthDef(\masterPlayerControl, { guitarSig = In.ar(~guitarBus) * guitarVol; accompHighSig = In.ar(~accompHighBus) * accompHighVol; //accompLowSig = SelectX.ar(sel, [In.ar(~accompLowBusA), In.ar(~accompLowBusB)]) * accompLowVol; - accompLowSig = Mix.ar( + accompLowLowerSig = Mix.ar( + [ + In.ar(~accompLowLowerBusA) * EnvGen.kr(Env.asr(0.001, 1, 0.1), (sel + 1) % 2), + In.ar(~accompLowLowerBusB) * EnvGen.kr(Env.asr(0.001, 1, 0.1), sel) + ] + ) * accompLowLowerVol; + accompLowUpperSig = Mix.ar( [ - In.ar(~accompLowBusA) * EnvGen.kr(Env.asr(0.001, 1, 0.1), (sel + 1) % 2), - In.ar(~accompLowBusB) * EnvGen.kr(Env.asr(0.001, 1, 0.1), sel) + In.ar(~accompLowUpperBusA) * EnvGen.kr(Env.asr(0.001, 1, 0.1), (sel + 1) % 2), + In.ar(~accompLowUpperBusB) * EnvGen.kr(Env.asr(0.001, 1, 0.1), sel) ] - ) * accompLowVol; + ) * accompLowUpperVol; guitarSigPanned = Pan2.ar(guitarSig * guitarMute, guitarPan); accompHighSigPanned = Pan2.ar(accompHighSig * accompHighMute, accompHighPan); - accompLowSigPanned = Pan2.ar(accompLowSig * accompLowMute, accompLowPan); - masterSig = Mix.ar([guitarSigPanned, accompHighSigPanned, accompLowSigPanned]) * masterVol * masterMute; + accompLowLowerSigPanned = Pan2.ar(accompLowLowerSig * accompLowLowerMute, accompLowLowerPan); + accompLowUpperSigPanned = Pan2.ar(accompLowUpperSig * accompLowUpperMute, accompLowUpperPan); + masterSig = Mix.ar([guitarSigPanned, accompHighSigPanned, accompLowLowerSigPanned, accompLowUpperSigPanned]) * masterVol * masterMute; Out.ar(0, masterSig); @@ -50,7 +53,13 @@ SynthDef(\masterPlayerControl, { values: [Amplitude.kr(masterSig)]); SendReply.kr(imp, '/trackLevels', - values: [Amplitude.kr(guitarSig), Amplitude.kr(accompHighSig), Amplitude.kr(accompLowSig), DC.ar(0)]); + values: + [ + Amplitude.kr(guitarSig), Amplitude.kr(accompHighSig), + Amplitude.kr(accompLowLowerSig), Amplitude.kr(accompLowUpperSig), + DC.ar(0) + ] + ); }).add; @@ -74,26 +83,14 @@ SynthDef(\karplus, {arg freq, gate = 1, amp = 0.5, bus; //~~~~accompaniment -SynthDef(\accompBass, {arg freq1 = 100, freq2 = 100, gate = 1, amp = 0.5, bus, cutoff = 0; - var bassDrop; - bassDrop = Mix.ar( - [ - SinOsc.ar(freq1, 0, 0.5), - /* - Select.ar(((freq2 - freq1).poll < 1.1).poll, - [ - SinOsc.ar(freq2, 0, 0.5), - SinOsc.ar((freq1 + - (EnvGen.kr(Env.cutoff(10), Impulse.kr(0) + Changed.kr(freq2)) * (freq2 - freq1))).poll, 0, 0.5) - ] - ); - */ - SinOsc.ar(freq2, 0, 0.5) - ] - ) * - EnvGen.kr(Env.perc(0.1, 10, level: amp), Impulse.kr(0) + Changed.kr(freq2)); +SynthDef(\accompBass, {arg freq1 = 100, freq2 = 100, gate = 1, amp = 0.5, busLower, busUpper, cutoff = 0; + var env, lower, upper; + env = EnvGen.kr(Env.perc(0.1, 10, level: amp), Impulse.kr(0) + Changed.kr(freq2)); + lower = SinOsc.ar(freq1, 0, 0.5) * env; + upper = SinOsc.ar(freq2, 0, 0.5) * env; //EnvGen.kr(Env.cutoff(0.1, level: amp), cutoff); - Out.ar(bus, bassDrop) + Out.ar(busLower, lower); + Out.ar(busUpper, upper) }).add; @@ -135,11 +132,7 @@ SynthDef(\droneOut, {arg gate, bus; OSCFunc({ arg msg, time; - if((~currentSection + 1) < ~patterns.size, { - ~currentSection = ~currentSection + 1; - ~play.set(\sel, ~currentSection % 2); - ~patterns[~currentSection].play(quant: 0) - }) + {~updateSection.value(1, false)}.defer; },'/playNextSubsection', s.addr); //~~~~gen music @@ -254,7 +247,8 @@ OSCFunc({ arg msg, time; \freq2, Pseq(accompLowSecSeq.slice(nil, 1)), \dur, Pseq(accompLowSecSeq.slice(nil, 2)) * tempo, //\cutoff, Pseq(accompLowSecSeq.drop(-1).size.collect({0}).add(1)), - \bus, if(secIndex % 2 == 0, {~accompLowBusA.index}, {~accompLowBusB.index})) + \busLower, if(secIndex % 2 == 0, {~accompLowLowerBusA.index}, {~accompLowLowerBusB.index}), + \busUpper, if(secIndex % 2 == 0, {~accompLowUpperBusA.index}, {~accompLowUpperBusB.index})) //\bus, ~accompLowBus) }, { Pmono( @@ -264,7 +258,8 @@ OSCFunc({ arg msg, time; \freq2, Pseq([accompLowSecSeq[0][1]]), \dur, Pseq([accompLowSecSeq[0][2]]) * tempo, //\cutoff, Pseq(accompLowSecSeq.drop(-1).size.collect({0}).add(1)), - \bus, if(secIndex % 2 == 0, {~accompLowBusA.index}, {~accompLowBusB.index})) + \busLower, if(secIndex % 2 == 0, {~accompLowLowerBusA.index}, {~accompLowLowerBusB.index}), + \busUpper, if(secIndex % 2 == 0, {~accompLowUpperBusA.index}, {~accompLowUpperBusB.index})) //\bus, ~accompLowBus) }), Pbind(