From 8726241d91cf754dc2b7aa8b78b2405eac26f8b1 Mon Sep 17 00:00:00 2001 From: mwinter Date: Wed, 13 Jan 2021 19:25:54 +0100 Subject: [PATCH] master track working and save preset plumbing in place --- supercollider/tkam_gui.scd | 79 +++++++++++++------ supercollider/tkam_musical_data_generator.scd | 2 +- supercollider/tkam_readme.scd | 20 +++++ supercollider/tkam_sonifier.scd | 4 +- 4 files changed, 79 insertions(+), 26 deletions(-) create mode 100644 supercollider/tkam_readme.scd diff --git a/supercollider/tkam_gui.scd b/supercollider/tkam_gui.scd index 4f17f0f..795ca00 100644 --- a/supercollider/tkam_gui.scd +++ b/supercollider/tkam_gui.scd @@ -1,7 +1,7 @@ ( var clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSubsection, buildGenerator, buildMetronome, updateSection, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader, -masterView, faderView, currentSection = 1, currentSubsection = 1; +masterView, faderView, helpView, currentSection = 1, currentSubsection = 1; // these funcs update the elements of the transport panel clockStringFunc = { @@ -162,44 +162,55 @@ buildTempoControl = {arg view; }; -buildMasterFader = {arg view, masterVol, masterMute, masterIndicators; - HLayout([ +buildMasterFader = {arg view; + var trackIndicators, layout, volSlider, muteButton; + + trackIndicators = {LevelIndicator()} ! 2; + + OSCFunc.new({arg msg; + {trackIndicators[0].value = msg[3].ampdb.linlin(-50, 0, 0, 1)}.defer; + {trackIndicators[1].value = msg[4].ampdb.linlin(-50, 0, 0, 1)}.defer + }, '/masterLevels_' ++ ~hash, s.addr); + + layout = HLayout([ VLayout( HLayout( - Slider(view).value_(0.8).action_( - {arg v; masterVol = v.value * 1.25; ~play.set(\masterVol, masterVol)}.inEnvir), - masterIndicators[0], - masterIndicators[1]), - Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_( - {arg v; masterMute = (1 - v.value).abs; ~play.set(\masterMute, masterMute)}.inEnvir), + volSlider = Slider(view).value_(0.8).action_( + {arg v; var masterVol = v.value * 1.25; ~play.set(\masterVol, masterVol)}.inEnvir), + trackIndicators[0], + 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_("master").align_(\center) - ), stretch: 2], nil) + ), stretch: 2], nil); + [layout, volSlider, muteButton] }; -buildTrackFader = {arg view, name, index, initVal; - var trackIndicator; +buildTrackFader = {arg view, name, index; + var trackIndicator, layout, volSlider, muteButton, panKnob; trackIndicator = LevelIndicator(); OSCFunc.new({arg msg; {trackIndicator.value = msg[3].ampdb.linlin(-50, 0, 0, 1)}.defer}, '/trackLevel_' ++ index ++ "_" ++ ~hash, s.addr); - HLayout( + layout = HLayout( VLayout( HLayout( - Slider(view).value_(0.8).action_( + volSlider = Slider(view).value_(0.8).action_( {arg v; var vol = v.value * 1.25; ~play.set(\vol_ ++ index, vol)}.inEnvir), trackIndicator), - 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_(initVal), + 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), VLayout( StaticText(view).string_("pan").align_(\center), - 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).value_(0.5) ), StaticText(view).string_(name).align_(\center) ), - nil) + nil); + [layout, volSlider, muteButton, panKnob] }; @@ -231,7 +242,7 @@ masterView = {arg win, preampBusses, accompBusses, postampBusses; faderView = {arg win; - var view, masterIndicators, trackIndicators, master, tracks; + var view, masterIndicators, trackIndicators, master, tracks, openButton, saveButton; var partAbbr = ["*", "III", "II", "I", "accomp_I", "accomp_II", "click"]; var trackNames = ["*", "III", "II", "I", "accomp_I", "accomp_II", "click"]; var partVols, partMutes, partPans; @@ -248,11 +259,33 @@ faderView = {arg win; masterIndicators = {LevelIndicator()} ! 2; trackIndicators = {LevelIndicator()} ! 6; - master = buildMasterFader.value(view, masterVol, masterMute, masterIndicators); + master = buildMasterFader.value(view); tracks = {arg part; - buildTrackFader.value(view, trackNames[part], part, 0); + buildTrackFader.value(view, trackNames[part], part); } ! 7; - view.layout_(HLayout(master, nil, *tracks)) + + openButton = Button(view).states_([["open", Color.black]]).action_({ + Dialog.openPanel({ arg path; + path.postln; + },{ + "cancelled".postln; + }); + }); + + saveButton = Button(view).states_([["save", Color.black]]).action_({ + Dialog.savePanel({ arg path; + path.postln; + },{ + "cancelled".postln; + }); + }); + + view.layout_(HLayout(HLayout(master[0], nil, *tracks.slice(nil, 0)), VLayout(nil, openButton, saveButton))) +}; + + +helpView = {arg win; + TextView(win).string_(File.readAllString(~dir +/+ "tkam_readme.scd")).editable_(false); }; @@ -274,6 +307,6 @@ faderView = {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*/)); + tabs = StackLayout(masterView.value(win, preampBusses, accompBusses, postampBusses), faderView.value(win), helpView.value(win))); }; ) diff --git a/supercollider/tkam_musical_data_generator.scd b/supercollider/tkam_musical_data_generator.scd index 0e23276..da64e24 100644 --- a/supercollider/tkam_musical_data_generator.scd +++ b/supercollider/tkam_musical_data_generator.scd @@ -429,7 +429,7 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type; thisThread.randSeed = seed.postln; - # totalDur, section1Dur, dUnit, curLen, cadence, ultimate = [6 * 60, 2 * 60, 8.reciprocal, 0, false, false]; + # totalDur, section1Dur, dUnit, curLen, cadence, ultimate = [2 * 60, 1 * 60, 8.reciprocal, 0, false, false]; # totalLen, section1Len = [(totalDur / dUnit).round(16), (section1Dur / dUnit).round(16)]; # modeState, temporalState, partStates = [initModeState.value, initTemporalState.value, initPartStates.value]; # lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [nil, modeState.deepCopy, 0]; diff --git a/supercollider/tkam_readme.scd b/supercollider/tkam_readme.scd new file mode 100644 index 0000000..fb0c5d4 --- /dev/null +++ b/supercollider/tkam_readme.scd @@ -0,0 +1,20 @@ +/* +~~~~execute +Excecute tkam_main.scd to run. + + +~~~~transport tab +The play button will always start from the beginning of the current section. + +The transport buttons allow you to advance by subsection (<,>) and section (<<,>>). + +Tempo change will only go into effect once "set tempo" button is pressed. + +Setting the address:port will create a pipe to recieve a message to advance the subsection externally with an OSC message '/nextSubsection. This could be used to set up a foot pedal / controller for the guitarist to advance the subsections manually. + +The default seed given in the application and reseeded when the "reset seed" button is pressed will generate the default music and score (as provided). Changing the seed will generate a new version with that seed once the "generate" button is pressed. After the new version is generated, new Lilypond files can be generated by pressing the "transcribe" button. This will create a cicc_score.ly file in a folder labeled "seed_[number]" which can be rendered by Lilypond. Note that the file must be rendered from that location as it dependes in files in that folder and the "includes" subfolder. + + +~~~~mixer tab +This allow invidual control of each of the sonic elements. The synthesized guitar part is automatically muted is at should only be used for audition and practice. The low accompaniment has two separate tracks in case a performer cannot play both the notes. The sonification will go to outputs 1 and 2 while the click will go to outputs 3 and 4. +*/ \ No newline at end of file diff --git a/supercollider/tkam_sonifier.scd b/supercollider/tkam_sonifier.scd index ab281fe..b777453 100644 --- a/supercollider/tkam_sonifier.scd +++ b/supercollider/tkam_sonifier.scd @@ -18,8 +18,8 @@ var formatPatternData; var 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.5, 0.1))}); - masterSig = Mix.ar(sigsPanned.drop(-1)) * NamedControl.kr("vol_master" ++ i, 1, 0.1) * NamedControl.kr("mute_master" ++ 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); Out.ar(0, masterSig); Out.ar(2, sigsPanned.last); //change this if you want the click to go somewhere else