commit 2020.06.04.01.02

main
Michael Winter 5 years ago
parent 25dcd73203
commit 582c7b280b

@ -3,14 +3,14 @@
~generateGUI = { ~generateGUI = {
var win, clockStringFunc, metronomeStringFunc, metronomeColorFunc, masterView, faderView, tabs; var win, clockStringFunc, metronomeStringFunc, metronomeColorFunc, masterView, faderView, tabs;
var tabButtonReset, transportButton, mixerButton, startPos = 0; var tabButtonReset, transportButton, mixerButton, startPos = 0;
var partAbbr = ["guitar", "accompHigh", "accomLow", "interlude"]; var partAbbr = ["guitar", "accompHigh", "accompLowLower", "accompLowUpper", "interlude"];
var trackNames = ["guitar", "high", "low", "interlude"]; var trackNames = ["guitar", "high", "low 1", "low 2", "interlude"];
var partVols, partMutes, partPans; var partVols, partMutes, partPans;
var masterMute, masterVol; var masterMute, masterVol;
partVols = [1, 1, 1, 1]; partVols = [1, 1, 1, 1, 1];
partMutes = [1, 1, 1, 1]; partMutes = [1, 1, 1, 1, 1];
partPans = [0, 0, 0, 0]; partPans = [0, 0, 0, 0, 0];
masterMute = 1; masterMute = 1;
masterVol = 1; masterVol = 1;
@ -40,7 +40,8 @@
win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 500), false).front; win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 500), false).front;
masterView = { masterView = {
var view, masterIndicators, master, generator, transport, ranSeed, startPosText, 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; OSCFunc({ arg msg, time;
{ {
@ -55,6 +56,32 @@
OSCFunc({ arg msg, time; {metronome.string = ""}.defer},'/measureClockReset', s.addr); 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); view = View(win);
generator = HLayout( generator = HLayout(
Button(view).states_([["generate"]]).action_({ Button(view).states_([["generate"]]).action_({
@ -69,28 +96,10 @@
nil); nil);
transport = HLayout( transport = HLayout(
prevSectionButton = Button(view).states_([["<<", Color.black]]).action_({| pState | prevSectionButton = Button(view).states_([["<<", Color.black]]).action_({| pState |
if((~currentSection - 4) >= 0, { ~updateSection.value(-4);
if(~isPlaying, {
~patterns[~currentSection].stop;
~currentSection = (~currentSection - 4).trunc(4);
~play.set(\sel, ~currentSection % 2);
~patterns[~currentSection].play(quant: 0)
},{
~currentSection = ~currentSection - 1;
})
});
}), }),
prevSubsectionButton = Button(view).states_([["<", Color.black]]).action_({| pState | prevSubsectionButton = Button(view).states_([["<", Color.black]]).action_({| pState |
if((~currentSection - 1) >= 0, { ~updateSection.value(-1);
if(~isPlaying, {
~patterns[~currentSection].stop;
~currentSection = (~currentSection - 1);
~play.set(\sel, ~currentSection % 2);
~patterns[~currentSection].play(quant: 0)
},{
~currentSection = ~currentSection - 1;
})
})
}), }),
playStopButton = Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_( 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 | nextSubsectionButton = Button(view).states_([[">", Color.black]]).action_({| pState |
if((~currentSection + 1) < ~patterns.size, { ~updateSection.value(1);
if(~isPlaying, {
~patterns[~currentSection].stop;
~currentSection = (~currentSection + 1);
~play.set(\sel, ~currentSection % 2);
~patterns[~currentSection].play(quant: 0)
},{
~currentSection = ~currentSection + 1;
})
})
}), }),
nextSectionButton = Button(view).states_([[">>", Color.black]]).action_({| pState | nextSectionButton = Button(view).states_([[">>", Color.black]]).action_({| pState |
if((~currentSection + 4) < ~patterns.size, { ~updateSection.value(4);
if(~isPlaying, {
~patterns[~currentSection].stop;
~currentSection = (~currentSection + 4).trunc(4);
~play.set(\sel, ~currentSection % 2);
~patterns[~currentSection].play(quant: 0)
},{
~currentSection = ~currentSection - 1;
})
})
}), }),
StaticText(view).string_("start time"), StaticText(view).string_("start time"),
[Slider(view, Rect(0, 0, 30, 5)).action_( [Slider(view, Rect(0, 0, 30, 5)).action_(
@ -146,6 +137,7 @@
nil); nil);
view.layout_(HLayout( view.layout_(HLayout(
[VLayout(generator, nil, [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)), HLayout(clock = StaticText(win).string_(" 1.1").font_(Font("Monaco", 200)),
StaticText(win).string_("|").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)), 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; var view, masterIndicators, trackIndicators, master, tracks;
view = View(win); view = View(win);
masterIndicators = {LevelIndicator()} ! 2; masterIndicators = {LevelIndicator()} ! 2;
trackIndicators = {LevelIndicator()} ! 4; trackIndicators = {LevelIndicator()} ! 5;
OSCFunc.new({arg msg; { OSCFunc.new({arg msg; {
{|i| masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer}, {|i| masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer},
'/masterLevels', s.addr); '/masterLevels', s.addr);
OSCFunc.new({arg msg; { 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); '/trackLevels', s.addr);
master = HLayout( master = HLayout(
@ -193,7 +185,7 @@
StaticText(view).string_(trackNames[part]).align_(\center) StaticText(view).string_(trackNames[part]).align_(\center)
), ),
nil) nil)
} ! 4; } ! 5;
view.layout_(HLayout(master, nil, *tracks))}; view.layout_(HLayout(master, nil, *tracks))};
tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; }; tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; };
win.layout = VLayout( win.layout = VLayout(

@ -1,26 +1,22 @@
( (
//busses //busses
~masterBus = Bus.audio(s, 1); ~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); ~guitarBus = Bus.audio(s, 1);
~accompHighBus = 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, { SynthDef(\masterPlayerControl, {
arg sel = 0, arg sel = 0,
masterVol = 1, masterMute = 1, masterVol = 1, masterMute = 1,
guitarVol = 1, guitarPan = 0, guitarMute = 1, guitarVol = 1, guitarPan = 0, guitarMute = 1,
accompHighVol = 1, accompHighPan = 0, accompHighMute = 1, accompHighVol = 1, accompHighPan = 0, accompHighMute = 1,
accompLowVol = 1, accompLowPan = 0, accompLowMute = 1; accompLowLowerVol = 1, accompLowLowerPan = 0, accompLowLowerMute = 1,
var guitarSig, accompHighSig, accompLowSig, accompLowUpperVol = 1, accompLowUpperPan = 0, accompLowUpperMute = 1;
guitarSigPanned, accompHighSigPanned, accompLowSigPanned, var guitarSig, accompHighSig, accompLowLowerSig, accompLowUpperSig,
guitarSigPanned, accompHighSigPanned, accompLowLowerSigPanned, accompLowUpperSigPanned,
masterSig, imp; masterSig, imp;
//guitarSig = SelectX.ar(sel, [In.ar(~guitarBusA), In.ar(~guitarBusB)]) * guitarVol; //guitarSig = SelectX.ar(sel, [In.ar(~guitarBusA), In.ar(~guitarBusB)]) * guitarVol;
@ -30,17 +26,24 @@ SynthDef(\masterPlayerControl, {
guitarSig = In.ar(~guitarBus) * guitarVol; guitarSig = In.ar(~guitarBus) * guitarVol;
accompHighSig = In.ar(~accompHighBus) * accompHighVol; accompHighSig = In.ar(~accompHighBus) * accompHighVol;
//accompLowSig = SelectX.ar(sel, [In.ar(~accompLowBusA), In.ar(~accompLowBusB)]) * accompLowVol; //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(~accompLowUpperBusA) * 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(~accompLowUpperBusB) * EnvGen.kr(Env.asr(0.001, 1, 0.1), sel)
] ]
) * accompLowVol; ) * accompLowUpperVol;
guitarSigPanned = Pan2.ar(guitarSig * guitarMute, guitarPan); guitarSigPanned = Pan2.ar(guitarSig * guitarMute, guitarPan);
accompHighSigPanned = Pan2.ar(accompHighSig * accompHighMute, accompHighPan); accompHighSigPanned = Pan2.ar(accompHighSig * accompHighMute, accompHighPan);
accompLowSigPanned = Pan2.ar(accompLowSig * accompLowMute, accompLowPan); accompLowLowerSigPanned = Pan2.ar(accompLowLowerSig * accompLowLowerMute, accompLowLowerPan);
masterSig = Mix.ar([guitarSigPanned, accompHighSigPanned, accompLowSigPanned]) * masterVol * masterMute; accompLowUpperSigPanned = Pan2.ar(accompLowUpperSig * accompLowUpperMute, accompLowUpperPan);
masterSig = Mix.ar([guitarSigPanned, accompHighSigPanned, accompLowLowerSigPanned, accompLowUpperSigPanned]) * masterVol * masterMute;
Out.ar(0, masterSig); Out.ar(0, masterSig);
@ -50,7 +53,13 @@ SynthDef(\masterPlayerControl, {
values: [Amplitude.kr(masterSig)]); values: [Amplitude.kr(masterSig)]);
SendReply.kr(imp, SendReply.kr(imp,
'/trackLevels', '/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; }).add;
@ -74,26 +83,14 @@ SynthDef(\karplus, {arg freq, gate = 1, amp = 0.5, bus;
//~~~~accompaniment //~~~~accompaniment
SynthDef(\accompBass, {arg freq1 = 100, freq2 = 100, gate = 1, amp = 0.5, bus, cutoff = 0; SynthDef(\accompBass, {arg freq1 = 100, freq2 = 100, gate = 1, amp = 0.5, busLower, busUpper, cutoff = 0;
var bassDrop; var env, lower, upper;
bassDrop = Mix.ar( env = EnvGen.kr(Env.perc(0.1, 10, level: amp), Impulse.kr(0) + Changed.kr(freq2));
[ lower = SinOsc.ar(freq1, 0, 0.5) * env;
SinOsc.ar(freq1, 0, 0.5), upper = SinOsc.ar(freq2, 0, 0.5) * env;
/*
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));
//EnvGen.kr(Env.cutoff(0.1, level: amp), cutoff); //EnvGen.kr(Env.cutoff(0.1, level: amp), cutoff);
Out.ar(bus, bassDrop) Out.ar(busLower, lower);
Out.ar(busUpper, upper)
}).add; }).add;
@ -135,11 +132,7 @@ SynthDef(\droneOut, {arg gate, bus;
OSCFunc({ arg msg, time; OSCFunc({ arg msg, time;
if((~currentSection + 1) < ~patterns.size, { {~updateSection.value(1, false)}.defer;
~currentSection = ~currentSection + 1;
~play.set(\sel, ~currentSection % 2);
~patterns[~currentSection].play(quant: 0)
})
},'/playNextSubsection', s.addr); },'/playNextSubsection', s.addr);
//~~~~gen music //~~~~gen music
@ -254,7 +247,8 @@ OSCFunc({ arg msg, time;
\freq2, Pseq(accompLowSecSeq.slice(nil, 1)), \freq2, Pseq(accompLowSecSeq.slice(nil, 1)),
\dur, Pseq(accompLowSecSeq.slice(nil, 2)) * tempo, \dur, Pseq(accompLowSecSeq.slice(nil, 2)) * tempo,
//\cutoff, Pseq(accompLowSecSeq.drop(-1).size.collect({0}).add(1)), //\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) //\bus, ~accompLowBus)
}, { }, {
Pmono( Pmono(
@ -264,7 +258,8 @@ OSCFunc({ arg msg, time;
\freq2, Pseq([accompLowSecSeq[0][1]]), \freq2, Pseq([accompLowSecSeq[0][1]]),
\dur, Pseq([accompLowSecSeq[0][2]]) * tempo, \dur, Pseq([accompLowSecSeq[0][2]]) * tempo,
//\cutoff, Pseq(accompLowSecSeq.drop(-1).size.collect({0}).add(1)), //\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) //\bus, ~accompLowBus)
}), }),
Pbind( Pbind(

Loading…
Cancel
Save