Compare commits

..

No commits in common. "18253e6ba2dd5d54c7bb2b420b8aeeede69c2fab" and "8726241d91cf754dc2b7aa8b78b2405eac26f8b1" have entirely different histories.

19 changed files with 2668 additions and 27995 deletions

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

File diff suppressed because it is too large Load diff

View file

@ -1,171 +0,0 @@
\version "2.19.83"
#(define (override-color-for-all-grobs color)
(lambda (context)
(let loop ((x all-grob-descriptions))
(if (not (null? x))
(let ((grob-name (caar x)))
(ly:context-pushpop-property context grob-name 'color color)
(loop (cdr x)))))))
#(define-markup-command (relMark layout props mus) (ly:music?)
#:properties ((size -2))
(interpret-markup layout props
#{
\markup {
\score {
\new Staff { $mus }
\layout {
\context {
\Staff
\remove Time_signature_engraver
fontSize = #-2
\hide Stem
\override TextScript.outside-staff-priority = ##f
\override StaffSymbol.staff-space = #(magstep -2)
\override StaffSymbol.thickness = #(magstep -2)
\override TextScript.self-alignment-X = #-0.4
\override TextScript.staff-padding = #1
}
\context {
\Score
proportionalNotationDuration = #(ly:make-moment 1/16)
\remove "Separating_line_group_engraver"
\override SpacingSpanner.strict-note-spacing = ##t
\override RehearsalMark.self-alignment-X = #-1
\override RehearsalMark.Y-offset = #10
\override RehearsalMark.X-offset = #10
}
\context {
\Voice
\consists "Horizontal_bracket_engraver"
\override HorizontalBracket.direction = #UP
}
indent = 0
line-width = 4\cm
}
}
}
#}))
\paper {
#(set-paper-size "a4" 'portrait)
top-margin = 1 \cm
bottom-margin = 1 \cm
left-margin = 2 \cm
ragged-bottom = ##t
top-system-spacing =
#'((basic-distance . 15 )
(minimum-distance . 15 )
(padding . 0 )
(stretchability . 0))
system-system-spacing =
#'((basic-distance . 35 )
(minimum-distance . 35 )
(padding . 0 )
(stretchability . 0))
last-bottom-spacing =
#'((basic-distance . 10 )
(minimum-distance . 10 )
(padding . 0 )
(stretchability . 0))
%systems-per-page = 8
%max-systems-per-page = 8
first-page-number = 1
print-first-page-number = ##t
print-page-number = ##t
oddHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\pad-markup #2 { \concat {\italic {"to kill a monarch "} (seed: 19800725)}}}}}}
evenHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\pad-markup #2 { \concat {\italic {"to kill a monarch "} (seed: 19800725)}}}}}}
oddFooterMarkup = \markup { \fill-line {
\concat {
"-"
\fontsize #1.5
\on-the-fly #print-page-number-check-first
\fromproperty #'page:page-number-string
"-"}}}
evenFooterMarkup = \markup { \fill-line {
\concat {
"-"
\fontsize #1.5
\on-the-fly #print-page-number-check-first
\fromproperty #'page:page-number-string
"-"}}}
}
\header {
title = \markup { \italic {to kill a monarch}}
composer = \markup \right-column {"michael winter" "(berlin, germany; 2021)"}
poet = "seed: 19800725"
tagline = ""
}
#(set-global-staff-size 11)
\layout {
indent = 0.0\cm
line-width = 17.5\cm
ragged-last = ##f
ragged-right = ##f
\context {
\Score
\override BarNumber.stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
\override Stem.stemlet-length = #0.75
proportionalNotationDuration = #(ly:make-moment 1/16)
\remove "Separating_line_group_engraver"
\override RehearsalMark.self-alignment-X = #-1
\override RehearsalMark.Y-offset = #10
\override RehearsalMark.X-offset = #-8
%\override RehearsalMark.outside-staff-priority = #0
}
\context {
\Staff
\override VerticalAxisGroup.staff-staff-spacing =
#'((basic-distance . 20 )
(minimum-distance . 20 )
(padding . 0 )
(stretchability . 0))
\override VerticalAxisGroup.default-staff-staff-spacing =
#'((basic-distance . 20 )
(minimum-distance . 20 )
(padding . 0 )
(stretchability . 0))
\override TextScript.staff-padding = #2
\override TextScript.self-alignment-X = #0
}
\context {
\StaffGroup
\name "SemiStaffGroup"
\consists "Span_bar_engraver"
\override SpanBar.stencil =
#(lambda (grob)
(if (string=? (ly:grob-property grob 'glyph-name) "|")
(set! (ly:grob-property grob 'glyph-name) ""))
(ly:span-bar::print grob))
}
\context {
\Score
\accepts SemiStaffGroup
}
}
\midi { }
\score{
\new Score
<<
\include "includes/part_star_8_systemsperpage.ly"
>>
\layout{}
\midi{}
}

View file

@ -99,7 +99,7 @@
\header { \header {
title = \markup { \italic {to kill a monarch}} title = \markup { \italic {to kill a monarch}}
composer = \markup \right-column {"michael winter" "(berlin, germany; 2021)"} composer = \markup \right-column {"michael winter" "(berlin, germany; 2020)"}
poet = "seed: 19800725" poet = "seed: 19800725"
tagline = "" tagline = ""
} }
@ -109,7 +109,7 @@
\layout { \layout {
indent = 0.0\cm indent = 0.0\cm
line-width = 17.5\cm line-width = 17.5\cm
ragged-last = ##f ragged-last = ##t
ragged-right = ##f ragged-right = ##f
\context { \context {

View file

@ -99,7 +99,7 @@
\header { \header {
title = \markup { \italic {to kill a monarch}} title = \markup { \italic {to kill a monarch}}
composer = \markup \right-column {"michael winter" "(berlin, germany; 2021)"} composer = \markup \right-column {"michael winter" "(berlin, germany; 2020)"}
poet = "seed: xxx" poet = "seed: xxx"
tagline = "" tagline = ""
} }
@ -109,7 +109,7 @@
\layout { \layout {
indent = 0.0\cm indent = 0.0\cm
line-width = 17.5\cm line-width = 17.5\cm
ragged-last = ##f ragged-last = ##t
ragged-right = ##f ragged-right = ##f
\context { \context {

View file

@ -1,11 +0,0 @@
{
"tempo": 60,
"master_volume": 0.8,
"master_mute": 0,
"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]
}

View file

@ -1,7 +1,7 @@
( (
var clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSection, updateSubsection, var clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSubsection,
buildGenerator, buildMetronome, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader, buildGenerator, buildMetronome, updateSection, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader,
buildMasterView, buildFaderView, buildHelpView, currentSection = 1, currentSubsection = 1; masterView, faderView, helpView, currentSection = 1, currentSubsection = 1;
// these funcs update the elements of the transport panel // these funcs update the elements of the transport panel
clockStringFunc = { clockStringFunc = {
@ -27,6 +27,20 @@ updateTransport = {arg clock, metronome, sectionDisplay, measure, beat, section,
{0.75.wait; {metronome.string = ""}.defer}.fork(~tempoClock, quant: 0); {0.75.wait; {metronome.string = ""}.defer}.fork(~tempoClock, quant: 0);
}.inEnvir; }.inEnvir;
updateSubsection = {arg mod, clock, metronome, sectionDisplay, refresh = true;
if(~sectionNavDict[[currentSection, currentSubsection + mod]] != nil, {
currentSubsection = currentSubsection + mod;
if(refresh, {
updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection, currentSubsection
);
});
}, {
updateSection.value(mod, clock, metronome, sectionDisplay, refresh, true)
})
};
buildGenerator = {arg view; buildGenerator = {arg view;
var ranSeed; var ranSeed;
HLayout( HLayout(
@ -89,20 +103,6 @@ updateSection = {arg mod, clock, metronome, sectionDisplay, refresh = true, indi
}); });
}; };
updateSubsection = {arg mod, clock, metronome, sectionDisplay, refresh = true;
if(~sectionNavDict[[currentSection, currentSubsection + mod]] != nil, {
currentSubsection = currentSubsection + mod;
if(refresh, {
updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection, currentSubsection
);
});
}, {
updateSection.value(mod, clock, metronome, sectionDisplay, refresh, true)
})
};
buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, postampBusses; buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, postampBusses;
var sec, subsec, sectionDisplay, layout, player; var sec, subsec, sectionDisplay, layout, player;
@ -152,18 +152,18 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
[sectionDisplay, layout] [sectionDisplay, layout]
}; };
buildTempoControl = {arg view; buildTempoControl = {arg view;
var layout, tempoField, address, updateSection; var tempo, address, updateSection;
layout = HLayout( HLayout(
tempoField = TextField(view).string_("60").action_({arg v; tempo = TextField(view).string_("60"),
var tempo = v.value.asInteger; ~tempoClock.tempo = tempo / 60}.inEnvir), Button(view).states_([["set tempo"]]).action_({~tempoClock.tempo = tempo.string.asInteger / 60}.inEnvir),
Button(view).states_([["set tempo"]]).action_({arg v; ~tempoClock.tempo = tempoField.string.asInteger / 60}.inEnvir), [StaticText(view).string_(" "), stretch: 1])
[StaticText(view).string_(" "), stretch: 1]);
[layout, tempoField]
}; };
buildMasterFader = {arg view; buildMasterFader = {arg view;
var trackIndicators, layout, volSlider, muteButton, outMenu; var trackIndicators, layout, volSlider, muteButton;
trackIndicators = {LevelIndicator()} ! 2; trackIndicators = {LevelIndicator()} ! 2;
@ -181,18 +181,15 @@ buildMasterFader = {arg view;
trackIndicators[1]), trackIndicators[1]),
muteButton = Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_( 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), {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) StaticText(view).string_("master").align_(\center)
), stretch: 2], nil); ), stretch: 2], nil);
[layout, volSlider, muteButton, outMenu] [layout, volSlider, muteButton]
}; };
buildTrackFader = {arg view, name, index;
var trackIndicator, netAddr, layout, volSlider, soloButton, muteButton, panKnob, outMenu;
netAddr = NetAddr("127.0.0.1", NetAddr.langPort); buildTrackFader = {arg view, name, index;
var trackIndicator, layout, volSlider, muteButton, panKnob;
trackIndicator = LevelIndicator(); trackIndicator = LevelIndicator();
OSCFunc.new({arg msg; {trackIndicator.value = msg[3].ampdb.linlin(-50, 0, 0, 1)}.defer}, OSCFunc.new({arg msg; {trackIndicator.value = msg[3].ampdb.linlin(-50, 0, 0, 1)}.defer},
@ -204,35 +201,27 @@ buildTrackFader = {arg view, name, index;
volSlider = 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), {arg v; var vol = v.value * 1.25; ~play.set(\vol_ ++ index, vol)}.inEnvir),
trackIndicator), 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_( muteButton = Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{arg v; var mute = (1 - v.value).abs; {arg v; var mute = (1 - v.value).abs; ~play.set(\mute_ ++ index, mute)}.inEnvir).value_(0),
~play.set(\mute_ ++ index, mute)}.inEnvir).valueAction_(if(index < 4, {1}, {0})),
VLayout( VLayout(
StaticText(view).string_("pan").align_(\center), StaticText(view).string_("pan").align_(\center),
panKnob = Knob(view).action_({arg v; var pan = v.value * 2 - 1; ~play.set(\pan_ ++ index, pan)}.inEnvir).valueAction_(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_("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_(name).align_(\center)
//StaticText(view).string_("output").align_(\center),
), ),
nil); nil);
[layout, volSlider, soloButton, muteButton, panKnob, outMenu] [layout, volSlider, muteButton, panKnob]
}; };
buildMasterView = {arg win, preampBusses, accompBusses, postampBusses;
var view, generatorLayout, clock, metronome, metronomeLayout, transportLayout, masterView = {arg win, preampBusses, accompBusses, postampBusses;
tempoContol, auxControlsLayout, countOff, ranSeed, order, tempo, sectionDisplay, address; var view, generatorLayout, clock, metronome, metronomeLayout, transportLayout, auxControlsLayout, countOff, ranSeed, order, tempo, sectionDisplay, address;
view = View(win); view = View(win);
generatorLayout = buildGenerator.value(view); generatorLayout = buildGenerator.value(view);
# clock, metronome, metronomeLayout = buildMetronome.value(win); # clock, metronome, metronomeLayout = buildMetronome.value(win);
# sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses); # sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses);
tempoContol = buildTempoControl.value(view); auxControlsLayout = buildTempoControl.value(view);
auxControlsLayout = tempoContol[0];
view.layout_( view.layout_(
HLayout( HLayout(
@ -248,18 +237,16 @@ buildMasterView = {arg win, preampBusses, accompBusses, postampBusses;
alignment: \top alignment: \top
] ]
) )
); )
[view, tempoContol[1]]
}; };
buildFaderView = {arg win, tempoField;
var view, masterIndicators, trackIndicators, master, tracks, openButton, basePath, saveButton; faderView = {arg win;
var partAbbr = ["*", "III", "II", "I", "accomp_II", "accomp_I", "click"]; var view, masterIndicators, trackIndicators, master, tracks, openButton, saveButton;
var trackNames = ["*", "III", "II", "I", "accomp_II", "accomp_I", "click"]; var partAbbr = ["*", "III", "II", "I", "accomp_I", "accomp_II", "click"];
var trackNames = ["*", "III", "II", "I", "accomp_I", "accomp_II", "click"];
var partVols, partMutes, partPans; var partVols, partMutes, partPans;
var masterMute, masterVol; var masterMute, masterVol;
var netAddr = NetAddr("127.0.0.1", NetAddr.langPort);
var player = ~play;
// set initial mixer values // set initial mixer values
partVols = [1, 1, 1, 1, 1, 1]; partVols = [1, 1, 1, 1, 1, 1];
@ -277,72 +264,35 @@ buildFaderView = {arg win, tempoField;
buildTrackFader.value(view, trackNames[part], part); buildTrackFader.value(view, trackNames[part], part);
} ! 7; } ! 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);
basePath = ~dir +/+ ".." +/+ "mixer_settings";
openButton = Button(view).states_([["open", Color.black]]).action_({ openButton = Button(view).states_([["open", Color.black]]).action_({
Dialog.openPanel({ arg path; Dialog.openPanel({ arg path;
var settings; path.postln;
settings = File.readAllString(path).parseJSON; },{
tempoField.valueAction = settings["tempo"]; "cancelled".postln;
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_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);
}); });
saveButton = Button(view).states_([["save", Color.black]]).action_({ saveButton = Button(view).states_([["save", Color.black]]).action_({
Dialog.savePanel({ arg path; Dialog.savePanel({ arg path;
var settings, file; path.postln;
settings = "{\n"; },{
settings = settings ++ "\"tempo\": " ++ tempoField.string ++ ",\n"; "cancelled".postln;
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_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);
file.close;
},{}, basePath);
}); });
view.layout_(HLayout(HLayout(master[0], nil, *tracks.slice(nil, 0)), VLayout(nil, saveButton, openButton))) view.layout_(HLayout(HLayout(master[0], nil, *tracks.slice(nil, 0)), VLayout(nil, openButton, saveButton)))
}; };
buildHelpView = {arg win;
helpView = {arg win;
TextView(win).string_(File.readAllString(~dir +/+ "tkam_readme.scd")).editable_(false); TextView(win).string_(File.readAllString(~dir +/+ "tkam_readme.scd")).editable_(false);
}; };
~generateGUI = {arg preampBusses, accompBusses, postampBusses; ~generateGUI = {arg preampBusses, accompBusses, postampBusses;
var win, tabButtonReset, transportButton, mixerButton, helpButton, masterConrol, tempoControl, masterView, faderView, helpView, tabs; var win, tabButtonReset, transportButton, mixerButton, helpButton, tabs;
win = Window("to kill a monarch", Rect(500, 500, 1100, 575), false).front; win = Window("to kill a monarch", Rect(500, 500, 1100, 575), false).front;
tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; helpButton.value = 1}; 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( win.layout = VLayout(
HLayout( HLayout(
HLayout( HLayout(
@ -357,6 +307,6 @@ buildHelpView = {arg win;
helpButton = Button().states_([["help", Color.white, Color.grey], ["help", Color.black]]).action_( helpButton = Button().states_([["help", Color.white, Color.grey], ["help", Color.black]]).action_(
{tabButtonReset.value; helpButton.value = 0; tabs.index = 2 }.inEnvir).value_(1) {tabButtonReset.value; helpButton.value = 0; tabs.index = 2 }.inEnvir).value_(1)
), ),
tabs = StackLayout(masterView, faderView, helpView)); tabs = StackLayout(masterView.value(win, preampBusses, accompBusses, postampBusses), faderView.value(win), helpView.value(win)));
}; };
) )

View file

@ -1,6 +1,5 @@
( (
// DATA GENEREATOR - this file IS the piece var frAdd, frDiff, frToFloat, frNearestInList, frCollapse, harmonicDistance, //helper functions
var frAdd, frDiff, frToFloat, frNearestInList, frCollapse, harmonicDistance,
genMode, hdChoose, wchooseDict, collectRoots, genMode, hdChoose, wchooseDict, collectRoots,
initModeState, advanceMode, initModeState, advanceMode,
initTemporalState, genTemporalData, initTemporalState, genTemporalData,
@ -39,7 +38,7 @@ frNearestInList = {arg frComp, frDict;
frDict.reject({arg item; frDict.reject({arg item;
(item[\root][0] == frComp[1]) || (item[\root][0] == frComp[1]) ||
(item[\fr] == frComp[1]) (item[\fr] == frComp[1])
}).keys.asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)}).do({arg fr; }).keys.asList.sort({arg a, b; a.asString < b.asString}).do({arg fr;
var diff = abs(frToFloat.value(fr) - frToFloat.value(frComp[0])); var diff = abs(frToFloat.value(fr) - frToFloat.value(frComp[0]));
if(diff < diffNearest, {diffNearest = diff; frNearest = fr}); if(diff < diffNearest, {diffNearest = diff; frNearest = fr});
}); });
@ -59,17 +58,17 @@ harmonicDistance = {arg fr; log2(fr[0].asFloat.product * fr[1].asFloat.product)}
//~~~~~~~~~~~~GENERATE MODE~~~~~~~~~~~~ //~~~~~~~~~~~~GENERATE MODE~~~~~~~~~~~~
genMode = {arg forceHS = false; //TODO: Play with this a bit more (should I go back to the old way)
var mode, alternateProb; genMode = {
alternateProb = [1, 0].wchoose([if(forceHS, {0}, {1}), 4].normalizeSum); var mode;
mode = [ mode = [
[1, 1], [1, 1],
[9, 8], [9, 8],
[[5, 4], [6, 5]].wchoose([3, if(forceHS, {0}, {1})].normalizeSum), [[5, 4], [6, 5]].wchoose([3, 1].normalizeSum),
[[4, 3], [11, 8]].wchoose([alternateProb, 1].normalizeSum), [[4, 3], [11, 8]].wchoose([1, 10].normalizeSum),
[3, 2], [3, 2],
[[8, 5], [13, 8]].wchoose([alternateProb, 1].normalizeSum), [[8, 5], [13, 8]].wchoose([1, 10].normalizeSum),
[[15, 8], [7, 4]].wchoose([alternateProb, 1].normalizeSum) [[15, 8], [7, 4]].wchoose([1, 10].normalizeSum)
]; ];
mode.collect({arg fr; [[1] ++ fr[0].factors, [1] ++ fr[1].factors]}); mode.collect({arg fr; [[1] ++ fr[0].factors, [1] ++ fr[1].factors]});
}; };
@ -83,13 +82,10 @@ hdChoose = {arg mode, exp = 1, weights = [1, 1, 1, 1, 1, 1, 1];
mode.wchoose(probs.normalizeSum) mode.wchoose(probs.normalizeSum)
}; };
wchooseDict = {arg dict, exp = 1, limit = 0, isFR = true; //faster sorting algorithm?
wchooseDict = {arg dict, exp = 1, limit = 0;
var keyList, probs; var keyList, probs;
keyList = if(isFR, { keyList = dict.keys.asList.sort({arg a, b; a.asString < b.asString});
dict.keys.asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)});
}, {
dict.keys.asList.sort({arg a, b; a.convertDigits(2) < b.convertDigits(2)});
});
probs = keyList.collect({arg key; probs = keyList.collect({arg key;
var count = dict[key][\count]; var count = dict[key][\count];
if(count < limit, {0}, {count}) if(count < limit, {0}, {count})
@ -99,7 +95,7 @@ wchooseDict = {arg dict, exp = 1, limit = 0, isFR = true;
}; };
collectRoots = {arg dict; dict.keys.collect({arg fr; collectRoots = {arg dict; dict.keys.collect({arg fr;
dict[fr][\root][0]}).asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)}); dict[fr][\root][0]}).asList.sort({arg a, b; a.asString < b.asString})
}; };
@ -119,19 +115,19 @@ initModeState = {
curModeState; curModeState;
}; };
advanceMode = {arg lastModeState, lastCadenceState, forceHS = false; advanceMode = {arg lastModeState, lastCadenceState;
var curModeState, curRoots, lastRoots, lastCadenceRoot, changeCount, modSpeed; var curModeState, curRoots, lastRoots, lastCadenceRoot, changeCount;
curModeState = lastModeState.deepCopy; curModeState = lastModeState.deepCopy;
curRoots = collectRoots.value(curModeState); curRoots = collectRoots.value(curModeState);
lastRoots = collectRoots.value(lastModeState); lastRoots = collectRoots.value(lastModeState);
lastCadenceRoot = collectRoots.value(lastCadenceState).asList[0]; lastCadenceRoot = collectRoots.value(lastCadenceState).asList[0];
changeCount = 0; changeCount = 0;
modSpeed = if(forceHS, {1}, {[1, 2, 3].wchoose([2, 3, 1].normalizeSum)});
//change either when there is a single root or a few notes have changed in the mode
while({ while({
((curRoots == lastRoots) && (changeCount < modSpeed)) || ((curRoots == lastRoots) && (changeCount < 3)) ||
((changeCount < modSpeed) && (curRoots.size > 1)) ((changeCount < 2) && (curRoots.size > 1))
}, { }, {
var roots, rootSel, mults, multProbs, multSel, new; var roots, rootSel, mults, multProbs, multSel, new;
@ -169,9 +165,10 @@ advanceMode = {arg lastModeState, lastCadenceState, forceHS = false;
old = frNearestInList.value([new, rootSel], curModeState); old = frNearestInList.value([new, rootSel], curModeState);
if(curModeState[old][\count] >= 20, { if(curModeState[old][\count] >= 20, {
var mode, root; var mode, root;
mode = genMode.value;
root = [rootSel, curModeState[rootSel][\mode]]; root = [rootSel, curModeState[rootSel][\mode]];
curModeState.add(new -> curModeState.add(new ->
Dictionary.with(*[\count->1,\mode->genMode.value(forceHS), \root->root, \mult->multSel, \fr->new])); Dictionary.with(*[\count->1,\mode->genMode.value, \root->root, \mult->multSel, \fr->new]));
curModeState.removeAt(old); curModeState.removeAt(old);
changeCount = changeCount + 1; changeCount = changeCount + 1;
}) })
@ -188,13 +185,14 @@ initTemporalState = {
tuple->Dictionary.with(*[\count->1])})) tuple->Dictionary.with(*[\count->1])}))
}; };
//The temporal density could / should also be based on the parts contribution to the mode
genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4; genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
var cadence, curTupleState, timeToNextEvent, tuple, temporalData; var cadence, curTupleState, timeToNextEvent, tuple, temporalData;
cadence = if(collectRoots.value(modeState).size == 1, {cadenceOverride.not}, {false}); cadence = if(collectRoots.value(modeState).size == 1, {cadenceOverride.not}, {false});
curTupleState = lastTupleState.deepCopy; curTupleState = lastTupleState.deepCopy;
timeToNextEvent = (64 + 50.rand + if(cadence, {50}, {0})).round(16); timeToNextEvent = (64 + 50.rand + if(cadence, {50}, {0})).round(16);
tuple = wchooseDict.value(curTupleState, isFR: false); tuple = wchooseDict.value(curTupleState);
if(cadence, {tuple = [1, 1, 1]}); if(cadence, {tuple = [1, 1, 1]});
curTupleState = curTupleState.keysValuesDo({arg key, val; curTupleState = curTupleState.keysValuesDo({arg key, val;
curTupleState[key][\count] = val[\count] + 1}); curTupleState[key][\count] = val[\count] + 1});
@ -205,7 +203,7 @@ genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
var flourishDensity, genDensity, flourish, beforeLen, before, after, buffer; var flourishDensity, genDensity, flourish, beforeLen, before, after, buffer;
flourishDensity = if(tuple[p] == 1, {0.125 + 0.5.rand}, {3}); flourishDensity = if(tuple[p] == 1, {0.125 + 0.5.rand}, {3});
if((p == 0) && cadence.not, {flourishDensity = 3}); if((p == 0) && cadence.not, {flourishDensity = 3});
genDensity = if(p == 0, {5}, {20}); genDensity = if(p == 0, {3}, {20});
flourish = (if(cadence, {16}, {8}) + 32.rand).collect({[0, 1].wchoose([flourishDensity, 1].normalizeSum)}); flourish = (if(cadence, {16}, {8}) + 32.rand).collect({[0, 1].wchoose([flourishDensity, 1].normalizeSum)});
buffer = 16.collect({0}); buffer = 16.collect({0});
@ -241,9 +239,7 @@ distributeRoots = {arg modeState, lastRoots;
var roots; var roots;
roots = modeState.keys.asList.collect({arg fr; modeState[fr][\root]}); roots = modeState.keys.asList.collect({arg fr; modeState[fr][\root]});
roots = roots.asBag.contents.asPairs.reverse.clump(2); roots = roots.asBag.contents.asPairs.reverse.clump(2);
roots = roots = roots.sort({arg a, b; roots = roots.sort({arg a, b; a[0] > b[0]}).collect({arg item; item[1]}).wrapExtend(4);
if(a[0] != b[0], {a[0] > b[0]}, {frToFloat.value(a[1][0]) > frToFloat.value(b[1][0])})}).collect({arg item; item[1]}).wrapExtend(4);
roots = [roots[0]] ++ roots[..2].scramble; roots = [roots[0]] ++ roots[..2].scramble;
roots = 4.collect({arg part; roots = 4.collect({arg part;
var root, rootMod, rootFreq, mode; var root, rootMod, rootFreq, mode;
@ -270,6 +266,7 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
firstChange = false; firstChange = false;
cadence = if(collectRoots.value(modeState).size == 1, {true}, {false}); cadence = if(collectRoots.value(modeState).size == 1, {true}, {false});
lastInsRef = nil; lastInsRef = nil;
if(offset == 0, {cadence = false});
ensData = []; ensData = [];
temporalData.do({arg val, ts; temporalData.do({arg val, ts;
@ -277,7 +274,7 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
partState[\lastDur] = partState[\lastDur] + 1; partState[\lastDur] = partState[\lastDur] + 1;
timeStamp = ts + offset; timeStamp = ts + offset;
change = [val == 1, (val == 1) && firstChange.not].wchoose([1, 2].normalizeSum); change = [val == 1, (val == 1) && firstChange.not].wchoose([1, 2].normalizeSum);//5 * abs((curPulse / totalLen).clip(0, 1) - 1)].normalizeSum);
if( if(
(partState[\index] == 0) && (partState[\index] == 0) &&
(frToFloat.value(partState[\lastFreqRatio]) >= 4.0) && (frToFloat.value(partState[\lastFreqRatio]) >= 4.0) &&
@ -288,12 +285,20 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
if(change, { if(change, {
var mult, multWeights, freq, rootFreq, insRef; var mult, multWeights, freq, rootFreq, insRef;
//this weights notes that are richer and mixes with the DCA algorithm //check that this is working correctly
multWeights = mults.collect({arg fr; multWeights = mults.collect({arg fr;
var comp = frCollapse.value(frAdd.value(root, fr)); var comp = frCollapse.value(frAdd.value(root, fr));
if(modeState.keys.includes(comp), {3}, {1}) * pow(partState[\multCounts][fr], 1); if(modeState.keys.includes(comp), {3}, {1}) * pow(partState[\multCounts][fr], 1);
}); });
/*
mult = if( (i == (curPhrase.size - 1)), {
hdChoose.value(mults, 3, multWeights);
}, {
hdChoose.value(mults, 0.5, multWeights);
});
*/
mult = hdChoose.value(mults, 0.5, multWeights); mult = hdChoose.value(mults, 0.5, multWeights);
mults.do({arg fr; partState[\multCounts][fr] = partState[\multCounts][fr] + 1}); mults.do({arg fr; partState[\multCounts][fr] = partState[\multCounts][fr] + 1});
partState[\multCounts][mult] = 0; partState[\multCounts][mult] = 0;
@ -309,15 +314,11 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
modeState[fr][\root][0], modeState[fr][\mult] modeState[fr][\root][0], modeState[fr][\mult]
] ]
}); });
mode = mode.sort({arg a, b; mode = mode.sort({arg a, b; frToFloat.value(a[0]) < frToFloat.value(b[0])});
case
{frToFloat.value(a[0]) != frToFloat.value(b[0])} {frToFloat.value(a[0]) < frToFloat.value(b[0])}
{frToFloat.value(a[1]) != frToFloat.value(b[1])} {frToFloat.value(a[1]) < frToFloat.value(b[1])}
{true} {frToFloat.value(a[2]) < frToFloat.value(b[2])};
});
mode = mode ++ mode.collect({arg fr; [frAdd.value(fr[0], [[2], [1]]), fr[1], fr[2]]}); mode = mode ++ mode.collect({arg fr; [frAdd.value(fr[0], [[2], [1]]), fr[1], fr[2]]});
mode = mode ++ mode.collect({arg fr; [frAdd.value(fr[0], [[4], [1]]), fr[1], fr[2]]}); mode = mode ++ mode.collect({arg fr; [frAdd.value(fr[0], [[4], [1]]), fr[1], fr[2]]});
continue = true; continue = true;
//check that this is working correctly
while({continue}, { while({continue}, {
# freqRatio, root, mult = mode[partState[\noteCount] % 15]; # freqRatio, root, mult = mode[partState[\noteCount] % 15];
freq = 36.midicps * trans * frToFloat.value(frAdd.value([[1], [1]], freqRatio)); freq = 36.midicps * trans * frToFloat.value(frAdd.value([[1], [1]], freqRatio));
@ -354,7 +355,7 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
accompData = []; accompData = [];
temporalData.do({arg val, tS; temporalData.do({arg val, tS;
var change; var change;
change = [val == 1, (val == 1) && firstChange.not].wchoose([1, if(part == 0, {5}, {3})].normalizeSum); change = [val == 1, (val == 1) && firstChange.not].wchoose([1, if(part == 0, {5}, {3})].normalizeSum); //5 * abs((curPulse / totalLen).clip(0, 0.8) - 1)].normalizeSum);
if(change, { if(change, {
var sel, freq, amp; var sel, freq, amp;
sel = wchooseDict.value(modeState, 0.1); sel = wchooseDict.value(modeState, 0.1);
@ -401,12 +402,12 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
{1} {temporalData2[0].size - firsts2.maxItem} {1} {temporalData2[0].size - firsts2.maxItem}
{2} {(offset2 - temporalData2[0].size) - offset1} ; {2} {(offset2 - temporalData2[0].size) - offset1} ;
min = switch(type) min = switch(type)
{0} {0.15} {0} {0.25}
{1} {0} {1} {0}
{2} {0} ; {2} {0} ;
max = switch(type) max = switch(type)
{0} {0.5} {0} {0.5}
{1} {0.65} {1} {0.75}
{2} {1} ; {2} {1} ;
env = Env.dadsr(delay, attack, decay, 0.25, release, curve: \cub).range(min, max); env = Env.dadsr(delay, attack, decay, 0.25, release, curve: \cub).range(min, max);
@ -414,11 +415,11 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
}; };
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~ //~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
~genMusicData = {arg seed; ~genMusicData = {arg seed;
var minTotalDur, minSection1Dur, dUnit, curLen, cadence, var totalDur, section1Dur, dUnit, curLen, cadence, ultimate,
ultimateSubsection, ultimateSection, ultimateCadenceCount, totalLen, section1Len,
minTotalLen, minSection1Len,
modeState, temporalState, partStates, modeState, temporalState, partStates,
lastCadenceTemporalData, lastCadenceState, lastSectionPoint, lastCadenceTemporalData, lastCadenceState, lastSectionPoint,
ensData, accompData, bassData, ampData, ensData, accompData, bassData, ampData,
@ -426,51 +427,47 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
sectionCount, subsectionCount, sectionCount, subsectionCount,
lastRoots, roots, ampDataTmp; lastRoots, roots, ampDataTmp;
thisThread.randSeed = seed; thisThread.randSeed = seed.postln;
# minTotalDur, minSection1Dur, dUnit, curLen, cadence = [23 * 60, 8 * 60, 8.reciprocal, 0, false]; # totalDur, section1Dur, dUnit, curLen, cadence, ultimate = [2 * 60, 1 * 60, 8.reciprocal, 0, false, false];
# ultimateSubsection, ultimateSection, ultimateCadenceCount = [false, false, 0]; # totalLen, section1Len = [(totalDur / dUnit).round(16), (section1Dur / dUnit).round(16)];
# minTotalLen, minSection1Len = [(minTotalDur / dUnit).round(16), (minSection1Dur / dUnit).round(16)];
# modeState, temporalState, partStates = [initModeState.value, initTemporalState.value, initPartStates.value]; # modeState, temporalState, partStates = [initModeState.value, initTemporalState.value, initPartStates.value];
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [nil, modeState.deepCopy, 0]; # lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [nil, modeState.deepCopy, 0];
# ensData, accompData, bassData, ampData = [4.collect({[]}), 4.collect({6.collect({[]})}), 2.collect({[]}), 3.collect({[]})]; # ensData, accompData, bassData, ampData = [4.collect({[]}), 4.collect({6.collect({[]})}), 2.collect({[]}), 3.collect({[]})];
# sectionData, sectionNavDict = [Dictionary.new, Dictionary.new]; # sectionData, sectionNavDict = [Dictionary.new, Dictionary.new];
# sectionCount, subsectionCount = [1, 1]; # sectionCount, subsectionCount = [1, 1];
while({(curLen < minTotalLen) || ((curLen >= minTotalLen) && cadence.not) || ultimateSection.not}, { while({(curLen < totalLen) || ((curLen >= totalLen) && cadence.not)}, {
var temporalData; var temporalData;
# temporalData, temporalState = genTemporalData.value(temporalState, modeState, curLen <= minSection1Len); # temporalData, temporalState = genTemporalData.value(temporalState, modeState, curLen <= section1Len);
collectRoots.value(modeState).collect({arg fr; [fr[0].asFloat.product, fr[1].asFloat.product]}).postln; collectRoots.value(modeState).collect({arg fr; [fr[0].asFloat.product, fr[1].asFloat.product]}).postln;
//modeState.keys.postln; //modeState.keys.postln;
("-- " ++ sectionCount ++ "." ++ subsectionCount ++ " -----").postln; "-----------".postln;
lastRoots = if(curLen == 0, {4.collect({[[1], [1]]})}, {roots.slice(nil, 0)}); lastRoots = if(curLen == 0, {4.collect({[[1], [1]]})}, {roots.slice(nil, 0)});
roots = distributeRoots.value(modeState, lastRoots); roots = distributeRoots.value(modeState, lastRoots);
sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part; sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part;
[fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount, cadence, ultimateSubsection]); [fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount, cadence, ultimate]);
sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger]); sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger]);
4.do({arg part; 4.do({arg part;
var musicData, partState, accompRoutine; var musicData, partState, noteCountInd;
# musicData, partState = genEnsemblePart.value(partStates[part], modeState, temporalData[part], roots, part, curLen); # musicData, partState = genEnsemblePart.value(partStates[part], modeState, temporalData[part], roots, part, curLen);
ensData[part] = ensData[part] ++ musicData; ensData[part] = ensData[part] ++ musicData;
partStates[part] = partState; partStates[part] = partState;
//use an independent random number generator for the accompaniment
accompRoutine = Routine({
thisThread.randSeed = Date.seed; thisThread.randSeed = Date.seed;
6.do({arg register; 6.do({arg register;
musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part, register); musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part, register);
accompData[part][register] = accompData[part][register] ++ musicData; accompData[part][register] = accompData[part][register] ++ musicData;
}); });
});
accompRoutine.value;
}); });
subsectionCount = subsectionCount + 1; subsectionCount = subsectionCount + 1;
thisThread.randSeed = (seed + (sectionCount * 200) + subsectionCount);
if(curLen == 0, { if(curLen == 0, {
lastCadenceTemporalData = temporalData; lastCadenceTemporalData = temporalData;
@ -479,7 +476,7 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
curLen = curLen + temporalData[0].size; curLen = curLen + temporalData[0].size;
if(curLen > minSection1Len, { if(curLen > section1Len, {
if(collectRoots.value(modeState).size == 1, { if(collectRoots.value(modeState).size == 1, {
ampData[0] = ampData[0] ++ genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 0); ampData[0] = ampData[0] ++ genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 0);
@ -504,18 +501,14 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
# sectionCount, subsectionCount = [sectionCount + 1, 1]; # sectionCount, subsectionCount = [sectionCount + 1, 1];
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen]; # lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
cadence = true; cadence = true;
//this should ensure that the final cadence is a HS
if(curLen >= minTotalLen, {ultimateCadenceCount = ultimateCadenceCount + 1});
ultimateSection = ultimateCadenceCount > 1;
}, { }, {
cadence = false cadence = false
}); });
modeState = advanceMode.value(modeState, lastCadenceState, curLen >= minTotalLen); modeState = advanceMode.value(modeState, lastCadenceState);
}); });
}); });
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, [[1], [1], [1], [1]], lastSectionPoint, lastSectionPoint + 360, 2); ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, [[1], [1], [1], [1]], lastSectionPoint, lastSectionPoint + 80, 2);
ampData[2] = ampData[2] ++ ampDataTmp; ampData[2] = ampData[2] ++ ampDataTmp;
bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false); bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false);

View file

@ -8,11 +8,13 @@ The play button will always start from the beginning of the current section.
The transport buttons allow you to advance by subsection (<,>) and section (<<,>>). The transport buttons allow you to advance by subsection (<,>) and section (<<,>>).
Tempo change will only go into effect once the enter key or "set tempo" button is pressed. Tempo change will only go into effect once "set tempo" button is pressed.
The default seed given in the application will generate the first version of the 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 tkam_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 on files in that folder and the "includes" subfolder. 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 ~~~~mixer tab
This allow invidual control of each of the sonic elements. The three parts that can be played on acoustic instruments are automatically muted. The outputs will go out to whatever sound card is being used by the system. 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.
*/ */

View file

@ -15,56 +15,58 @@ var formatPatternData;
var sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut, allSds; var sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut, allSds;
sdPlayer = SynthDef(\masterPlayerControl_ ++ ~hash, { sdPlayer = SynthDef(\masterPlayerControl_ ++ ~hash, {
var router, sigs, sigsPanned, masterSig, imp; var sigs, sigsPanned, masterSig, imp;
sigs = postampBusses.collect({arg bus, i; In.ar(bus) * NamedControl.kr(\vol_ ++ i, 1, 0.1) * NamedControl.kr(\mute_ ++ i, 1, 0.1)}); sigs = postampBusses.collect({arg bus, i; In.ar(bus) * NamedControl.kr(\vol_ ++ i, 1, 0.1)});
router = sigs.collect({arg sig, i; NamedControl.kr(\out_ ++ i, 0, 0)}); sigsPanned = sigs.collect({arg sig, i; Pan2.ar(sig * NamedControl.kr(\mute_ ++ i, 1, 0.1), NamedControl.kr(\pan_ ++ i, 0, 0.1))});
sigs.collect({arg sig, i; Out.ar(router[i] - 1, sig * router[i].sign)}); masterSig = Mix.ar(sigsPanned.drop(-1)) * NamedControl.kr(\masterVol, 1, 0.1) * NamedControl.kr(\masterMute, 1, 0.1);
sigsPanned = sigs.collect({arg sig, i; Pan2.ar(sig, NamedControl.kr(\pan_ ++ i, 0, 0.1))}); Out.ar(0, masterSig);
masterSig = Mix.ar(sigsPanned.collect({arg sig, i; sig * abs(router[i].sign - 1)})); Out.ar(2, sigsPanned.last); //change this if you want the click to go somewhere else
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); imp = Impulse.kr(10);
SendReply.kr(imp, '/masterLevels_' ++ ~hash, values: [Amplitude.kr(masterSig)]); SendReply.kr(imp, '/masterLevels_' ++ ~hash, values: [Amplitude.kr(masterSig)]);
sigs.collect({arg sig, i; SendReply.kr(imp, '/trackLevel_' ++ i ++ "_" ++ ~hash, values: [Amplitude.kr(sig)])}); sigs.collect({arg sig, i; SendReply.kr(imp, '/trackLevel_' ++ i ++ "_" ++ ~hash, values: [Amplitude.kr(sig)])});
}); }).add;
sdTransport = SynthDef(\transport_ ++ ~hash, {arg measure = 0, beat = 0, section = 0, subsection = 0, gate = 1, dur = 1; sdTransport = SynthDef(\transport_ ++ ~hash, {arg measure = 0, beat = 0, section = 0, subsection = 0, gate = 1, dur = 1;
SendReply.kr(Impulse.kr(0) * (measure > 0) * (beat > 0),'/measureClock_' ++ ~hash, values: [measure, beat, section, subsection]); SendReply.kr(Impulse.kr(0) * (measure > 0) * (beat > 0),'/measureClock_' ++ ~hash, values: [measure, beat, section, subsection]);
//SendReply.kr(Impulse.kr(0),'/nextSubsection_' ++ ~hash);
EnvGen.kr(Env.sine(dur), gate, doneAction: 2); EnvGen.kr(Env.sine(dur), gate, doneAction: 2);
}); }).add;
sdClick = SynthDef(\click_ ++ ~hash, {arg beat = 0, gate = 1, dur = 1; sdClick = SynthDef(\click_ ++ ~hash, {arg beat = 0, gate = 1, dur = 1;
Out.ar(postampBusses[6], 10 * BPF.ar(WhiteNoise.ar * EnvGen.kr(Env.perc(0.01, 0.1), gate), 440 * ((beat <= 1) + 1), 0.02)); Out.ar(postampBusses[6], 10 * BPF.ar(WhiteNoise.ar * EnvGen.kr(Env.perc(0.01, 0.1), gate), 440 * ((beat <= 1) + 1), 0.02));
EnvGen.kr(Env.sine(dur), gate, doneAction: 2); EnvGen.kr(Env.sine(dur), gate, doneAction: 2);
}); }).add;
sdAmpCurve = SynthDef(\amp_curve_ ++ ~hash, {arg amp = 1, dur = 0.1, bus = 0; sdAmpCurve = SynthDef(\amp_curve_ ++ ~hash, {arg amp = 0, dur = 0.1, gate = 1, bus = 0;
Out.kr(bus, amp.lag) Out.kr(bus, amp)
}); }).add;
sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0, rel = 0.1; sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0;
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)) Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction: 2))
}); }).add;
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, sustain = 1, dur = 1, gate = 1, bout = 0, ampBus = 0, rel = 0.01; sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0;
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)) 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, 0.01), gate, doneAction: 2))
}); }).add;
sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0; sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0;
Out.ar(bus, (In.ar(bin)).clip(0, 1) * 50) //Out.ar([0, 1], (In.ar(bin)).clip(0, 1) * pow(Line.kr(0, 1, 240), 2))
}); Out.ar(bus, (In.ar(bin)).clip(0, 1) * 50 * pow(Line.kr(0, 1, 10), 2))
}).add;
sdBass = SynthDef(\bass_mono_ ++ ~hash, {arg freq = 440, ampBus = 0, bus = 0; sdBass = SynthDef(\bass_mono_ ++ ~hash, {arg freq = 440, ampBus = 0, bus = 0;
Out.ar(bus, (SinOsc.ar(freq) * 0.5 * In.kr(ampBus))) Poll.kr(Changed.kr(In.kr(ampBus)), In.kr(ampBus));
}); Out.ar(bus, (SinOsc.ar(freq) * 0.4 * In.kr(ampBus)))
}).add;
sdDiskOut = SynthDef(\disk_out_ ++ ~hash, {arg bufnum, inbus; sdDiskOut = SynthDef(\disk_out_ ++ ~hash, {arg bufnum, inbus;
DiskOut.ar(bufnum, In.ar(inbus)); DiskOut.ar(bufnum, In.ar(inbus));
}); }).add;
allSds = [sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut]; allSds = [sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut];
allSds.do({arg sd; sd.add}); allSds.do({arg sd; sd.add});
@ -73,14 +75,12 @@ var formatPatternData;
// group data by measures for navigation // group data by measures for navigation
formatPatternData = {arg musData, measureLen, rel, print = false; formatPatternData = {arg musData, measureLen;
var dataLen; var dataLen;
dataLen = musData[0][0].size + 1; dataLen = musData[0][0].size;
musData.collect({arg partData; musData.collect({arg partData;
var res; var res;
res = partData; res = partData.flop;
res = res.collect({arg mData, index; mData.add(if(index != (res.size - 1), {rel}, {5.rand + 5}))});
res = res.flop;
res = res.add(res[1]); res = res.add(res[1]);
res[1] = (res[1].differentiate.drop(1) ++ [10]); res[1] = (res[1].differentiate.drop(1) ++ [10]);
res = res.flop ++ measureLen.collect({arg measure; dataLen.collect({0}) ++ [measure * 16]}); res = res.flop ++ measureLen.collect({arg measure; dataLen.collect({0}) ++ [measure * 16]});
@ -104,8 +104,8 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
accompData.flatten.collect({arg partData; partData.last[1]}) accompData.flatten.collect({arg partData; partData.last[1]})
).maxItem.ceil(16) / 16).asInteger + 1; ).maxItem.ceil(16) / 16).asInteger + 1;
ensDataFormatted = formatPatternData.value(ensData, measureLen, 0.1, true); ensDataFormatted = formatPatternData.value(ensData, measureLen);
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen, 0.01); accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
dUnit = 8.reciprocal; dUnit = 8.reciprocal;
patterns = measureLen.collect({arg measure; patterns = measureLen.collect({arg measure;
@ -115,29 +115,30 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
}); });
Ppar( Ppar(
//check how amplitude is being handled //check how amplitude is being handled
ensDataFormatted[measure].collect({arg musData, p; ensDataFormatted[measure].collect({arg musData, m;
Pbind( Pbind(
\instrument, \ens_ ++ ~hash, \instrument, \ens_ ++ ~hash,
\freq, Pseq(musData[0].replace(0, Rest(0))), \freq, Pseq(musData[0].replace(0, Rest(0))),
\dur, Pseq(musData[1] * dUnit), \dur, Pseq(musData[1] * dUnit),
\sustain, Pseq(musData[2] * dUnit), \sustain, Pseq(musData[2] * dUnit),
\amp, [1, 0.7, 0.5, 0.3][p], \amp, [0.5, 0.3, 0.3, 0.3][m],
//\amp, Pseq(musData[2].collect({arg item; [0, 0.25, 0.5, 0.75][item]}) * [1, 0.5, 0.25, 0.1][m] * 16);
\ampBus, preampBusses[0].index, \ampBus, preampBusses[0].index,
\bus, postampBusses[p].index, \bus, postampBusses[m].index
\rel, Pseq(musData[6])
) )
}) ++ }) ++
//check how amplitude and attack are being handled //check how amplitude and attack are being handled
accompDataFormatted[measure].collect({arg musData; accompDataFormatted[measure].collect({arg musData, m;
Pbind( Pbind(
\instrument, \accomp_ ++ ~hash, \instrument, \accomp_ ++ ~hash,
\freq, Pseq(musData[0].replace(0, Rest(0))), \freq, Pseq(musData[0].replace(0, Rest(0))),
\dur, Pseq(musData[1] * dUnit), \dur, Pseq(musData[1] * dUnit),
\sustain, Pseq(musData[2] * dUnit), \sustain, Pseq(musData[2] * dUnit),
\amp, Pseq(musData[3].collect({arg item; [0, 2, 4, 8][item]}) * 0.0125 * 1), \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),
\ampBus, preampBusses[0].index, \ampBus, preampBusses[0].index,
\bout, Pseq(musData[4].collect({arg index; accompBusses[index].index})), \bout, Pseq(musData[4].collect({arg index; accompBusses[index].index}))
\rel, Pseq(musData[5])
) )
}) ++ }) ++
[ [
@ -192,7 +193,7 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
preampBusses, nextNode, accompBusses, postampBusses, preampBusses, nextNode, accompBusses, postampBusses,
synths, prePatterns, playablePatterns, score; synths, prePatterns, playablePatterns, score;
trackNames = ["part_star", "part_III", "part_II", "part_I", "accomp_II", "accomp_I", "click"]; trackNames = ["part_start", "part_III", "part_II", "part_I", "accomp_I", "accomp_II", "click"];
basePath = ~dir +/+ ".." +/+ "audio" +/+ "seed_" ++ seed; basePath = ~dir +/+ ".." +/+ "audio" +/+ "seed_" ++ seed;
basePath.mkdir; basePath.mkdir;
@ -212,7 +213,7 @@ formatPatternData = {arg musData, measureLen, rel, print = false;
playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses); playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses);
recDur = (prePatterns[2][0].size / 8) + 45; recDur = (prePatterns[2][0].size / 8) + 10;
score = playablePatterns.asScore(duration: recDur, timeOffset: 0.001); 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; nextNode = score.score.slice(nil, 1).select({arg msg; msg[0] == 9}).slice(nil, 2).maxItem + 1;

View file

@ -23,8 +23,8 @@ formatMusicData = {arg rawMusicData;
}); });
// make them all the same length // make them all the same length
maxSize = maxSize.trunc(64) + 64; maxSize = maxSize.trunc(16) + 16;
musicData = musicData.collect({arg partData, p; partData.extend(maxSize, partData.last)}); musicData = musicData.collect({arg partData, p; partData.extend(maxSize, [-1, -1, -1, partData.last[1]])});
musicData musicData
}; };
@ -68,7 +68,7 @@ lyFinalizeMusic = {arg lyStr, part, name, nameShort, nameMidi, clef;
"\n\\set Score.markFormatter = #format-mark-box-numbers " + "\n\\set Score.markFormatter = #format-mark-box-numbers " +
"\\tempo 2 = 60\n" + "\\tempo 2 = 60\n" +
"\\numericTimeSignature \\time 2/2\n" + "\\numericTimeSignature \\time 2/2\n" +
"\\clef " ++ clef ++ "\n" ++ lyStr + "\\fermata" + "\\clef " ++ clef ++ "\n" ++ lyStr ++
" }>> \\bar \"|.\" \n} \n\n>>" ++ " }>> \\bar \"|.\" \n} \n\n>>" ++
"\n>>" "\n>>"
}; };
@ -113,7 +113,7 @@ lyRelMark = {arg root, lastRoot, section, subsection;
lyRelMarkNote.value(root, lastRoot, 1, "bass") ++ "^\\markup{\\large \\raise #2 \"III\"}" ++ lyRelMarkNote.value(root, lastRoot, 1, "bass") ++ "^\\markup{\\large \\raise #2 \"III\"}" ++
lyHBracket.value(lyFreqRatio.value(root[1][4][2], nil, true, 0, false), 8.5, 1, 2, 1, 1) ++ lyHBracket.value(lyFreqRatio.value(root[2][4][2], nil, true, 0, false), 8.5, 1, 2, 1, 1) ++
lyHBracket.value(lyFreqRatio.value(root[2][4][1], nil, true, 0, false), 5.5, 3, 3, 0, 0) ++ lyHBracket.value(lyFreqRatio.value(root[2][4][1], nil, true, 0, false), 5.5, 3, 3, 0, 0) ++
"\\hide c16 \n " ++ "\\hide c16 \n " ++
@ -121,7 +121,7 @@ lyRelMark = {arg root, lastRoot, section, subsection;
lyRelMarkNote.value(root, lastRoot, 2, "alto") ++ "^\\markup{\\large \\raise #2 \"II\"}" + lyRelMarkNote.value(root, lastRoot, 2, "alto") ++ "^\\markup{\\large \\raise #2 \"II\"}" +
"\\stopGroup \\hide c'16 \n " ++ "\\stopGroup \\hide c'16 \n " ++
lyHBracket.value(lyFreqRatio.value(root[2][4][2], nil, true, 0, false), 5.5, 1, 3, 0, 0) ++ lyHBracket.value(lyFreqRatio.value(root[1][4][2], nil, true, 0, false), 5.5, 1, 3, 0, 0) ++
lyRelMarkNote.value(root, lastRoot, 3, "treble") ++ "^\\markup{\\large \\raise #2 \"I\"}" + lyRelMarkNote.value(root, lastRoot, 3, "treble") ++ "^\\markup{\\large \\raise #2 \"I\"}" +
"\\stopGroup \\stopGroup \n " ++ "\\stopGroup \\stopGroup \n " ++

Binary file not shown.