fixing rising start point bug; added routing for soundcard; tempo save; change attack to sustain in accomp

main
mwinter 4 years ago
parent 3fb0e2382a
commit b6ab8e625c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,7 +1,11 @@
{
"master_volume": 0.33644859813084,
"tempo": 60,
"master_volume": 0.8,
"master_mute": 0,
"track_volumes": [0.5849582172702,0.37883008356546,0.46518105849582,0.67688022284123,0.29805013927577,0.63231197771588,0.59888579387187],
"track_mutes": [0,0,0,0,0,0,0],
"track_pans": [0.5,0.5,0.5,0.5,0.5,0.5,0.5]
"master_out": 0,
"track_volumes": [0.8,0.8,0.8,0.8,0.8,0.8,0.8],
"track_solos": [0,0,0,0,0,0,0],
"track_mutes": [1,1,1,1,0,0,0],
"track_pans": [0.5,0.5,0.5,0.5,0.5,0.5,0.5],
"track_outs": [0,0,0,0,0,0,3]
}

@ -1,7 +1,7 @@
(
var clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSubsection,
buildGenerator, buildMetronome, updateSection, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader,
masterView, faderView, helpView, currentSection = 1, currentSubsection = 1;
buildMasterView, buildFaderView, buildHelpView, currentSection = 1, currentSubsection = 1;
// these funcs update the elements of the transport panel
clockStringFunc = {
@ -154,16 +154,18 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
buildTempoControl = {arg view;
var tempo, address, updateSection;
HLayout(
tempo = TextField(view).string_("60"),
Button(view).states_([["set tempo"]]).action_({~tempoClock.tempo = tempo.string.asInteger / 60}.inEnvir),
[StaticText(view).string_(" "), stretch: 1])
var layout, tempoField, address, updateSection;
layout = HLayout(
tempoField = TextField(view).string_("60").action_({arg v;
var tempo = v.value.asInteger; ~tempoClock.tempo = tempo / 60}.inEnvir),
Button(view).states_([["set tempo"]]).action_({arg v; ~tempoClock.tempo = tempoField.string.asInteger / 60}.inEnvir),
[StaticText(view).string_(" "), stretch: 1]);
[layout, tempoField]
};
buildMasterFader = {arg view;
var trackIndicators, layout, volSlider, muteButton;
var trackIndicators, layout, volSlider, muteButton, outMenu;
trackIndicators = {LevelIndicator()} ! 2;
@ -181,15 +183,19 @@ buildMasterFader = {arg view;
trackIndicators[1]),
muteButton = Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{arg v; var masterMute = (1 - v.value).abs; ~play.set(\masterMute, masterMute)}.inEnvir),
StaticText(view).string_("out").align_(\center),
outMenu = PopUpMenu(view).items_((1..16).collect({arg o; o + "-" + (o + 1)})).action_(
{arg v; var out = v.value.postln; ~play.set(\masterOut, out)}.inEnvir),
StaticText(view).string_("master").align_(\center)
), stretch: 2], nil);
[layout, volSlider, muteButton]
[layout, volSlider, muteButton, outMenu]
};
buildTrackFader = {arg view, name, index;
var trackIndicator, layout, volSlider, muteButton, panKnob;
var trackIndicator, netAddr, layout, volSlider, soloButton, muteButton, panKnob, outMenu;
netAddr = NetAddr("127.0.0.1", NetAddr.langPort);
trackIndicator = LevelIndicator();
OSCFunc.new({arg msg; {trackIndicator.value = msg[3].ampdb.linlin(-50, 0, 0, 1)}.defer},
@ -201,27 +207,37 @@ buildTrackFader = {arg view, name, index;
volSlider = Slider(view).value_(0.8).action_(
{arg v; var vol = v.value * 1.25; ~play.set(\vol_ ++ index, vol)}.inEnvir),
trackIndicator),
soloButton = Button(view).states_([["solo", Color.black], ["solo", Color.black, Color.grey]]).action_(
{netAddr.sendMsg("/soloer_" ++ ~hash, index)}.inEnvir).value_(0),
muteButton = Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{arg v; var mute = (1 - v.value).abs; ~play.set(\mute_ ++ index, mute)}.inEnvir).value_(0),
{arg v; var mute = (1 - v.value).abs;
//netAddr.sendMsg("/muter_" ++ ~hash, index);
~play.set(\mute_ ++ index, mute)}.inEnvir).valueAction_(if(index < 4, {1}, {0})),
VLayout(
StaticText(view).string_("pan").align_(\center),
panKnob = Knob(view).action_({arg v; var pan = v.value * 2 - 1; ~play.set(\pan_ ++ index, pan)}.inEnvir).value_(0.5)
panKnob = Knob(view).action_({arg v; var pan = v.value * 2 - 1; ~play.set(\pan_ ++ index, pan)}.inEnvir).valueAction_(0.5)
),
StaticText(view).string_("out").align_(\center),
outMenu = PopUpMenu(view).items_(["master"] ++ (1..16)).action_(
{arg v; var out = v.value; ~play.set(\out_ ++ index, out)}.inEnvir).valueAction_(if(index < 6, {0}, {3})),
StaticText(view).string_(name).align_(\center)
//StaticText(view).string_("output").align_(\center),
),
nil);
[layout, volSlider, muteButton, panKnob]
[layout, volSlider, soloButton, muteButton, panKnob, outMenu]
};
masterView = {arg win, preampBusses, accompBusses, postampBusses;
var view, generatorLayout, clock, metronome, metronomeLayout, transportLayout, auxControlsLayout, countOff, ranSeed, order, tempo, sectionDisplay, address;
buildMasterView = {arg win, preampBusses, accompBusses, postampBusses;
var view, generatorLayout, clock, metronome, metronomeLayout, transportLayout,
tempoContol, auxControlsLayout, countOff, ranSeed, order, tempo, sectionDisplay, address;
view = View(win);
generatorLayout = buildGenerator.value(view);
# clock, metronome, metronomeLayout = buildMetronome.value(win);
# sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses);
auxControlsLayout = buildTempoControl.value(view);
tempoContol = buildTempoControl.value(view);
auxControlsLayout = tempoContol[0];
view.layout_(
HLayout(
@ -237,16 +253,19 @@ masterView = {arg win, preampBusses, accompBusses, postampBusses;
alignment: \top
]
)
)
);
[view, tempoContol[1]]
};
faderView = {arg win;
buildFaderView = {arg win, tempoField;
var view, masterIndicators, trackIndicators, master, tracks, openButton, basePath, saveButton;
var partAbbr = ["*", "III", "II", "I", "accomp_II", "accomp_I", "click"];
var trackNames = ["*", "III", "II", "I", "accomp_II", "accomp_I", "click"];
var partVols, partMutes, partPans;
var masterMute, masterVol;
var netAddr = NetAddr("127.0.0.1", NetAddr.langPort);
var player = ~play;
// set initial mixer values
partVols = [1, 1, 1, 1, 1, 1];
@ -264,17 +283,36 @@ faderView = {arg win;
buildTrackFader.value(view, trackNames[part], part);
} ! 7;
OSCFunc.new({arg msg; {
tracks.slice(nil, 3).do({arg mute, m;
if(tracks[msg[1]][2].value == 1, {
mute.valueAction = if(msg[1] == m, {0}, {1});
tracks[m][2].value = if(msg[1] != m, {0}, {1})
}, {
mute.valueAction = 0
});
});
}.defer}, '/soloer_' ++ ~hash, netAddr);
//OSCFunc.new({arg msg; {
//tracks.slice(nil, 2).do({arg solo, m; solo.value.postln; solo.value = 0});
//}.defer}, '/muter_' ++ ~hash, netAddr);
basePath = ~dir +/+ ".." +/+ "mixer_settings";
openButton = Button(view).states_([["open", Color.black]]).action_({
Dialog.openPanel({ arg path;
var settings;
settings = File.readAllString(path).parseJSON;
tempoField.valueAction = settings["tempo"];
master[1].valueAction = settings["master_volume"];
master[2].valueAction = settings["master_pan"];
master[3].valueAction = settings["master_out"];
settings["track_volumes"].do({arg val, v; tracks[v][1].valueAction = val});
settings["track_mutes"].do({arg val, v; tracks[v][2].valueAction = val});
settings["track_pans"].do({arg val, v; tracks[v][3].valueAction = val});
settings["track_solos"].do({arg val, v; tracks[v][2].valueAction = val});
settings["track_mutes"].do({arg val, v; tracks[v][3].valueAction = val});
settings["track_pans"].do({arg val, v; tracks[v][4].valueAction = val});
settings["track_outs"].do({arg val, v; tracks[v][5].valueAction = val});
},{}, false, basePath);
});
@ -282,11 +320,15 @@ faderView = {arg win;
Dialog.savePanel({ arg path;
var settings, file;
settings = "{\n";
settings = settings ++ "\"tempo\": " ++ tempoField.string ++ ",\n";
settings = settings ++ "\"master_volume\": " ++ master[1].value ++ ",\n";
settings = settings ++ "\"master_mute\": " ++ master[2].value ++ ",\n";
settings = settings ++ "\"master_out\": " ++ master[3].value ++ ",\n";
settings = settings ++ "\"track_volumes\": [" ++ tracks.collect({arg track; track[1].value}).join(",") ++ "],\n";
settings = settings ++ "\"track_mutes\": [" ++ tracks.collect({arg track; track[2].value}).join(",") ++ "],\n";
settings = settings ++ "\"track_pans\": [" ++ tracks.collect({arg track; track[3].value}).join(",") ++ "]\n";
settings = settings ++ "\"track_solos\": [" ++ tracks.collect({arg track; track[2].value}).join(",") ++ "],\n";
settings = settings ++ "\"track_mutes\": [" ++ tracks.collect({arg track; track[3].value}).join(",") ++ "],\n";
settings = settings ++ "\"track_pans\": [" ++ tracks.collect({arg track; track[4].value}).join(",") ++ "],\n";
settings = settings ++ "\"track_outs\": [" ++ tracks.collect({arg track; track[5].value}).join(",") ++ "]\n";
settings = settings ++ "}";
file = File(path, "w");
file.write(settings);
@ -298,15 +340,21 @@ faderView = {arg win;
};
helpView = {arg win;
buildHelpView = {arg win;
TextView(win).string_(File.readAllString(~dir +/+ "tkam_readme.scd")).editable_(false);
};
~generateGUI = {arg preampBusses, accompBusses, postampBusses;
var win, tabButtonReset, transportButton, mixerButton, helpButton, tabs;
var win, tabButtonReset, transportButton, mixerButton, helpButton, masterConrol, tempoControl, masterView, faderView, helpView, tabs;
win = Window("to kill a monarch", Rect(500, 500, 1100, 575), false).front;
tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; helpButton.value = 1};
masterConrol = buildMasterView.value(win, preampBusses, accompBusses, postampBusses);
masterView = masterConrol[0];
tempoControl = masterConrol[1];
faderView = buildFaderView.value(win, tempoControl);
helpView = buildHelpView.value(win);
win.layout = VLayout(
HLayout(
HLayout(
@ -321,6 +369,6 @@ helpView = {arg win;
helpButton = Button().states_([["help", Color.white, Color.grey], ["help", Color.black]]).action_(
{tabButtonReset.value; helpButton.value = 0; tabs.index = 2 }.inEnvir).value_(1)
),
tabs = StackLayout(masterView.value(win, preampBusses, accompBusses, postampBusses), faderView.value(win), helpView.value(win)));
tabs = StackLayout(masterView, faderView, helpView));
};
)

@ -270,7 +270,7 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
firstChange = false;
cadence = if(collectRoots.value(modeState).size == 1, {true}, {false});
lastInsRef = nil;
if(offset == 0, {cadence = false});
//if(offset == 0, {cadence = false});
ensData = [];
temporalData.do({arg val, ts;
@ -312,6 +312,8 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
//flute special case
if((partState[\index] == 0) && cadence.not, {
var mode, continue, freqRatio;
//offset.postln;
//cadence.postln;
mode = modeState.keys.asList.collect({arg fr;
[
frCollapse.value(frAdd.value(modeState[fr][\root][0], modeState[fr][\mult])),

@ -15,14 +15,17 @@ var formatPatternData;
var sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut, allSds;
sdPlayer = SynthDef(\masterPlayerControl_ ++ ~hash, {
var sigs, sigsPanned, masterSig, imp;
var router, sigs, sigsPanned, masterSig, imp;
sigs = postampBusses.collect({arg bus, i; In.ar(bus) * NamedControl.kr(\vol_ ++ i, 1, 0.1)});
sigsPanned = sigs.collect({arg sig, i; Pan2.ar(sig * NamedControl.kr(\mute_ ++ i, 1, 0.1), NamedControl.kr(\pan_ ++ i, 0, 0.1))});
masterSig = Mix.ar(sigsPanned.drop(-1)) * NamedControl.kr(\masterVol, 1, 0.1) * NamedControl.kr(\masterMute, 1, 0.1);
sigs = postampBusses.collect({arg bus, i; In.ar(bus) * NamedControl.kr(\vol_ ++ i, 1, 0.1) * NamedControl.kr(\mute_ ++ i, 1, 0.1)});
router = sigs.collect({arg sig, i; NamedControl.kr(\out_ ++ i, 0, 0)});
sigs.collect({arg sig, i; Out.ar(router[i] - 1, sig * router[i].sign)});
Out.ar(0, masterSig);
Out.ar(2, sigsPanned.last); //change this if you want the click to go somewhere else
sigsPanned = sigs.collect({arg sig, i; Pan2.ar(sig, NamedControl.kr(\pan_ ++ i, 0, 0.1))});
masterSig = Mix.ar(sigsPanned.collect({arg sig, i; sig * abs(router[i].sign - 1)}));
masterSig = masterSig * NamedControl.kr(\masterVol, 1, 0.1) * NamedControl.kr(\masterMute, 1, 0.1);
Out.ar(NamedControl.kr(\masterOut, 0, 0), masterSig);
imp = Impulse.kr(10);
SendReply.kr(imp, '/masterLevels_' ++ ~hash, values: [Amplitude.kr(masterSig)]);
@ -50,8 +53,8 @@ var formatPatternData;
Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, rel), gate, doneAction: 2))
});
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0, rel = 0.01;
Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(attack, 1, rel), gate, doneAction: 2))
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, sustain = 1, dur = 1, gate = 1, bout = 0, ampBus = 0, rel = 0.01;
Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(sustain, 1, rel), gate, doneAction: 2))
});
sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0;
@ -138,7 +141,7 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
\sustain, Pseq(musData[2] * dUnit),
\amp, Pseq(musData[3].collect({arg item; [0, 2, 4, 8][item]}) * 0.0125 * 1),
//\attack, Pseq(musData[1] * abs(musData[3].clip(0, 0.25) * 2 - 1) * dUnit),
\attack, Pseq(musData[2] * 1 * dUnit),
//\attack, Pseq(musData[2] * 1 * dUnit),
\ampBus, preampBusses[0].index,
\bout, Pseq(musData[4].collect({arg index; accompBusses[index].index})),
\rel, Pseq(musData[5])
@ -216,7 +219,7 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses);
recDur = (prePatterns[2][0].size / 8) + 10;
recDur = (prePatterns[2][0].size / 8) + 45;
score = playablePatterns.asScore(duration: recDur, timeOffset: 0.001);
nextNode = score.score.slice(nil, 1).select({arg msg; msg[0] == 9}).slice(nil, 2).maxItem + 1;

Loading…
Cancel
Save