everything essentially working except for random seeding

main
mwinter 4 years ago
parent 1ab4385e69
commit 987361c9a8

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

@ -32,6 +32,9 @@
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
@ -50,7 +53,7 @@
#(set-paper-size "a4" 'portrait)
top-margin = 1 \cm
bottom-margin = 1 \cm
left-margin = 2.5 \cm
left-margin = 2 \cm
ragged-bottom = ##t
top-system-spacing =
@ -71,13 +74,13 @@
(padding . 0 )
(stretchability . 0))
systems-per-page = 3
first-page-number = 5
%systems-per-page = 3
first-page-number = 1
print-first-page-number = ##t
print-page-number = ##t
oddHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\italic {to kill a monarch} }}}}
evenHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\italic {to kill a monarch} }}}}
oddHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\pad-markup #2 \italic {"to kill a monarch"} }}}}
evenHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\pad-markup #2 \italic {"to kill a monarch"} }}}}
oddFooterMarkup = \markup { \fill-line {
\concat {
"-"
@ -104,7 +107,7 @@
\layout {
indent = 0.0\cm
line-width = 17\cm
line-width = 17.5\cm
ragged-last = ##t
ragged-right = ##f

@ -110,12 +110,13 @@ buildTransport = {arg win, view, clock, metronome;
Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_({arg pState;
if(pState.value == 1, {
player = {
var startMeasure = ~sectionNavDict[[currentSection, currentSubsection]] - 1;
~patternProxy.source = Ppar(
[Pseq(~patterns[0], 1, ~sectionNavDict[[currentSection, currentSubsection]] - 1)] ++
[Pseq(~patterns[0][startMeasure..], 1)] ++
~patterns[2].collect({arg pattern, p;
Pmono(\amp_curve_ ++ ~hash,
\amp, Pseg(Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 16), 1 * ~dUnit, \cub),
\amp, Pseg(Pseq(pattern.slice(nil, 0)[(startMeasure * 16)..], 1), 1 * ~dUnit, \cub),
\dur, 1 * ~dUnit,
\bus, ~preampBusses[p].index
)
@ -123,7 +124,7 @@ buildTransport = {arg win, view, clock, metronome;
~patterns[1].collect({arg pattern, p;
Pmono(\bass_mono_ ++ ~hash,
\freq, Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 16),
\freq, Pseq(pattern.slice(nil, 0)[(startMeasure * 16)..], 1),
\dur, 1 * ~dUnit,
\ampBus, ~preampBusses[p + 1].index,
\bus, ~postampBusses[4].index
@ -164,24 +165,6 @@ buildAuxControls = {arg view;
HLayout(
tempo = TextField(view).string_("60"),
Button(view).states_([["set tempo"]]).action_({~tempoClock.tempo = tempo.string.asInteger / 60}.inEnvir),
StaticText(view).string_(" | "),
Button(view).states_([["auto advance", Color.black], ["auto advance", Color.black, Color.grey]]).action_({
arg v; ~autoAdvance = if(v.value == 0, {false}, {true});~autoAdvance;
}.inEnvir).value_(1),
Button(view).states_([["interludes", Color.black], ["interludes", Color.black, Color.grey]]).action_({
arg v; ~interludes = if(v.value == 0, {false}, {true})
}.inEnvir),
StaticText(view).string_(" | "),
address = TextField(view, Rect(10, 10, 10, 20)).string_("127.0.0.1:57120"),
Button(view).states_([["set address:port"]]).action_({
var addr, ip, port;
addr = address.string.split($:);
ip = addr[0];
port = addr[1].asInteger;
thisProcess.openUDPPort(port);
addr = NetAddr(ip, port);
OSCdef(\externalAdvance_ ++ ~hash, {arg msg, time; {updateSection.value(1)}.inEnvir.defer},'/nextSubsection', addr);
}.inEnvir),
[StaticText(view).string_(" "), stretch: 1])
};
@ -272,15 +255,6 @@ faderView = {arg win;
masterIndicators = {LevelIndicator()} ! 2;
trackIndicators = {LevelIndicator()} ! 6;
/*
OSCFunc.new({arg msg; {
{arg i; masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer},
'/masterLevels' ++ ~hash, s.addr);
OSCFunc.new({arg msg; {
{arg i; trackIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 6}.defer},
'/trackLevels' ++ ~hash, s.addr);
*/
master = buildMasterFader.value(view, masterVol, masterMute, masterIndicators);
tracks = {arg part;
buildTrackFader.value(view, trackNames[part], part, 0);
@ -309,313 +283,5 @@ faderView = {arg win;
),
tabs = StackLayout(masterView.value(win), faderView.value(win)/*, helpView.value*/));
};
//~generateGUI.value
//~~FUNCTION THAT GENERATES THE GUI
/*
~generateGUI = {
var win, clockStringFunc, metronomeStringFunc, metronomeColorFunc, masterView, faderView, helpView, tabs;
var tabButtonReset, transportButton, mixerButton, helpButton, startPos = 0;
var partAbbr = ["guitar", "accompHigh", "accompLowLower", "accompLowUpper", "interlude", "click"];
var trackNames = ["guitar", "high", "low 1", "low 2", "interlude", "click"];
var partVols, partMutes, partPans;
var masterMute, masterVol;
// set initial mixer values
partVols = [1, 1, 1, 1, 1, 1];
partMutes = [0, 1, 1, 1, 1, 0];
partPans = [0, 0, 0, 0, 0, 0];
masterMute = 1;
masterVol = 1;
// these funcs update the elements of the transport panel
clockStringFunc = {
arg measure, beat;
var measureString, beatString, leadSpace;
measureString = measure.asInteger.asString;
beatString = beat.asInteger.asString;
leadSpace = (3 - measureString.size).collect({" "}).join;
leadSpace ++ measureString ++ "." ++ beatString
};
// [-30, -105, -104] and [-30, -105, -113] are unicode inverse bullet and normal bullet, respectively
metronomeStringFunc = { arg beat; if(beat == 1,
{[-30, -105, -104].collect({arg int; int.asAscii}).as(String)},
{[-30, -105, -113].collect({arg int; int.asAscii}).as(String)})};
metronomeColorFunc = { arg beat; if(beat == 1, {Color.red},{Color.black})};
win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 575), false).front;
masterView = {
var updateTransport, updateSection,
view, generator, transport, countOff, ranSeed, order, tempo, sectionDisplay, clock, metronome, address;
// this func updates the whole transport panel
updateTransport = {arg measure, beat;
clock.string = clockStringFunc.value(measure, beat);
metronome.stringColor = metronomeColorFunc.value(beat);
metronome.string = metronomeStringFunc.value(beat);
{0.75.wait; {metronome.string = ""}.defer}.fork(~tempoClock, quant: 0);
}.inEnvir;
// this func handles the movement between sections
updateSection = {arg shift, stop = true, manualCall = true;
var runThis;
runThis = (manualCall || (manualCall.not && ~autoAdvance));
runThis = runThis && ((currentSection + shift) < ~sectionOrder.size);
runThis = runThis && (((currentSection % 4) == 3) && ~interludes && manualCall.not).not;
if(runThis, {
var truncOnly, section, subSection;
if(~isPlaying, {
if(stop, {
~patterns[~sectionOrder[currentSection]].stop
})
});
truncOnly = case
{(currentSection + shift) < 0} {true}
{(shift < 0) && ~isPlaying} {true}
{(shift < -1) && ((currentSection % 4) > 0)} {true}
{true} {false};
if(truncOnly.not, {
currentSection = (currentSection + shift).trunc(shift.abs);
}, {
currentSection = currentSection.trunc(shift.abs);
});
section = ((~sectionOrder[currentSection] / 4) + 1).asInteger;
subSection = ((~sectionOrder[currentSection] % 4) + 1).asInteger;
sectionDisplay.string = "section: " ++ section.asString ++ "." ++ subSection.asString;
if(~isPlaying, {
countOff = {
if(~interludes && ((currentSection % 4) == 0), {
Pbind(
\instrument, \click ++ ~hash,
\beat, Pseq([1, 2, 1, 2]),
\dur, 1
).play(~tempoClock, quant: 0);
[1, 2, 1, 2].do({arg beat;
{
metronome.stringColor = metronomeColorFunc.value(beat);
metronome.string = metronomeStringFunc.value(beat);
}.defer;
0.75.wait;
{metronome.string = ""}.defer;
0.25.wait;
});
});
~play.set(\sel, currentSection % 2);
~patterns[~sectionOrder[currentSection]].play(~tempoClock, quant: 0);
if(~interludes && ((currentSection % 4) == 3) && (currentSection != (~sectionOrder.size - 1)), {
var center, interval, freq1, freq2, tremRate;
center = 50 - 12.0.rand;
interval = 3.0.rand + 2;
freq1 = (center + (interval / 2)).midicps;
freq2 = (center - (interval / 2)).midicps;
tremRate = 50 + 4.0.rand2;
~interludeTremelo.set(\gate, 1, \amp, 1, \freq1, freq1, \freq2, freq2, \tremRate, tremRate);
});
if((currentSection % 4) == 0, {
~interludeTremelo.set(\gate, 0);
});
if(((currentSection % 4)) != 0 && ((currentSection % 4) != 3), {
~interludeTremelo.set(\gate, 0, \amp, 0);
});
}.fork(~tempoClock, quant: 0);
}, {
var measure, beat;
measure = ~sectionStartMeasure[~sectionOrder[currentSection]];
beat = 1;
updateTransport.value(measure, beat);
});
});
}.inEnvir;
// these funcs receive messages from the synth
OSCFunc({ arg msg, time;
{
var measure, beat;
measure = msg[3];
beat = msg[4];
updateTransport.value(measure, beat)
}.inEnvir.defer;
},'/measureClock' ++ ~hash, s.addr);
OSCFunc({ arg msg, time; {updateSection.value(1, false, false)}.inEnvir.defer},'/nextSubsection' ++ ~hash, s.addr);
OSCdef(\externalAdvance ++ ~hash, {arg msg, time; {updateSection.value(1)}.inEnvir.defer},'/nextSubsection', s.addr);
view = View(win);
generator = HLayout(
ranSeed = TextField(view, Rect(10, 10, 10, 20)).string_("20200525"),
Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "20200525"}.inEnvir),
Button(view).states_([["random seed"]]).action_({ ranSeed.string = 50000000.rand.asString}.inEnvir),
Button(view).states_([["generate"]]).action_({
{~genAll.value(ranSeed.string.asInteger); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: generating"}.inEnvir),
Button(view).states_([["transcribe"]]).action_({
{~transcribe.value(~scoreData, ranSeed.string); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: transcribing"}.inEnvir),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1], nil);
transport = HLayout(
Button(view).states_([["<<", Color.black]]).action_({arg pState; updateSection.value(-4)}.inEnvir),
Button(view).states_([["<", Color.black]]).action_({arg pState; updateSection.value(-1)}.inEnvir),
Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_(
{arg pState;
if(pState.value == 0, {
var measure, beat;
countOff.stop;
~isPlaying = false;
~patterns[~sectionOrder[currentSection]].stop;
~interludeTremelo.set(\gate, 0);
measure = ~sectionStartMeasure[currentSection];
beat = 1;
updateTransport.value(measure, beat);
~interludeTremelo.set(\gate, 0, \amp, 0);
},{
countOff = {
Pbind(
\instrument, \click ++ ~hash,
\beat, Pseq([1, 2, 1, 2]),
\dur, 1
).play(~tempoClock, quant: 0);
[1, 2, 1, 2].do({arg beat;
{
metronome.stringColor = metronomeColorFunc.value(beat);
metronome.string = metronomeStringFunc.value(beat);
}.defer;
0.75.wait;
{metronome.string = ""}.defer;
0.25.wait;
});
~isPlaying = true;
~play.set(\sel, currentSection % 2);
~patterns[~sectionOrder[currentSection]].play(~tempoClock, quant: 0);
if(~interludes && ((currentSection % 4) == 3) && (currentSection != (~sectionOrder.size - 1)), {
var center, interval, freq1, freq2, tremRate;
center = 50 - 12.0.rand;
interval = 3.0.rand + 2;
freq1 = (center + (interval / 2)).midicps;
freq2 = (center - (interval / 2)).midicps;
tremRate = 50 + 4.0.rand2;
~interludeTremelo.set(\gate, 1, \amp, 1, \freq1, freq1, \freq2, freq2, \tremRate, tremRate);
});
}.fork(~tempoClock, quant: 0);
})
}.inEnvir
),
Button(view).states_([[">", Color.black]]).action_({arg pState; updateSection.value(1)}.inEnvir),
Button(view).states_([[">>", Color.black]]).action_({arg pState; updateSection.value(4)}.inEnvir), nil,
sectionDisplay = StaticText(win).string_("section: 1.1").font_(Font("Liberation Mono", 70)), nil);
view.layout_(HLayout(
[VLayout(
HLayout(clock = StaticText(win).string_(" 1.1").font_(Font("Liberation Mono", 200)),
StaticText(win).string_("|").font_(Font("Liberation Mono", 200)),
metronome = StaticText(win).string_([-30, -105, -104].collect({arg int; int.asAscii}).as(String)).font_(Font("Liberation Mono", 300)).stringColor_(Color.red)),
nil, transport, nil,
HLayout(
tempo = TextField(view).string_("90"),
Button(view).states_([["set tempo"]]).action_({~tempoClock.tempo = tempo.string.asInteger / 60}.inEnvir),
StaticText(view).string_(" | "),
Button(view).states_([["auto advance", Color.black], ["auto advance", Color.black, Color.grey]]).action_({
arg v; ~autoAdvance = if(v.value == 0, {false}, {true});~autoAdvance;
}.inEnvir).value_(1),
Button(view).states_([["interludes", Color.black], ["interludes", Color.black, Color.grey]]).action_({
arg v; ~interludes = if(v.value == 0, {false}, {true})
}.inEnvir),
StaticText(view).string_(" | "),
address = TextField(view, Rect(10, 10, 10, 20)).string_("127.0.0.1:57120"),
Button(view).states_([["set address:port"]]).action_({
var addr, ip, port;
addr = address.string.split($:);
ip = addr[0];
port = addr[1].asInteger;
thisProcess.openUDPPort(port);
addr = NetAddr(ip, port);
OSCdef(\externalAdvance ++ ~hash, {arg msg, time; {updateSection.value(1)}.inEnvir.defer},'/nextSubsection', addr);
}.inEnvir),
[StaticText(view).string_(" "), stretch: 1]),
[StaticText(view).string_(" "), stretch: 1],
HLayout(
order = TextField(view).string_("1-16"),
Button(view).states_([["set order"]]).action_({
~patterns[~sectionOrder[currentSection]].stop;
~sectionOrder = order.string.split($,).collect({arg secEntry;
var bounds;
bounds = secEntry.split($-).collect({arg item; item.asInteger - 1});
((bounds.minItem)..(bounds.maxItem)).collect({arg sec;
(sec.asInteger * 4) + [0, 1, 2, 3]
});
}).flat;
currentSection = 0;
updateSection.value(0);
}.inEnvir),
[StaticText(view).string_(" "), stretch: 1]),
[StaticText(view).string_(" "), stretch: 1], generator
), alignment: \top]))};
faderView = {
var view, masterIndicators, trackIndicators, master, tracks;
view = View(win);
masterIndicators = {LevelIndicator()} ! 2;
trackIndicators = {LevelIndicator()} ! 6;
OSCFunc.new({arg msg; {
{arg i; masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer},
'/masterLevels' ++ ~hash, s.addr);
OSCFunc.new({arg msg; {
{arg i; trackIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 6}.defer},
'/trackLevels' ++ ~hash, s.addr);
master = 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]), stretch: 2],
Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{arg v; masterMute = (1 - v.value).abs; ~play.set(\masterMute, masterMute)}.inEnvir),
StaticText(view).string_(" master ").align_(\center)
), nil);
tracks = {arg part;
HLayout(
VLayout(
HLayout(
Slider(view).value_(0.8).action_(
{arg v; partVols[part] = v.value * 1.25; ~play.set(partAbbr[part] ++ "Vol", partVols[part])}.inEnvir),
trackIndicators[part]),
Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{arg v; partMutes[part] = (1 - v.value).abs; ~play.set(partAbbr[part] ++ "Mute", partMutes[part])}.inEnvir).value_(
{if((part == 0) || (part == 5), {1}, {0})}.value),
StaticText(view).string_("pan").align_(\center),
Knob(view).value_(0.5).action_(
{arg v; partPans[part] = v.value * 2 - 1; ~play.set(partAbbr[part] ++ "Pan", partPans[part])}.inEnvir),
StaticText(view).string_(trackNames[part]).align_(\center)
),
nil)
} ! 6;
view.layout_(HLayout(master, nil, *tracks))};
helpView = {
TextView(win).string_(File.readAllString(~dir +/+ "cicc_readme.scd")).editable_(false);
};
tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; helpButton.value = 1};
win.layout = VLayout(
HLayout(
HLayout(
[
transportButton = Button().states_([["transport", Color.white, Color.grey], ["transport", Color.black]]).action_(
{tabButtonReset.value; transportButton.value = 0; tabs.index = 0 }.inEnvir).value_(0), stretch: 1
], [
mixerButton = Button().states_([["mixer", Color.white, Color.grey], ["mixer", Color.black]]).action_(
{tabButtonReset.value; mixerButton.value = 0; tabs.index = 1 }.inEnvir).value_(1), stretch: 1
]
),
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, faderView.value, helpView.value));
};
*/
)

@ -38,32 +38,6 @@ s.waitForBoot({
4.collect({arg p; Synth.new(\clip_ ++ ~hash, [\bin, ~accompBusses[p].index, \bus, ~postampBusses[5].index])});
~generateGUI.value;
"ready".postln;
// generate all the data
/*
~genAll = {arg seed;
~allMusicData = ~genMusicData.value(seed);
~patterns = ~allMusicData[0];
~scoreData = ~allMusicData[1];
~sectionOffsets = ~allMusicData[2];
~currentSection = 0;
~currentSubsection = 0;
~isPlaying = false;
};
// set the global variables
~tempoClock = TempoClock.new(60);
~dir = thisProcess.nowExecutingPath.dirname;
"loading app".postln;
~genAll.value(20200525);
~play = Synth.new(\masterPlayerControl ++ ~hash);
~sectionOrder = ~patterns.size.collect({arg sec; sec});
~generateGUI.value;
"ready".postln;
*/
});
appEnvironment.pop;
)

@ -264,14 +264,16 @@ distributeRoots = {arg modeState, lastRoots;
};
genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
var trans, root, mults, rootMod, amp, firstChange, cadence, ensData;
var trans, root, mults, rootMod, amp, firstChange, cadence, lastInsRef, flutEx, ensData;
trans = pow(2, [1, 0, 1, 2][partState[\index]]);
# root, mults, rootMod = roots[part];
amp = [0, 1, 2, 3].wchoose([0, 2, 2, 2].normalizeSum);
firstChange = false;
cadence = if(collectRoots.value(modeState).size == 1, {true}, {false});
lastInsRef = nil;
if(offset == 0, {cadence = false});
flutEx = hdChoose.value(mults, 0.5);
ensData = [];
temporalData.do({arg val, ts;
@ -333,6 +335,11 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
partState[\lastFreq] = freq;
partState[\lastFreqRatio] = freqRatio;
insRef = roots.slice(nil, 0).deepCopy.drop(1).indexOfEqual(root) + 1;
insRef = if(lastInsRef != insRef, {lastInsRef = insRef; insRef}, {lastInsRef = insRef; nil});
});
if((partState[\index] == 0) && cadence, {
insRef = if(firstChange.not, {1}, {nil});
//freq = 36.midicps * trans * 2 * frToFloat.value(frAdd.value(root, flutEx));
});
rootFreq = 36.midicps * trans * frToFloat.value(root);
@ -418,18 +425,18 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
~genMusicData = {arg seed;
var totalDur, section1Dur, dUnit, curLen, cadence,
var totalDur, section1Dur, dUnit, curLen, cadence, ultimate,
totalLen, section1Len,
modeState, temporalState, partStates,
lastCadenceTemporalData, lastCadenceState, lastSectionPoint,
ensData, accompData, bassData, ampData,
sectionData, sectionNavDict,
sectionCount, subsectionCount,
lastRoots, roots;
lastRoots, roots, ampDataTmp;
thisThread.randSeed = seed;
# totalDur, section1Dur, dUnit, curLen, cadence = [6 * 60, 2 * 60, 8.reciprocal, 0, false];
# totalDur, section1Dur, dUnit, curLen, cadence, ultimate = [6 * 60, 2 * 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];
@ -449,7 +456,7 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
roots = distributeRoots.value(modeState, lastRoots);
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]);
[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);
4.do({arg part;
@ -467,7 +474,7 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
});
subsectionCount = subsectionCount + 1;
thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount);
thisThread.randSeed = (seed + (sectionCount * 200) + subsectionCount);
if(curLen == 0, {
lastCadenceTemporalData = temporalData;
@ -478,7 +485,6 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
if(curLen > section1Len, {
if(collectRoots.value(modeState).size == 1, {
var ampDataTmp;
ampData[0] = ampData[0] ++ genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 0);
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 1);
@ -494,19 +500,24 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false);
});
sectionData.add(((curLen - temporalData[0].size).postln / 4).asInteger->
sectionData[((curLen - temporalData[0].size).postln / 4).asInteger].put(5, true));
# sectionCount, subsectionCount = [sectionCount + 1, 1];
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
cadence = true;
}, {
cadence = false
});
modeState = advanceMode.value(modeState, lastCadenceState);
});
});
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, [[1], [1], [1], [1]], lastSectionPoint, lastSectionPoint + 80, 2);
ampData[2] = ampData[2] ++ ampDataTmp;
bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false);
[ensData, accompData, bassData, ampData, sectionData, sectionNavDict]
};
//~genMusicData.value(100)
~genMusicData.value(100)
)

@ -86,7 +86,7 @@ formatPatternData = {arg musData, measureLen;
measureLen = ((
ensData.collect({arg partData; partData.last[1]}) ++
accompData.flatten.collect({arg partData; partData.last[1]})
).maxItem.ceil(16) / 16).asInteger;
).maxItem.ceil(16) / 16).asInteger + 1;
ensDataFormatted = formatPatternData.value(ensData, measureLen);
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);

@ -95,12 +95,22 @@ lyHBracket = {arg fr, yOffset, sPair1, sPair2, edgeH1, edgeH2;
"-\\tweak HorizontalBracketText.text" + fr + "\\startGroup \n "
};
lyRelMark = {arg root, lastRoot;
lyRelMark = {arg root, lastRoot, section, subsection;
var sectionMark;
sectionMark = "\\mark \\markup { \\bold \\override #'(box-padding . 0.5) \\box " ++ section ++ "." ++ subsection ++ " } \n";
if((section == 1) && (subsection > 1),
{
"\\once \\override Score.RehearsalMark.self-alignment-X = #0 \n " ++
"\\once \\override Score.RehearsalMark.Y-offset = #5 \n " ++
"\\once \\override Score.RehearsalMark.X-offset = #1 \n " ++
sectionMark
}, {
"\\mark \\markup { \n" ++
"\\halign #-1 \n " ++
"\\relMark ##{ { \n " ++
"\\time 15/8 \n " ++
"\\once \\override Staff.Clef #'stencil = ##f \n " ++
sectionMark ++
lyRelMarkNote.value(root, lastRoot, 1, "bass") ++ "^\\markup{\\large \\raise #2 \"III\"}" ++
@ -119,18 +129,23 @@ lyRelMark = {arg root, lastRoot;
"\\stopGroup \\stopGroup \n " ++
"\\hide c''16 \n " ++
"}#}}"
});
};
// barline and ossia definition
lyMeasureDef = {arg sectionData, insName, part, measure;
var ossia = "", barline = "|";
lyMeasureDef = {arg sectionData, insName, part, beat;
var ossia = "", barline = "|", break = "";
if(sectionData != nil, {
var root, lastRoot;
root = sectionData[0]; lastRoot = sectionData[1];
ossia = lyRelMark.value(root, lastRoot);
var root, lastRoot, section, subsection;
# root, lastRoot, section, subsection = sectionData;
ossia = lyRelMark.value(root, lastRoot, section, subsection);
barline = "\\bar \"||\"";
if(sectionData[4], {barline = "\\bar \"|.|\""});
if(sectionData[5], {barline = "\\bar \".|\""});
});
if(measure != 0, {"}\n>>\n" + barline}, {""}) + "\n<<\n" ++ ossia + "{"
if((beat % 16) == 0, {break = "\\break \\noPageBreak"});
if((beat % (16 * 3)) == 0, {break = "\\pageBreak"});
if(beat != 0, {"}\n>>\n" + barline + break}, {""}) + "\n<<\n" ++ ossia + "{"
};
// add tie

Loading…
Cancel
Save