code cleanup and file location organization

main
mwinter 4 years ago
parent 1e91bc864f
commit 011690056e

@ -79,8 +79,8 @@
print-first-page-number = ##t
print-page-number = ##t
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"} }}}}
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 {
"-"
@ -100,6 +100,7 @@
\header {
title = \markup { \italic {to kill a monarch}}
composer = \markup \right-column {"michael winter" "(berlin, germany; 2020)"}
poet = "seed: 19800725"
tagline = ""
}
@ -136,15 +137,6 @@
(minimum-distance . 20 )
(padding . 0 )
(stretchability . 0))
%\override TimeSignature.font-size = #2
%\override TimeSignature.break-align-symbol = #'clef
%\override TimeSignature.X-offset =
% #ly:self-alignment-interface::x-aligned-on-self
%\override TimeSignature.self-alignment-X = #LEFT
%\override TimeSignature.Y-offset = #9
%\override TimeSignature.extra-offset = #'(2 . 0)
%\override TimeSignature.break-visibility = #end-of-line-invisible
\override TextScript.staff-padding = #2
\override TextScript.self-alignment-X = #0
}
@ -167,7 +159,6 @@
\midi { }
%showLastLength = R1*10
\score{
\new Score
<<
@ -184,5 +175,3 @@
\layout{}
\midi{}
}
%\markup { \center-column { \override #'(offset . 5) \underline "3" \override #'(offset . 5) \underline " 2 " \override #'(offset . 5) \underline "1" " 1 " } }

@ -0,0 +1,177 @@
\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 = 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 {\pad-markup #2 { \concat {\italic {"to kill a monarch "} (seed: xxx)}}}}}}
evenHeaderMarkup = \markup { \fill-line { \line { \on-the-fly #not-first-page {\pad-markup #2 { \concat {\italic {"to kill a monarch "} (seed: xxx)}}}}}}
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; 2020)"}
poet = "seed: xxx"
tagline = ""
}
#(set-global-staff-size 11)
\layout {
indent = 0.0\cm
line-width = 17.5\cm
ragged-last = ##t
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
<<
\new SemiStaffGroup {
<<
\include "includes/part_I.ly"
\include "includes/part_II.ly"
\include "includes/part_III.ly"
>>
}
\include "includes/part_star.ly"
>>
\layout{}
\midi{}
}

@ -1,26 +1,7 @@
(
var genWindow, masterView, faderView, buildGenerator, buildMetronome, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader,
updateSection, updateSubsection, clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport,
currentSection = 1, currentSubsection = 1;
buildGenerator = {arg view;
var ranSeed;
HLayout(
ranSeed = TextField(view).string_("19800725"),
Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "19800725"}.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),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
Button(view).states_([["transcribe"]]).action_({
{~transcribe.value(~scoreData, ~sectionData); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: transcribing"}.inEnvir),
Button(view).states_([["bounce audio"]]).action_({
{~bounceAudio.value; ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: bouncing audio"}.inEnvir),
nil)
};
var clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSubsection,
buildGenerator, buildMetronome, updateSection, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader,
masterView, faderView, currentSection = 1, currentSubsection = 1;
// these funcs update the elements of the transport panel
clockStringFunc = {
@ -46,6 +27,38 @@ updateTransport = {arg clock, metronome, sectionDisplay, measure, beat, section,
{0.75.wait; {metronome.string = ""}.defer}.fork(~tempoClock, quant: 0);
}.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;
var ranSeed;
HLayout(
ranSeed = TextField(view).string_("19800725"),
Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "19800725"}.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),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
Button(view).states_([["transcribe"]]).action_({
{~transcribe.value(~scoreData, ~sectionData, ranSeed.value); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: transcribing"}.inEnvir),
Button(view).states_([["bounce audio"]]).action_({
{~bounceAudio.value(ranSeed.value); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: bouncing audio"}.inEnvir),
nil)
};
buildMetronome = {arg win;
var clock, metronome, layout;
@ -90,21 +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;
var sec, subsec, sectionDisplay, layout, player;
@ -116,14 +114,10 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
# measure, beat, section, subsection = msg[3..];
currentSection = sec = section.asInteger;
currentSubsection = subsec = subsection.asInteger;
//currentSubsection.postln;
updateTransport.value(clock, metronome, sectionDisplay, measure, beat, section, subsection);
}.inEnvir.defer;
},'/measureClock_' ++ ~hash, s.addr);
//OSCdef(\externalAdvance ++ ~hash, {arg msg, time; {updateSection.value(1, clock, metronome, sectionDisplay, false)}.inEnvir.defer},'/nextSubsection_' ++ ~hash, s.addr);
layout = HLayout(
Button(view).states_([["<<", Color.black]]).action_({arg pState; updateSection.value(-1, clock, metronome, sectionDisplay)}.inEnvir),
Button(view).states_([["<", Color.black]]).action_({arg pState; updateSubsection.value(-1, clock, metronome, sectionDisplay)}.inEnvir),
@ -145,12 +139,11 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
~patternProxy.play(~tempoClock, quant: 0)
}.fork(~tempoClock, quant: 0)
}, {
//subsec.postln;
~patternProxy.pause;
//player.stop;
updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection.postln, currentSubsection.postln);
currentSection, currentSubsection);
});
}.inEnvir),
Button(view).states_([[">", Color.black]]).action_({arg pState; updateSubsection.value(1, clock, metronome, sectionDisplay)}.inEnvir),
@ -170,17 +163,17 @@ buildTempoControl = {arg view;
buildMasterFader = {arg view, masterVol, masterMute, masterIndicators;
HLayout(
HLayout([
VLayout(
[HLayout(
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],
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),
StaticText(view).string_(" master ").align_(\center)
), nil)
StaticText(view).string_("master").align_(\center)
), stretch: 2], nil)
};
@ -203,7 +196,7 @@ buildTrackFader = {arg view, name, index, initVal;
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)
), //[StaticText(view).string_(" "), stretch: 0.1]
),
StaticText(view).string_(name).align_(\center)
),
nil)
@ -224,7 +217,7 @@ masterView = {arg win, preampBusses, accompBusses, postampBusses;
[
VLayout(
metronomeLayout,
[StaticText(view).string_(" "), stretch: 1], //nil
[StaticText(view).string_(" "), stretch: 1],
transportLayout,
[StaticText(view).string_(" "), stretch: 1],
auxControlsLayout,
@ -283,5 +276,4 @@ faderView = {arg win;
),
tabs = StackLayout(masterView.value(win, preampBusses, accompBusses, postampBusses), faderView.value(win)/*, helpView.value*/));
};
//~generateGUI.value
)

@ -4,8 +4,8 @@
var appEnvironment;
//push new environment
//appEnvironment = Environment.make;
//appEnvironment.push;
appEnvironment = Environment.make;
appEnvironment.push;
s.waitForBoot({
var preampBusses, accompBusses, postampBusses;
@ -44,5 +44,5 @@ s.waitForBoot({
~generateGUI.value(preampBusses, accompBusses, postampBusses);
"ready".postln;
});
//appEnvironment.pop;
appEnvironment.pop;
)

@ -82,7 +82,7 @@ hdChoose = {arg mode, exp = 1, weights = [1, 1, 1, 1, 1, 1, 1];
mode.wchoose(probs.normalizeSum)
};
//!!!!this is not returning the same thing when if randseed is set. the issue is the array as key and sorting.
//faster sorting algorithm?
wchooseDict = {arg dict, exp = 1, limit = 0;
var keyList, probs;
keyList = dict.keys.asList.sort({arg a, b; a.asString < b.asString});
@ -116,7 +116,7 @@ initModeState = {
};
advanceMode = {arg lastModeState, lastCadenceState;
var frSet, curModeState, curRoots, lastRoots, lastCadenceRoot, changeCount;
var curModeState, curRoots, lastRoots, lastCadenceRoot, changeCount;
curModeState = lastModeState.deepCopy;
curRoots = collectRoots.value(curModeState);
@ -156,9 +156,7 @@ advanceMode = {arg lastModeState, lastCadenceState;
if(curModeState.includesKey(new), {
//bump if it gets chosen again
curModeState[new][\count] = curModeState[new][\count] + 1;
//"ran0".postln;
if((curModeState[new][\count] >= 20), {
//"ran1".postln;
curModeState[new][\root] = [rootSel, curModeState[rootSel][\mode]]
});
}, {
@ -167,7 +165,6 @@ advanceMode = {arg lastModeState, lastCadenceState;
old = frNearestInList.value([new, rootSel], curModeState);
if(curModeState[old][\count] >= 20, {
var mode, root;
//"ran2".postln;
mode = genMode.value;
root = [rootSel, curModeState[rootSel][\mode]];
curModeState.add(new ->
@ -196,7 +193,6 @@ genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
curTupleState = lastTupleState.deepCopy;
timeToNextEvent = (64 + 50.rand + if(cadence, {50}, {0})).round(16);
tuple = wchooseDict.value(curTupleState);
//curTupleState = curTupleState.collect({arg dict; dict[\count] + 1});
if(cadence, {tuple = [1, 1, 1]});
curTupleState = curTupleState.keysValuesDo({arg key, val;
curTupleState[key][\count] = val[\count] + 1});
@ -211,10 +207,8 @@ genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
flourish = (if(cadence, {16}, {8}) + 32.rand).collect({[0, 1].wchoose([flourishDensity, 1].normalizeSum)});
buffer = 16.collect({0});
//beforeLen = if(cadence, {32.rand}, {((timeToNextEvent - flourish.size - buffer.size) / 2).asInteger.rand});
beforeLen =((timeToNextEvent - flourish.size - buffer.size) / if(cadence, {1.25}, {1})).asInteger.rand;
before = beforeLen.collect({arg i; [0, 1].wchoose([genDensity, 0.25].normalizeSum)});
//if(collectRoots.value(modeState).size == 1, {before = [0]});
after = (timeToNextEvent - before.size - flourish.size - buffer.size).collect({[0, 1].wchoose([genDensity, 1].normalizeSum)});
flourish = before ++ flourish ++ after;
if(flourish.sum == 0, {flourish[flourish.size.rand] = 1});
@ -240,8 +234,7 @@ initPartStates = {
)
};
//this is how a root is chosen this is where we need much more consideration / work
//change this to a dictionary
//this is how roots are distributed to the parts
distributeRoots = {arg modeState, lastRoots;
var roots;
roots = modeState.keys.asList.collect({arg fr; modeState[fr][\root]});
@ -250,8 +243,6 @@ distributeRoots = {arg modeState, lastRoots;
roots = [roots[0]] ++ roots[..2].scramble;
roots = 4.collect({arg part;
var root, rootMod, rootFreq, mode;
//root = modeState.keys.collect({arg fr; modeState[fr][\root]}).choose;
//if(part == 0, {root = roots[0]});
root = roots[part];
rootMod = frDiff.value(root[0], lastRoots[part]);
rootFreq = 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(root[0]);
@ -267,7 +258,7 @@ distributeRoots = {arg modeState, lastRoots;
};
genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
var trans, root, mults, rootMod, amp, firstChange, cadence, lastInsRef, flutEx, ensData;
var trans, root, mults, rootMod, amp, firstChange, cadence, lastInsRef, ensData;
trans = pow(2, [1, 0, 1, 2][partState[\index]]);
# root, mults, rootMod = roots[part];
@ -276,7 +267,6 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
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;
@ -295,7 +285,7 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
if(change, {
var mult, multWeights, freq, rootFreq, insRef;
//this is is not working correctly
//check that this is working correctly
multWeights = mults.collect({arg fr;
var comp = frCollapse.value(frAdd.value(root, fr));
if(modeState.keys.includes(comp), {3}, {1}) * pow(partState[\multCounts][fr], 1);
@ -328,7 +318,7 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
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]]});
continue = true;
//something is still not right here
//check that this is working correctly
while({continue}, {
# freqRatio, root, mult = mode[partState[\noteCount] % 15];
freq = 36.midicps * trans * frToFloat.value(frAdd.value([[1], [1]], freqRatio));
@ -342,7 +332,6 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
});
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);
@ -380,6 +369,7 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
accompData
};
//~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
genBassPart = {arg root, ampCurve, hi;
var freq;
@ -389,6 +379,7 @@ genBassPart = {arg root, ampCurve, hi;
ampCurve.collect({arg sec, iter; [freq, sec[1]]})
};
//~~~~~~~~~~~~GENERATE AMP CURVES~~~~~~~~~~~~
genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
var firsts1, firsts2, delay, attack, decay, release, min, max, env;
@ -420,7 +411,6 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
{2} {1} ;
env = Env.dadsr(delay, attack, decay, 0.25, release, curve: \cub).range(min, max);
((delay + attack + decay + release) / 1).asInteger.collect({arg iter; [env.at(iter * 1), offset1 + (iter * 1)]})
};
@ -506,9 +496,8 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
sectionData.add(((curLen - temporalData[0].size) / 4).asInteger->
sectionData[((curLen - temporalData[0].size) / 4).asInteger].put(5, true));
(subsectionCount - 1).do({arg subsectionIndex;
sectionNavDict.add([sectionCount, subsectionIndex + 1]->[sectionNavDict[[sectionCount, subsectionIndex + 1]].postln[0], subsectionCount - 1]);
sectionNavDict.add([sectionCount, subsectionIndex + 1]->[sectionNavDict[[sectionCount, subsectionIndex + 1]][0], subsectionCount - 1]);
});
//sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger, subsectionCount]);
# sectionCount, subsectionCount = [sectionCount + 1, 1];
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
cadence = true;
@ -525,7 +514,5 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
[ensData, accompData, bassData, ampData, sectionData, sectionNavDict]
};
//~genMusicData.value(100)
)

@ -14,10 +14,6 @@ var formatPatternData;
~defineSynths = {arg server, preampBusses, accompBusses, postampBusses;
var sdPlayer, sdTransport, sdClick, sdAmpCurve, sdEns, sdAccomp, sdClip, sdBass, sdDiskOut, allSds;
//~postampBusses = 7.collect({Bus.audio(server, 1)});
//~preampBusses = 3.collect({Bus.audio(server, 1)});
//~accompBusses = 4.collect({Bus.audio(server, 1)});
sdPlayer = SynthDef(\masterPlayerControl_ ++ ~hash, {
var sigs, sigsPanned, masterSig, imp;
@ -97,6 +93,8 @@ formatPatternData = {arg musData, measureLen;
//~~~~~~~~~~~~GENERATE PATTERNS~~~~~~~~~~~~
//this generates patterns grouped by measures except for bass data and amp curve data which are much higher resolution
//these are used to make playable patterns
~genPatterns = {arg ensData, accompData, bassData, ampData, sectionData, preampBusses, accompBusses, postampBusses;
var measureLen, ensDataFormatted, accompDataFormatted, bassDataFormatted, ampDataFormatted,
dUnit, section, subsection, patterns;
@ -108,8 +106,6 @@ formatPatternData = {arg musData, measureLen;
ensDataFormatted = formatPatternData.value(ensData, measureLen);
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
//bassDataFormatted = formatPatternData.value(bassData[..0], measureLen);
//ampDataFormatted = formatPatternData.value([ampData, ampData, ampData, ampData], measureLen);
dUnit = 8.reciprocal;
patterns = measureLen.collect({arg measure;
@ -118,6 +114,7 @@ formatPatternData = {arg musData, measureLen;
subsection = sectionData[measure * 4][3];
});
Ppar(
//check how amplitude is being handled
ensDataFormatted[measure].collect({arg musData, m;
Pbind(
\instrument, \ens_ ++ ~hash,
@ -126,11 +123,11 @@ formatPatternData = {arg musData, measureLen;
\sustain, Pseq(musData[2] * dUnit),
\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);
// * musData[3].collect({arg val; if(val < 0.25, {0}, {0.5})}))
\ampBus, preampBusses[0].index,
\bus, postampBusses[m].index
)
}) ++
//check how amplitude and attack are being handled
accompDataFormatted[measure].collect({arg musData, m;
Pbind(
\instrument, \accomp_ ++ ~hash,
@ -164,6 +161,8 @@ formatPatternData = {arg musData, measureLen;
[patterns, bassData, ampData]
};
//this is a playable pattern based on start measure
~genPlayablePatterns = {arg startMeasure, patterns, preampBusses, accompBusses, postampBusses;
Ppar(
[Pseq(patterns[0][startMeasure..], 1)] ++
@ -187,13 +186,16 @@ formatPatternData = {arg musData, measureLen;
};
~bounceAudio = {
var basePath, server, buffers, recDur,
//~~~~~~~~~~~~BOUNCE AUDIO~~~~~~~~~~~~
//this bounces the audio for use in another DAW or for practice
~bounceAudio = {arg seed;
var trackNames, basePath, server, buffers, recDur,
preampBusses, nextNode, accompBusses, postampBusses,
synths, prePatterns, playablePatterns, score;
//dir = thisProcess.nowExecutingPath.dirname;
basePath = ~dir +/+ ".." +/+ "audio";
trackNames = ["part_start", "part_III", "part_II", "part_I", "accomp_I", "accomp_II", "click"];
basePath = ~dir +/+ ".." +/+ "audio" +/+ "seed_" ++ seed;
basePath.mkdir;
server = Server(\nrt_ ++ ~hash,
@ -203,7 +205,7 @@ formatPatternData = {arg musData, measureLen;
);
# preampBusses, accompBusses, postampBusses = ~allocBusses.value(s);
postampBusses = 7.collect({arg index; Bus.new(rate: 'audio', index: index.postln, numChannels: 1, server: server)});
postampBusses = 7.collect({arg index; Bus.new(rate: 'audio', index: index, numChannels: 1, server: server)});
synths = ~defineSynths.value(s, preampBusses, accompBusses, postampBusses);
prePatterns = ~genPatterns.value(~musicData[0], ~musicData[1], ~musicData[2], ~musicData[3], ~sectionData,
@ -212,28 +214,20 @@ formatPatternData = {arg musData, measureLen;
playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses);
recDur = (prePatterns[2][0].size / 8) + 10;
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;
score.score.last.postln;
nextNode.postln;
synths.do({arg synth; score.add([0.0, [\d_recv, synth.asBytes]])});
4.collect({arg p;
//Synth.new(\clip_ ++ ~hash, [\bin, accompBusses[p].index, \bus, postampBusses[5].index])
score.add([0.0, [\s_new, \clip_ ++ ~hash, nextNode, 1, 1, \bin, accompBusses[p].index, \bus, postampBusses[5].index]]);
nextNode = nextNode + 1;
});
buffers = 7.do({arg track;
score.add([0.0, [\b_alloc, track, 65536, 1]]);
score.add([0.0, [\b_write, track, basePath +/+ "test_" ++ track ++ ".wav".standardizePath, "WAV", "int16", 0, 0, 1]]);
score.add([0.0, [\b_write, track, basePath +/+ "tkam_" ++ trackNames[track] ++ ".wav".standardizePath, "WAV", "int16", 0, 0, 1]]);
score.add([0.0, [\s_new, \disk_out_ ++ ~hash, nextNode, 1, 1, \bufnum, track, \inbus, track]]);
score.add([recDur, [\n_free, nextNode]]);
score.add([recDur, [\b_close, track]]);
score.add([recDur, [\b_free, track]]);
@ -243,7 +237,7 @@ formatPatternData = {arg musData, measureLen;
score.sort;
score.recordNRT(
outputFilePath: basePath +/+ "test_all" ++ ".wav".standardizePath,
outputFilePath: basePath +/+ "tkam_all" ++ ".wav".standardizePath,
sampleRate: 44100,
headerFormat: "WAV",
sampleFormat: "int16",
@ -253,7 +247,4 @@ formatPatternData = {arg musData, measureLen;
server.remove;
}
)
//~bounceAudio.value

@ -28,7 +28,7 @@ formatMusicData = {arg rawMusicData;
musicData
};
// constants (spelling dictionaru note names and octaves)
// constants (spelling dictionary note names and octaves)
spellingDict = Dictionary.with(*
[
\major -> Dictionary.with(*
@ -67,7 +67,6 @@ lyFinalizeMusic = {arg lyStr, part, name, nameShort, nameMidi, clef;
"<<\n\n{ " +
"\n\\set Score.markFormatter = #format-mark-box-numbers " +
"\\tempo 2 = 60\n" +
//if(part != 0, {"\\override Staff.TimeSignature #'stencil = ##f"}, {""}) +
"\\numericTimeSignature \\time 2/2\n" +
"\\clef " ++ clef ++ "\n" ++ lyStr ++
" }>> \\bar \"|.\" \n} \n\n>>" ++
@ -114,7 +113,6 @@ lyRelMark = {arg root, lastRoot, section, subsection;
lyRelMarkNote.value(root, lastRoot, 1, "bass") ++ "^\\markup{\\large \\raise #2 \"III\"}" ++
//lyHBracket.value(root[part][4], 8.5, 0, 1, 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) ++
@ -222,12 +220,16 @@ consolidateNotes = {arg lyStr, part;
res.replace("<MARKUP", "").replace("MARKUP>", "");
};
~transcribe = {arg rawMusicData, sectionData;
var dir, basePath, musicData, insData, insNames, insNamesShort, insMidi, insClef;
~transcribe = {arg rawMusicData, sectionData, seed;
var basePath, scoreFile, musicData, insData, insNames, insNamesShort, insMidi, insClef;
//dir = thisProcess.nowExecutingPath.dirname;
basePath = ~dir +/+ ".." +/+ "lilypond";
basePath = ~dir +/+ ".." +/+ "lilypond" +/+ "seed_" ++ seed;
basePath.mkdir;
(basePath +/+ "includes").mkdir;
scoreFile = File(basePath +/+ "tkam_score.ly".standardizePath,"w");
scoreFile.write(File.readAllString(basePath +/+ ".." +/+ "template" +/+ "tkam_score_template.ly").replace("seed: xxx", "seed: " ++ seed));
scoreFile.close;
musicData = formatMusicData.value(rawMusicData);
@ -306,7 +308,6 @@ consolidateNotes = {arg lyStr, part;
lyStr = lyFinalizeMusic.value(lyStr, p, insNames[p], insNamesShort[p], insMidi[p], insClef[p]);
//consolidate notes and rests
("------------" ++ p).postln;
lyStr = consolidateNotes.value(lyStr, p);
//write file
@ -315,8 +316,6 @@ consolidateNotes = {arg lyStr, part;
});
};
//~hdTranscribe.value(~scoreData, ~sectionData);
//~~~~~~~~~~~~GENERATE SCORE DATA~~~~~~~~~~~~
~genScoreData = {arg ensData;

Loading…
Cancel
Save