first commit

main
Michael Winter 5 years ago
commit db5fce2c18

@ -0,0 +1,178 @@
\version "2.19.81"
\paper {
#(set-paper-size "a4" 'portrait)
top-margin = 1 \cm
bottom-margin = 1 \cm
left-margin = 2.5 \cm
ragged-bottom = ##t
page-breaking = #ly:minimal-breaking
top-system-spacing =
#'((basic-distance . 15 )
(minimum-distance . 15 )
(padding . 0 )
(stretchability . 0))
system-system-spacing =
#'((basic-distance . 30 )
(minimum-distance . 30 )
(padding . 0 )
(stretchability . 0))
last-bottom-spacing =
#'((basic-distance . 15 )
(minimum-distance . 15 )
(padding . 0 )
(stretchability . 0))
%min-systems-per-page = 5
%systems-per-page = 5
%max-systems-per-page = 5
print-page-number = ##t
oddHeaderMarkup = \markup { \on-the-fly #not-first-page "(cic)" }
evenHeaderMarkup = \markup { \on-the-fly #not-first-page "(cic)" }
oddFooterMarkup = \markup { \fill-line {
\on-the-fly #not-first-page
\concat {
"-"
\fontsize #1.5
\on-the-fly #print-page-number-check-first
\fromproperty #'page:page-number-string
"-"}}}
evenFooterMarkup = \markup { \fill-line {
\on-the-fly #not-first-page
\concat {
"-"
\fontsize #1.5
\on-the-fly #print-page-number-check-first
\fromproperty #'page:page-number-string
"-"}}}
}
\header {
title = \markup { \italic {Counterfeiting in Colonial Connecticut}}
%subtitle = \markup { \normal-text { from \italic{a history of the domino the problem}}}
composer = \markup \right-column {"michael winter" "(gatlinburg, tennessee; 2020)"}
tagline = ""
}
#(set-global-staff-size 11)
\layout {
indent = 0.0\cm
line-width = 17\cm
ragged-last = ##f
ragged-right = ##f
\context {
\Score
%\remove "Mark_engraver"
%\override BarNumber.extra-offset = #'(0 . 4)
\override BarNumber.stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print)
\override Stem.stemlet-length = #0.75
%\override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/4)
%\override SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/30)
proportionalNotationDuration = #(ly:make-moment 1/16)
%\override SpacingSpanner.strict-note-spacing = ##t
%\override SpacingSpanner.uniform-stretching = ##t
%\override TextSpanner.breakable = ##t
\remove "Separating_line_group_engraver"
%\override PaperColumn.used = ##t
%\override DynamicTextSpanner.style = #'none
}
\context {
\Staff
\override VerticalAxisGroup.staff-staff-spacing =
#'((basic-distance . 13 )
(minimum-distance . 13 )
(padding . 0 )
(stretchability . 0))
%\consists "Mark_engraver"
%\remove "Dot_column_engraver"
%\remove "Time_signature_engraver"
%\remove "Clef_engraver"
%\override StaffSymbol.line-count = #1
%\override NoteHead.no-ledgers = ##t
%\override RestCollision.positioning-done = #merge-rests-on-positioning
\override RehearsalMark.X-offset = #1
\override RehearsalMark.Y-offset = #4
\override VerticalAxisGroup.default-staff-staff-spacing =
#'((basic-distance . 16 )
(minimum-distance . 16 )
(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.after-line-breaking =
% #shift-right-at-line-begin
\override TimeSignature.Y-offset = #9
\override TimeSignature.extra-offset = #'(2 . 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 { }
%showLastLength = R1*128
\score{
\new Score
<<
\new SemiStaffGroup {
<<
\new Staff \with {
instrumentName = "oversound"
shortInstrumentName = "oversound"
midiInstrument = #"clarinet"
}
<<
\include "includes/cicc_high.ly"
>>
\new Staff \with {
instrumentName = "guitar"
shortInstrumentName = "guitar"
midiInstrument = #"electric guitar (jazz)"
}
<<
\include "includes/cicc_guitar.ly"
>>
\new Staff \with {
instrumentName = "undersound"
shortInstrumentName = "undersound"
midiInstrument = #"contrabass"
}
<<
\include "includes/cicc_low.ly"
>>
>>
}
>>
\layout{}
\midi{}
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,22 @@
{
\set Score.markFormatter = #format-mark-box-numbers \tempo 8 = 90
\numericTimeSignature \time 4/4
\clef "treble^8"
\bar "||" \mark \markup { \bold \box 1.1 }
\time 4/4
f''''1 ~ | f''''1 | R1 | r2. f''''4 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''2 ~ f''''8 [ r8 ] r4 | f''''1 ~ | f''''1 ~ | f''''8 [ r8 ] r2. | R1 | r4 r8 [ f''''8 ] ~ f''''2 ~ | f''''2. r4 | r8 [ f''''8 ] ~ f''''2. ~ | f''''1 ~ | f''''1 ~ | f''''1 | r4 r8 [ f''''8 ] ~ f''''2 ~ | f''''1 ~ | f''''4 ~ f''''8 [ r8 ] r2 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''2 ~ f''''8 [ r8 ] r4 | R1 | f''''1 ~ | f''''2. r4 | R1 | R1 | R1 | R1 | R1 | R1 |
\time 2/4
r2 | \bar "||" \mark \markup { \bold \box 1.2 }
\time 4/4
r8 [ d''''8 ] ~ d''''2. ~ | d''''2 r4 r8 [ d''''8 ] ~ | d''''1 ~ | d''''2 ~ d''''8 [ r8 ] r4 | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''2. ~ d''''8 [ r8 ] | R1 | r2 d''''2 ~ | d''''2. r4 | R1 | r4 r8 [ d''''8 ] ~ d''''2 ~ | d''''1 ~ | d''''4 ~ d''''8 [ r8 ] r4 d''''4 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''2 ~ d''''8 [ r8 ] r4 | R1 | r4 d''''2. ~ | d''''1 ~ | d''''8 [ r8 ] r2. | r2 d''''2 ~ | d''''1 ~ | d''''8 [ r8 ] r4 d''''2 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''2. r4 | R1 | r4 d''''2. ~ | d''''1 | r4 r8 [ d''''8 ] ~ d''''2 ~ | d''''2 ~ d''''8 [ r8 ] r4 | d''''1 ~ | d''''4 r2. | R1 | R1 | R1 | R1 | R1 | R1 | \bar "||" \mark \markup { \bold \box 1.3 }r1 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 | r4 r8 [ f''''8 ] ~ f''''2 ~ | f''''1 ~ | f''''4 ~ f''''8 [ r8 ] r4 f''''4 ~ | f''''1 ~ | f''''1 | R1 | R1 | \bar ".|" \mark \markup { \bold \box 1.4 }r1 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''2 r2 | R1 | r8 [ f''''8 ] ~ f''''2. ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''4 ~ f''''8 [ r8 ] r2 | R1 | f''''1 ~ | f''''2. ~ f''''8 [ r8 ] | R1 | R1 | R1 | R1 | R1 | R1 |
\time 3/4
r2. | \bar "|.|" \mark \markup { \bold \box 2.1 }
\pageBreak
\time 4/4
R1 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''2 ~ f''''8 [ r8 ] r4 | f''''1 ~ | f''''1 ~ | f''''4 ~ f''''8 [ r8 ] r2 | R1 | r4 r8 [ f''''8 ] ~ f''''2 ~ | f''''2. ~ f''''8 [ r8 ] | R1 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''1 ~ | f''''2. r4 | R1 | f''''1 ~ | f''''4 ~ f''''8 [ r8 ] r4 f''''4 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''2 r2 | R1 | r8 [ f''''8 ] ~ f''''2. ~ | f''''1 | R1 | R1 | R1 | R1 | R1 |
\time 3/4
r2. | \bar "||" \mark \markup { \bold \box 2.2 }
\time 4/4
R1 | r2 r8 [ d''''8 ] ~ d''''4 ~ | d''''1 ~ | d''''2 r2 | R1 | r2. d''''4 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''1 ~ | d''''1 | r4 r8 [ d''''8 ] ~ d''''2 ~ | d''''1 ~ | d''''4 r4 r8 [ d''''8 ] ~ d''''4 ~ | d''''1 ~ | d''''4 r4 r8 [ d''''8 ] ~ d''''4 ~ | d''''1 | R1 | R1 | R1 | R1 | \bar "||" \mark \markup { \bold \box 2.3 }r2. f''''4 ~ | f''''1 ~ | f''''2. ~ f''''8 [ r8 ] | R1 | r2 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''2. ~ f''''8 [ r8 ] | r4 f''''2. ~ | f''''2 r4 r8 [ f''''8 ] ~ | f''''1 ~ | f''''4 r4 r8 [ f''''8 ] ~ f''''4 ~ | f''''1 ~ | f''''1 ~ | f''''1 ~ | f''''2 r2 | R1 | R1 | R1 | R1 | \bar ".|" \mark \markup { \bold \box 2.4 }r1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 ] \bar "|." }

@ -0,0 +1,22 @@
{
\set Score.markFormatter = #format-mark-box-numbers \tempo 8 = 90
\override Staff.TimeSignature #'stencil = ##f \numericTimeSignature \time 4/4
\clef bass
\bar "||" \mark \markup { \bold \box 1.1 }
\time 4/4
<<{ d,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 |
\time 2/4
r2 | \bar "||" \mark \markup { \bold \box 1.2 }
\time 4/4
<<{ a,,4 ^ \markup{ 5.0 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2. | R1 | R1 | R1 | r2 <<{ a,,4 ^ \markup{ 4.4 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | R1 | R1 | R1 | r2. <<{ a,,4 ^ \markup{ 3.9 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice | R1 | R1 | R1 | R1 | R1 | r2 <<{ a,,4 ^ \markup{ 3.3 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | R1 | R1 | R1 | R1 | <<{ a,,4 ^ \markup{ 2.8 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2. | R1 | R1 | R1 | <<{ a,,4 ^ \markup{ 2.2 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2. | R1 | R1 | R1 | <<{ a,,4 ^ \markup{ 1.7 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2. | R1 | R1 | R1 | r4 <<{ a,,4 ^ \markup{ 1.1 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2 | R1 | R1 | R1 | R1 | r2. <<{ a,,4 ^ \markup{ 0.6 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice | R1 | R1 | R1 | R1 | R1 | R1 | \bar "||" \mark \markup { \bold \box 1.3 } <<{ d,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | r2. <<{ f,,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo f,,4 }>> \oneVoice | R1 | R1 | R1 | <<{ e,,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo e,,4 }>> \oneVoice r2. | R1 | R1 | R1 | \bar ".|" \mark \markup { \bold \box 1.4 } <<{ d,4 ^ \markup{ -36.7 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 |
\time 3/4
r2. | \bar "|.|" \mark \markup { \bold \box 2.1 }
\pageBreak
\time 4/4
<<{ d,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 |
\time 3/4
r2. | \bar "||" \mark \markup { \bold \box 2.2 }
\time 4/4
<<{ a,,4 ^ \markup{ 5.0 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2. | r2 <<{ a,,4 ^ \markup{ 4.4 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | r2 <<{ a,,4 ^ \markup{ 3.9 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | r2 <<{ a,,4 ^ \markup{ 3.3 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | r2. <<{ a,,4 ^ \markup{ 2.8 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice | R1 | R1 | r4 <<{ a,,4 ^ \markup{ 2.2 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r2 | R1 | r2. <<{ a,,4 ^ \markup{ 1.7 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice | R1 | R1 | r2 <<{ a,,4 ^ \markup{ 1.1 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice r4 | R1 | R1 | r2. <<{ a,,4 ^ \markup{ 0.6 } } \new Voice { \voiceTwo a,,4 }>> \oneVoice | R1 | R1 | R1 | \bar "||" \mark \markup { \bold \box 2.3 } <<{ d,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | <<{ f,,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo f,,4 }>> \oneVoice r2. | R1 | R1 | r4 <<{ e,,4 ^ \markup{ 0.0 } } \new Voice { \voiceTwo e,,4 }>> \oneVoice r2 | R1 | R1 | R1 | R1 | \bar ".|" \mark \markup { \bold \box 2.4 } <<{ d,4 ^ \markup{ -36.7 } } \new Voice { \voiceTwo d,4 }>> \oneVoice r2. | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 | R1 ] \bar "|." }

@ -0,0 +1,152 @@
(
//~~FUNCTION THAT GENERATES THE GUI
~generateGUI = {
var win, clockStringFunc, metronomeStringFunc, metronomeColorFunc, masterView, faderView, tabs;
var tabButtonReset, transportButton, mixerButton, startPos = 0;
var partAbbr = ["guitar", "accompHigh", "accomLow", "interlude"];
var trackNames = ["guitar", "high", "low", "interlude"];
var partVols, partMutes, partPans;
var masterMute, masterVol;
partVols = [1, 1, 1, 1];
partMutes = [1, 1, 1, 1];
partPans = [0, 0, 0, 0];
masterMute = 1;
masterVol = 1;
clockStringFunc = {
arg div;
var min, sec;
sec = (div / 5).trunc;
min = (sec / 60).asInteger.asString;
if(min.size == 1, {min = "0" ++ min}, {});
sec = (sec % 60).asInteger.asString;
if(sec.size == 1, {sec = "0" ++ sec}, {});
min ++ ":" ++ sec
};
// [-30, -105, -104].asAscii and [-30, -105, -113].asAscii are unicode inverse bullet and normal bullet, respectively
metronomeStringFunc = { arg div; case {div % 20 < 2}
{[-30, -105, -104].asAscii} {div % 4 < 2} {[-30, -105, -113].asAscii} {true} {" "} };
metronomeColorFunc = { arg div; case {div % 20 < 2} {Color.red} {div % 4 < 2} {Color.blue} {true} {Color.black} };
~appStatusFunc = Task({
loop {
{~appStatus.string = ~appStatusString ++ "*"}.defer;
0.5.wait; {~appStatus.string = ~appStatusString ++ "* *"}.defer;
0.5.wait; {~appStatus.string = ~appStatusString ++ "* * *"}.defer;
0.5.wait; {~appStatus.string = ~appStatusString ++ "* * * *"}.defer;
0.5.wait; {~appStatus.string = ~appStatusString ++ "* * * * *"}.defer;
0.5.wait;
}
});
win = Window("Counterfeiting in Colonial Connecticut", Rect(500, 500, 1100, 500), false).front;
masterView = {
var view, masterIndicators, master, generator, transport, ranSeed, startPosText, pauseButton, clock, metronome;
OSCFunc({ arg msg, time; {
clock.string = clockStringFunc.value(msg[3]);
metronome.stringColor = metronomeColorFunc.value(msg[3]);
metronome.string = metronomeStringFunc.value(msg[3])}.defer;
},'/tr', s.addr);
view = View(win);
generator = HLayout(
Button(view).states_([["generate"]]).action_({
~appStatusString = "generating data";
~appStatusFunc.start;
~generateData.value(seed: ranSeed.string.asInteger);
}),
ranSeed = TextField(view).string_("20170121"),
Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "20170121"}),
Button(view).states_([["random seed"]]).action_({ ranSeed.string = 50000000.rand.asString}),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
nil);
transport = HLayout(
Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_(
/*
{| pState |
pauseButton.value = 0;
if(pState.value == 0, {~play.set(\playRate, 0, \startTrig, 0);
clock.string = clockStringFunc.value((startPos * ~totalDur * 5).asInteger)},
{~play.set(\startPos, startPos, \playRate, 1, \startTrig, 1)})}
*/
{| pState |
pauseButton.value = 0;
if(pState.value == 0, {~patterns[0].stop;
clock.string = clockStringFunc.value((startPos * ~totalDur * 5).asInteger)},
{~patterns[0].play})}
),
pauseButton = Button(view).states_([["pause", Color.black], ["pause", Color.black, Color.grey]]).action_(
{| pState |
if(pState.value == 1, {~play.set(\playRate, 0)},{~play.set(\playRate, 1)})}),
StaticText(view).string_("start time"),
[Slider(view, Rect(0, 0, 30, 5)).action_(
{|pos|
var min, sec;
startPosText.string = clockStringFunc.value((pos.value * ~totalDur * 5).asInteger);
startPos = pos.value;
}), stretch: 1],
startPosText = StaticText(win).string_("00:00").font_(Font("Monaco", 15)),
nil);
view.layout_(HLayout(
[VLayout(generator, nil,
HLayout(clock = StaticText(win).string_("00:00").font_(Font("Monaco", 200)),
StaticText(win).string_("|").font_(Font("Monaco", 200)),
metronome = StaticText(win).string_([-30, -105, -104].asAscii).font_(Font("Monaco", 300)).stringColor_(Color.red)),
nil, transport
), alignment: \top])) };
faderView = {
var view, masterIndicators, trackIndicators, master, tracks;
view = View(win);
masterIndicators = {LevelIndicator()} ! 2;
trackIndicators = {LevelIndicator()} ! 4;
OSCFunc.new({arg msg; {
{|i| masterIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 2}.defer},
'/masterLevels', s.addr);
OSCFunc.new({arg msg; {
{|i| trackIndicators[i].value = msg[3 + i].ampdb.linlin(-40, 0, 0, 1)} ! 4}.defer},
'/trackLevels', s.addr);
master = HLayout(
VLayout(
[HLayout(
Slider(view).value_(0.8).action_(
{|v| masterVol = v.value * 1.25; ~play.set(\masterVol, masterVol)}),
masterIndicators[0],
masterIndicators[1]), stretch: 2],
Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{|v| masterMute = (1 - v.value).abs; ~play.set(\masterMute, masterMute)}),
StaticText(view).string_(" master ").align_(\center)
//StaticText(view).string_("("++groupNames[group]++")").align_(\center)
),
nil);
tracks = { |part|
HLayout(
VLayout(
HLayout(
Slider(view).value_(0.8).action_(
{|v| partVols[part] = v.value * 1.25; ~play.set(partAbbr[part] ++ "Vol", partVols[part])}),
trackIndicators[part]),
Button(view).states_([["mute", Color.black], ["mute", Color.black, Color.grey]]).action_(
{|v| partMutes[part] = (1 - v.value).abs; ~play.set(partAbbr[part] ++ "Mute", partMutes[part])}),
StaticText(view).string_("pan").align_(\center),
Knob(view).value_(0.5).action_(
{|v| partPans[part] = v.value * 2 - 1; ~play.set(partAbbr[part] ++ "Pan", partPans[part])}),
StaticText(view).string_(trackNames[part]).align_(\center)
),
nil)
} ! 4;
view.layout_(HLayout(master, nil, *tracks))};
tabButtonReset = {transportButton.value = 1; mixerButton.value = 1; };
win.layout = VLayout(
HLayout(
transportButton = Button().states_([["transport", Color.white, Color.grey], ["transport", Color.black]]).action_(
{tabButtonReset.value; transportButton.value = 0; tabs.index = 0 }).value_(0),
mixerButton = Button().states_([["mixer", Color.white, Color.grey], ["mixer", Color.black]]).action_(
{tabButtonReset.value; mixerButton.value = 0; tabs.index = 1 }).value_(1)),
tabs = StackLayout(masterView.value, faderView.value));
};
)

@ -0,0 +1,52 @@
(
// MAIN LAUNCH (loads necessary files and definitions)
var appEnvironment, cond;
s.boot;
appEnvironment = Environment.make;
appEnvironment.push;
// load
"cicc_musical_data_generator.scd".loadRelative;
"cicc_sonifier.scd".loadRelative;
"cicc_gui.scd".loadRelative;
"cicc_transcriber.scd".loadRelative;
~allMusicData = ~genMusicData.value();
//~player = EventPatternProxy.new;
~patterns = ~allMusicData[0];
~scoreData = ~allMusicData[1];
~sectionOffsets = ~allMusicData[2];
~play = Synth.new(\masterPlayerControl);
~generateGUI.value;
//counterfeitTranscribe.value(~scoreData);
// init
/*
~dir = thisProcess.nowExecutingPath.dirname;
~loadedTransform = nil;
~transform = [2, 1, 0, 1, 0, 0, 0];
~tileMap = ~mapAll.value(6 /*max depth*/, ~transform);
~layoutState = 0;
~tempo = 120;
~dur = 0.125 * (120/~tempo);
~continuousPlay = false;
// launch
~launchTileVisualizer.value;
~launchGui.value;
*/
//appEnvironment.pop;
)
~fader = Synth(\crossFade, [\sel, 0, \busA, ~busA.index, \busB, ~busB.index]);
~patterns[0].play
~transcribe.value(~scoreData)
~patterns[0].stop

@ -0,0 +1,559 @@
(
var genInitSeq, finalizeSeqs, finalizeAccompHigh, finalizeAccompLow;
thisThread.randSeed = 1004;
//~~~~init vars for initial sequence generation
genInitSeq = {
var setDur, strings, stringIndex, state, lastStrings, position, dur, openStringCount, landingCount, sectionCount, res;
//~~~~helper dur function
setDur = {[0, 2, 3, 4, 5.rand + 3].wchoose([0, 5, 5, 5, 1].normalizeSum)};
strings = (0..5);
//stringIndex = 0;
state = 6.collect({[0, 1].wchoose([2, 1].normalizeSum)}); //fretted or not
lastStrings = [nil, nil];
position = 6.collect({10 + 3.rand}); //which frets
dur = setDur.value;
openStringCount = 0;
landingCount = 0; //for extending section landing on open strings
sectionCount = 0;
res = []; //notes before the more static repetitions are put in
//~~~~run routine and create template sequence
({sectionCount < 2}).while({
var alterPattern;
//alter string pattern or not
alterPattern = [true, false].wchoose([1, 2].normalizeSum);
if(alterPattern, {
strings = (0..5).scramble[..(4.rand + 1)];
//rotate if a note gets repeated
if(lastStrings.last == strings.first, {strings = strings.rotate});
//stringIndex = 0;
lastStrings = strings;
});
//iterate through the strings
strings.do({arg string, stringIndex;
var alterPos;
//alter state or not favoring off if on (determines if string is open or fretted)
if(sectionCount.even, {
var isFretted, probs, alterState;
isFretted = (state[string] == 1);
probs = [if(isFretted, {2}, {1}), 1].normalizeSum;
alterState = [true, false].wchoose(probs);
if(alterState, {state[string] = (state[string] + 1) % 2});
});
//alternate option
if(sectionCount.odd, {
var isFretted, alterable;
isFretted = (state[string] == 1);
alterable = isFretted || ((state[string] == 0) && (state.sum < 3));
if(alterable, {
var probs, alterState;
probs = [if(isFretted, {1}, {2}), 1].normalizeSum;
alterState = [true, false].wchoose(probs);
if(alterState, {state[string] = (state[string] + 1) % 2});
});
});
//alter fret if fretted and keeping hand in similar position
alterPos = (position[string] * state[string]) > 0;
alterPos = alterPos && (state[string] == 1); //isFretted
alterPos = alterPos && (position[string] > (position.maxItem - 3));
alterPos = [alterPos, false].wchoose([7, 1].normalizeSum);
if(alterPos, {
var walkDown, stepLimit;
//walk down or not
//BUG - GETTING REPEATED NOTES HERE!!!!
walkDown = [true, false].wchoose([1, 2].normalizeSum);
if(walkDown, {
res = res.add([string, state[string] * position[string], dur, position.deepCopy]);
});
//make sure a hand position is not too wide
stepLimit = (position.maxItem - (position[string] - 2)) != 4;
if(stepLimit.not, {
position[string] = (position[string] - 1).clip(0, 12);
});
if(stepLimit, {
position[string] = (position[string] - [1, 2].choose).clip(0, 12);
});
});
//alter duration or not
if([true, false].wchoose([3, 1].normalizeSum), {dur = setDur.value});
//add
res = res.add([string, state[string] * position[string], dur, position.deepCopy]);
//reset if everything arrives at the bottom string
//perhaps erase the extranotes here!
if((position[string] * state[string]) == 0, {openStringCount = openStringCount + 1}, {openStringCount = 0});
if(position == [0, 0, 0, 0, 0, 0], {
var hasLanded;
hasLanded = (openStringCount > 20) && (stringIndex == (strings.size - 1));
if(hasLanded, {
position = 6.collect({10 + 3.rand});
landingCount = 0;
sectionCount = sectionCount + 1;
(openStringCount - 1).do({arg index;
res[res.size - index - 1][3] = [0, 0, 0, 0, 0, 0];
res[res.size - index - 1][2] = (dur * (1 + ((1 - (index / openStringCount).clip(0, 1).postln.pow(0.25)) * 10))).asInteger
});
});
if(hasLanded.not, {landingCount = landingCount + 1})
});
})
});
res
};
//~~~~insert more static sections by repeating a figure
finalizeSeqs = {arg initSeq;
var extendToBeat, insertTS,
timeStampSection, timeStampTotal, timeStampSectionStart, lastDur, lastPos,
sectionSeq, timeSigInsSeq, sectionLen, sectionPosLimit, state, guitarSeq;
extendToBeat = {arg seq;
var timeStampTotal, altEndDur;
// this makes sure it is some multiple of a beat
timeStampTotal = seq.slice(nil, 2).sum;
altEndDur = timeStampTotal.round(4) - timeStampTotal;
if(altEndDur < 0, {altEndDur = altEndDur + 4});
seq.last[2] = seq.last[2] + altEndDur;
[seq, altEndDur];
};
insertTS = {arg seq, timeStampSectionStart, type, accompSwitch;
var timeStampTotal, noMeasures;
timeStampTotal = seq.slice(nil, 2).sum;
sectionSeq = sectionSeq.add([timeStampTotal, type, accompSwitch]);
noMeasures = ((timeStampTotal - timeStampSectionStart) / 16);
if(noMeasures.frac > 0, {
timeSigInsSeq = timeSigInsSeq.add(
// make 5/4 instrad of 1/4
if((noMeasures.frac / 0.25).asInteger != 1, {
[timeStampTotal - (4 * (noMeasures.frac / 0.25).asInteger),(noMeasures.frac / 0.25).asInteger]
}, {
[timeStampTotal - (4 * 5), 5]
});
);
timeSigInsSeq = timeSigInsSeq.add([timeStampTotal, 4]);
});
};
timeStampSection = 0; //track time in each section
timeStampTotal = 0; //track overall time
timeStampSectionStart = 0; //track the time of the start of a section
lastDur = initSeq[0][2]; //helper for time signature data
lastPos = initSeq[0].last; //helper for keeping track of landing.
guitarSeq = []; //this is the final sequence with repetitions inserted
sectionSeq = [[0, 0, true]]; //sequence of times for each section (used for double bars in score)
timeSigInsSeq = [[0, 4]]; //sequence for insertion of time signatures and double bars;
//sectionLen = 128;
sectionPosLimit = 3 + 6.rand;
state = 0;
initSeq.do({arg item, index, altEndDur;
var dur, pos;
dur = item[2];
pos = item.last;
if(state != 1, {
// basically this just copies the original template over
var landingBorder, sectionBorder;
landingBorder = (pos == [0, 0, 0, 0, 0, 0]) && (lastPos != [0, 0, 0, 0, 0, 0]);
sectionBorder = (pos != [0, 0, 0, 0, 0, 0]) && (lastPos == [0, 0, 0, 0, 0, 0]);
if(landingBorder || sectionBorder, {
var seqExtPair;
seqExtPair = extendToBeat.value(guitarSeq);
guitarSeq = seqExtPair[0];
timeStampSection = timeStampSection + seqExtPair[1];
insertTS.value(guitarSeq, timeStampSectionStart, if(pos == [0, 0, 0, 0, 0, 0], {1}, {-1}), false);
timeStampSectionStart = guitarSeq.slice(nil, 2).sum;
//if(((sectionLen - timeStampSection) < (16 * 8)) && (pos != [0, 0, 0, 0, 0, 0]), {sectionLen = sectionLen + (16 * 8)});
});
if(sectionBorder, {
state = 0;
sectionPosLimit = 3 + 6.rand;
});
guitarSeq = guitarSeq.add(item.add(-1));
timeStampSection = timeStampSection + dur;
lastDur = dur;
lastPos = pos;
if((state == 0) && (pos.minItem < sectionPosLimit), {state = 1});
});
if(state == 1, {
// grabs a figure and repeats it altering it subtly
var rec, reps, noMeasures;
// this makes sure it the length of the section
//timeStampTotal = guitarSeq.slice(nil, 2).sum;
//altEndDur = sectionLen - timeStampSection;
//guitarSeq.last[2] = guitarSeq.last[2] + altEndDur;
guitarSeq = extendToBeat.value(guitarSeq)[0];
timeStampTotal = guitarSeq.slice(nil, 2).sum;
insertTS.value(guitarSeq, timeStampSectionStart, 0, true);
timeStampSectionStart = timeStampTotal;
//sectionSeq = sectionSeq.add([timeStampTotal, 0, true]);
rec = guitarSeq[(guitarSeq.size - (10.rand + 5))..guitarSeq.size].deepCopy;
reps = 5.rand + 5;
reps.do({arg index;
rec.do({arg item, rIndex;
var add, dur;
add = if(index == 0, {3}, {0});
dur = (item[2] + 2.rand2 + add);
if(dur < 2, {dur = [0, 2].wchoose([1, 4].normalizeSum)});
rec[rIndex] = [item[0], item[1], dur];
if([true, false].wchoose([5, 1].normalizeSum), {
guitarSeq = guitarSeq.add(rec[rIndex].add((1 / reps) * index));
//timeStampTotal = timeStampTotal + dur;
});
// if chord randomly choose one of the notes
if(guitarSeq.last[2] == 0, {
arg toAdd = [];
//guitarSeq[(guitarSeq.size - 3)..].postln;
toAdd = toAdd.add(guitarSeq.pop);
toAdd = toAdd.add(guitarSeq.pop);
toAdd[0][2] = toAdd[1][2];
toAdd[1][3] = toAdd[0][3];
//toAdd.postln;
toAdd = toAdd.choose;
guitarSeq = guitarSeq.add(toAdd);
//guitarSeq[(guitarSeq.size - 2)..].postln
});
});
guitarSeq = extendToBeat.value(guitarSeq)[0];
});
insertTS.value(guitarSeq, timeStampSectionStart, 0, true);
timeStampSection = 0;
timeStampSectionStart = guitarSeq.slice(nil, 2).sum;
sectionLen = ((20 + 60.rand) / 0.08).asInteger.round(16);
lastDur = initSeq[index + 1][2];
state = 2;
});
});
[guitarSeq, sectionSeq, timeSigInsSeq]
};
// add the high note part
finalizeAccompHigh = {arg sectionSeq;
var accompHighSeq, timeStamp, secType;
accompHighSeq = [];
timeStamp = 0;
secType = 0;
//sectionSeq.postln;
//(sectionSeq.select({arg item; item.last == true}).slice(nil, 0) * 0.08).do({arg secEnd, secIndex;
sectionSeq.do({arg secData;
var secEnd, freq, noRestCount, shortCount;
secEnd = secData[0] * 0.08;
freq = if(secType == 0, {62.midicps * 8}, {62.midicps * 8 * 6/5});
if(secData.last, {secType = ((secType + 1) % 2)});
noRestCount = 0;
shortCount = 0;
while({timeStamp < secEnd}, {
var dur, sus, isShort, insertRest;
isShort = case
{shortCount == 0} {true}
{shortCount < 3} {[true, false].wchoose([2, 1].normalizeSum)}
{true} {false};
insertRest = [true, noRestCount > 3].wchoose([1, 1].normalizeSum);
if(isShort, {
sus = (1.5.rand + 1.5).round(0.16);
shortCount = shortCount + 1;
}, {
sus = (5.rand + 4).round(0.16);
shortCount = 0;
});
if(insertRest, {
dur = sus + (1.5.rand + 1.5).round(0.16);
noRestCount = 0;
}, {
dur = sus + 0.5.round(0.16);
noRestCount = noRestCount + 1;
});
if((timeStamp + dur) < secEnd, {
accompHighSeq = accompHighSeq.add([freq, dur, sus.clip(0, dur)]);
}, {
dur = ((secEnd - timeStamp) + 3.rand).clip(0.16, 1000).round(0.16);
accompHighSeq = accompHighSeq.add([freq, dur, 0]);
});
timeStamp = timeStamp + dur;
});
});
accompHighSeq
};
// add the low note part
finalizeAccompLow = {arg guitarSeq, sectionSeq;
var accompLowSeq, durAccum, lastTrigVal;
accompLowSeq = [];
durAccum = 0;
lastTrigVal = 0;
guitarSeq.do({arg item, i;
var dur, trig, freq1, freq2, finalDur;
dur = item[2];
trig = item.last;
if(lastTrigVal != trig, {
freq1 = if(trig > -1, {62.midicps / 4 * 3/4}, {62.midicps / 4});
freq2 = freq1 + if(trig > -1, {5 * (1-trig)}, {0});
finalDur = durAccum;
accompLowSeq = accompLowSeq.add([freq1, freq2, finalDur]);
durAccum = 0;
});
durAccum = durAccum + dur;
lastTrigVal = trig;
});
accompLowSeq = [accompLowSeq.slice(nil, 0), accompLowSeq.slice(nil, 1), accompLowSeq.slice(nil, 2).integrate].flop;
sectionSeq.collect({arg section;
if(section[1] == 1, {
var curTime = section[0];
accompLowSeq = accompLowSeq.add([62.midicps / 4, 62.midicps / 8, curTime]);
curTime = curTime - ((4.rand + 4) / 0.08).round(4).asInteger;
accompLowSeq = accompLowSeq.add([64.midicps / 8, 64.midicps / 8, curTime]);
curTime = curTime - ((4.rand + 4) / 0.08).round(4).asInteger;
accompLowSeq = accompLowSeq.add([65.midicps / 8, 65.midicps / 8, curTime]);
});
if(section[1] == -1, {
var curTime = section[0];
accompLowSeq = accompLowSeq.add([62.midicps / 4, 62.midicps / 4, curTime]);
//curTime = curTime - ((4.rand + 4) / 0.08).round(4).asInteger;
//accompLowSeq = accompLowSeq.add([69.midicps / 8, 69.midicps / 8, curTime]);
});
});
accompLowSeq = accompLowSeq.sort({ arg a, b; a[2] < b[2] });
accompLowSeq = [accompLowSeq.slice(nil, 0), accompLowSeq.slice(nil, 1),
accompLowSeq.slice(nil, 2).differentiate.drop(1).add(1)].flop;
//accompLowSeq = [accompLowSeq.slice(nil, 0), accompLowSeq.slice(nil, 1),accompLowSeq.slice(nil, 2).drop(1).add(1)].flop;
accompLowSeq
};
~genMusicData = {
var initSeq, finalSeqs, guitarSeq, accompHighSeq, accompLowSeq, sectionSeq, timeSigSeq,
patterns, scoreData, sectionOffsets;
initSeq = genInitSeq.value;
finalSeqs = finalizeSeqs.value(initSeq);
guitarSeq = finalSeqs[0];
accompHighSeq = finalizeAccompHigh.value(finalSeqs[1]);
accompLowSeq = finalizeAccompLow.value(finalSeqs[0], finalSeqs[1]);
sectionSeq = finalSeqs[1];
timeSigSeq = finalSeqs[2];
patterns = ~genPatterns.value(guitarSeq, accompLowSeq, accompHighSeq, sectionSeq);
scoreData = ~genScoreData.value(guitarSeq, accompLowSeq, accompHighSeq, timeSigSeq, sectionSeq);
sectionOffsets = sectionSeq.slice(nil, 0);
[patterns, scoreData, sectionOffsets]
};
)
/*
~player[0].play;
(
~player = EventPatternProxy.new;
~faderPattern = Pmono(
\crossFade,
\sel, Pseq([0, 1], ~sectionOffsets / 2),
\dur, Pseq(~sectionOffsets.differentiate.drop(1) * 0.08),
\busA, ~busA.index,
\busB, ~busB.index
);
~fader = Synth(\crossFade, [\sel, 0, \busA, ~busA.index, \busB, ~busB.index]);
~player.source = Ptpar(
([~sectionOffsets.postln * 0.08, ~patterns].flop.flat ++ [0, ~faderPattern]).postln
);
)
~fader.play
~player.play
(
~fader.set(\sel, 1);
~patterns[3].play
)
~fader = Synth(\crossFade, [\sel, 1, \busA, ~busA.index, \busB, ~busB.index]);
(
~patterns[3].play;
~testDrone = Synth.new(\droneOut, [\gate, 1, \bus, ~droneBus.index]);
//~testDrone.set(\gate, 0);
~dronePattern.play
)
(
~player.source = Ptpar([~sectionOffsets.postln * 0.08,
~patterns.collect({arg pt, i;
if(i < (~patterns.size - 1), {
PfadeOut(pt, 0.1, (~sectionOffsets.differentiate.drop(1)[i] * 0.08) - 0.1)
}, {
pt
})
})].flop.flat.postln);
)
~sectionOffsets.differentiate.postln;
~player.play
PfadeOut(~patterns[2], 0.1, (~sectionOffsets.differentiate.drop(1)[2] * 0.08) - 0.1).play
PfadeOut(~player[0]).play;
Pdef(\play, ~player[0]).play;
Pdef(\play, ~player[1])
~player[2].play;
~player.pause;
(
var durUnit = 0.15;
SynthDef(\machine, {arg freq, gate = 1, sustain, amp;
var sound;
sound = TWChoose.ar(Impulse.kr(0), [
PinkNoise.ar(EnvGen.kr(Env.perc(0.01, sustain, amp * 10), gate, doneAction: 2)),
BrownNoise.ar(EnvGen.kr(Env.perc(0.01, sustain, amp * 2), gate, doneAction: 2))
], [0, 20], 1);
Out.ar([0, 1], sound)
}).add;
~machine1 = Pbind(
\instrument, \machine,
\amp, Pseq(300.collect({var rand = [0.03, 0].choose; (20.rand + 10).rand.collect({rand})}).flat),
\dur, Pseq(1000.collect({[durUnit, durUnit + (durUnit / 100).rand2].wchoose([10, 1].normalizeSum)}).flat),
\sustain, Pseq(1000.collect({durUnit * (1.75 + 0.5.rand)})),//2.25].wchoose([1, 20].normalizeSum)})),
\freq, Pseq(1000.collect({[[300, 250], [300, 250].choose].wchoose([10, 1].normalizeSum)}).flat / 2)
).play;
)
~machine1.play;
~machine1.stop;
(
var durUnit = 0.02;
b = Bus.audio(s, 1);
SynthDef(\test, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;
var z;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
Out.ar(b, Pan2.ar(z, pan, amp));
}, [\ir]).add;
SynthDef(\defaultBus, {arg gate;
Out.ar([0, 1], Clip.ar(In.ar(b, 1), -1, 1) * 0.25 * EnvGen.ar(Env.asr(20, 1, 20), gate))
}
).add;
Pbind(
\instrument, \test,
\amp, 0.5,
\dur, durUnit,
\sustain, 0.05,
\freq, Pseq(3000.collect({[[62.midicps, 250], [62.midicps, 250].choose].wchoose([10, 1].normalizeSum)}).flat / 2)
).play;
~testDrone = Synth.new(\defaultBus, [\gate, 1]);
)
~testDrone.set(\gate, 0);
(
var durUnit = 0.02;
b = Bus.audio(s, 1);
SynthDef(\test, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;
var z;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
Out.ar(b, Pan2.ar(z, pan, amp));
}, [\ir]).add;
SynthDef(\defaultBus, {
Out.ar([0, 1], Clip.ar(In.ar(b, 1), -1, 1) * 0.25)
}
).add;
Pbind(
\instrument, \test,
\amp, Pseq(3000.collect({arg i; (i / 3000).clip(0, 1) * 0.5})),
\dur, durUnit,
\sustain, 0.05,
\freq, Pseq(3000.collect({[[62.midicps, 250], [62.midicps, 250].choose].wchoose([10, 1].normalizeSum)}).flat / 2)
).play;
Synth.new(\defaultBus)
)
(
var durUnit = 0.15;
SynthDef(\machine, {arg freq, gate = 1, sustain, amp;
var sound;
sound = TWChoose.ar(Impulse.kr(0), [
PinkNoise.ar(EnvGen.kr(Env.perc(0.01, sustain, amp * 10), gate, doneAction: 2)),
BrownNoise.ar(EnvGen.kr(Env.perc(0.01, sustain, amp * 2), gate, doneAction: 2))
], [0, 20], 1);
Out.ar([0, 1], sound)
}).add;
~machine1 = Pseq(
10.collect({
var randL, randLArray, amp, durUnitSMult, durUnitSMultLimit, hitsToClip;
randL = 30.rand + 30;
randLArray = (0..randL) ++ (0..(randL-1)).reverse;
amp = [0.1, 0].wchoose([2, 1].normalizeSum);
durUnitSMult = 2 + 1.0.rand;
durUnitSMultLimit = (durUnitSMult - 1) + 0.5.rand;
hitsToClip = 3 + 3.rand;
Pseq([Pbind(
\instrument, \machine,
\amp, 0.1,
\dur, Pseq(randLArray.collect({arg i; durUnit * (durUnitSMult - ((i / hitsToClip).clip(0, durUnitSMultLimit)))})),
\sustain, Pseq(randLArray.size.collect({durUnit * (1.75 + 0.5.rand)})),//2.25].wchoose([1, 20].normalizeSum)})),
\freq, Pseq(randLArray.size.collect({[[300, 250], [300, 250].choose].wchoose([10, 1].normalizeSum)}).flat / 2)
),Rest(3.rand + 5)
])
}), inf
).play;
)
62.midicps
*/

@ -0,0 +1,213 @@
(
//busses
~masterBus = Bus.audio(s, 1);
~guitarBusA = Bus.audio(s, 1);
~guitarBusB = Bus.audio(s, 1);
~accompHighBusA = Bus.audio(s, 1);
~accompHighBusB = Bus.audio(s, 1);
~accompLowBusA = Bus.audio(s, 1);
~accompLowBusB = Bus.audio(s, 1);
SynthDef(\masterPlayerControl, {
arg sel = 0,
masterVol = 1, masterMute = 1,
guitarVol = 1, guitarPan = 0, guitarMute = 1,
accompHighVol = 1, accompHighPan = 0, accompHighMute = 1,
accompLowVol = 1, accompLowPan = 0, accompLowMute = 1;
var guitarSig, accompHighSig, accompLowSig,
guitarSigPanned, accompHighSigPanned, accompLowSigPanned,
masterSig, imp;
guitarSig = SelectX.ar(sel, [In.ar(~guitarBusA), In.ar(~guitarBusB)]) * guitarVol;
accompHighSig = SelectX.ar(sel, [In.ar(~accompHighBusA), In.ar(~accompHighBusB)]) * accompHighVol;
accompLowSig = SelectX.ar(sel, [In.ar(~accompLowBusA), In.ar(~accompLowBusB)]) * accompLowVol;
guitarSigPanned = Pan2.ar(guitarSig * guitarMute, guitarPan);
accompHighSigPanned = Pan2.ar(accompHighSig * accompHighMute, accompHighPan);
accompLowSigPanned = Pan2.ar(accompLowSig * accompLowMute, accompLowPan);
masterSig = Mix.ar([guitarSigPanned, accompHighSigPanned, accompLowSigPanned]) * masterVol * masterMute;
Out.ar(0, masterSig);
imp = Impulse.kr(10);
SendReply.kr(imp,
'/masterLevels',
values: [Amplitude.kr(masterSig)]);
SendReply.kr(imp,
'/trackLevels',
values: [Amplitude.kr(guitarSig), Amplitude.kr(accompHighSig), Amplitude.kr(accompLowSig), DC.ar(0)]);
}).add;
//~~~~karplus
SynthDef(\karplus, {arg freq, gate = 1, amp = 0.5, bus;
Out.ar(bus,
Pluck.ar(WhiteNoise.ar(0.1), Impulse.kr(0), 220.reciprocal, freq.reciprocal, 10, coef:0) *
Linen.kr(gate, doneAction: Done.freeSelf) * amp
)
}).add;
//~~~~accompaniment
SynthDef(\accompBass, {arg freq1 = 100, freq2 = 100, gate = 1, amp = 0.5, bus;
var bassDrop;
bassDrop = Mix.ar([SinOsc.ar(freq1, 0, 0.5), SinOsc.ar(freq2, 0, 0.5)]) *
EnvGen.kr(Env.perc(0.1, 10, level: amp), Impulse.kr(0) + Changed.kr(freq2));
Out.ar(bus, bassDrop)
}).add;
SynthDef(\accompTreble, {arg freq, gate = 1, sustain, amp, bus;
var treble;
treble = SinOsc.ar(
freq, 0,
EnvGen.kr(Env.sine(sustain, amp * 0.1), gate));
Out.ar(bus, treble)
}).add;
~droneBus = Bus.audio(s, 1);
SynthDef(\drone, { arg out=0, freq=440, amp=0.1, pan=0, gate=1, bus;
var z;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
Out.ar(bus, Pan2.ar(z, pan, amp));
}, [\ir]).add;
SynthDef(\droneOut, {arg gate, bus;
Out.ar([0, 1], Clip.ar(In.ar(bus, 1), -1, 1) * 0.1 * EnvGen.ar(Env.asr(20, 1, 20), gate))
}
).add;
~dronePattern = Pbind(
\instrument, \drone,
\amp, 0.5,
\dur, 0.02,
\sustain, 0.05,
\freq, Pseq(3000.collect({[[62.midicps, 250], [62.midicps, 250].choose].wchoose([10, 1].normalizeSum)}).flat / 2),
\bus, ~droneBus.index
);
//~~~~gen music
~genPatterns = {arg guitarSeqIn, accompLowSeqIn, accompHighSeqIn, sectionSeqIn;
var calcSustains, genSectionSec, sectionLimits;
//~~~~helper sus function
calcSustains = {arg stringSeq, durSeq;
var res = [];
stringSeq.size.do({arg index;
var curString, dur, count;
if(stringSeq[index].isRest.not, {
curString = stringSeq[index];
dur = durSeq[index];
count = 1;
while({(stringSeq[(index + count).clip(0, stringSeq.size - 1)] != curString) &&
(dur < 16) && (count < 100)}, {
dur = dur + durSeq[(index + count).clip(0, durSeq.size - 1)];
count = count + 1;
});
res = res.add(dur.clip(0, 16));
}, {
res.add(Rest());
});
});
res
};
genSectionSec = {arg seq, startTime, endTime, type;
var durSum, resSeqs, inSecs, mult;
//sectionSeq.postln;
durSum = 0;
resSeqs = [];
inSecs = switch(type, 0, {false}, 1, {false}, 2, {true});
mult = if(inSecs, {1}, {0.08});
seq.do({arg item;
if(((durSum * mult) >= (startTime * 0.08)) && ((durSum * mult) < (endTime * 0.08)), {
var dur = (durSum * mult) - (startTime * 0.08);
if((resSeqs.size == 0) && (dur > 0), {
switch(type,
0, {resSeqs = resSeqs.add([Rest(-1), Rest(-1), dur])},
1, {resSeqs = resSeqs.add([Rest(-1), Rest(-1), dur])},
2, {resSeqs = resSeqs.add([Rest(-1), dur.round(0.08), dur.round(0.08)])})
});
resSeqs = resSeqs.add(item);
});
durSum = durSum + if(type == 2, {item[1]}, {item[2]});
});
//if(type == 1, {resSeqs = resSeqs.add([0, 0, 16])});
resSeqs
};
sectionLimits = [];
sectionSeqIn.slice(nil, 0).add(100000).doAdjacentPairs({arg a, b; sectionLimits = sectionLimits.add([a, b])});
sectionLimits.collect({arg timePair, secIndex;
var startTime, endTime,
guitarSecSeq, accompLowSecSeq, accompHighSecSeq,
stringSeq, fretSeq, durSeq, susSeq, trigSeq, openStrings, pattern;
startTime = timePair.postln[0];
endTime = timePair[1];
guitarSecSeq = genSectionSec.value(guitarSeqIn, startTime, endTime, 0);
accompLowSecSeq = genSectionSec.value(accompLowSeqIn, startTime, endTime, 1);
accompHighSecSeq = genSectionSec.value(accompHighSeqIn, startTime, endTime, 2);
if(accompHighSecSeq == [], {accompHighSecSeq = [[Rest(-1), 1, 0], [Rest(-1), 1, 0]]});
guitarSecSeq.postln;
accompLowSecSeq.postln;
accompHighSecSeq.postln;
openStrings = [1/1, 3/2, 2/1, 5/2, 35/12, 7/2];
stringSeq = guitarSecSeq.slice(nil, 0);
fretSeq = guitarSecSeq.slice(nil, 1);
durSeq = guitarSecSeq.slice(nil, 2);
susSeq = calcSustains.value(stringSeq, durSeq);
//trigSeq = guitarSeq.slice(nil, 3);
//~player = EventPatternProxy.new;
pattern = EventPatternProxy.new;
pattern.source = Ppar([
Pbind(
\instrument, \karplus,
\amp, 0.3,
\dur, Pseq(durSeq * 0.08),
\sustain, Pseq(susSeq * 0.08),
\freq, Pseq(stringSeq.collect({arg string, index;
if(string.isRest, {Rest()}, {
((62.midicps * openStrings[string]).cpsmidi + fretSeq[index]).midicps})})),
\bus, if(secIndex % 2 == 0, {~guitarBusA.index}, {~guitarBusB.index})),
if(accompLowSecSeq.size > 1, {
Pmono(
\accompBass,
\amp, 0.5,
\freq1, Pseq(accompLowSecSeq.slice(nil, 0)),
\freq2, Pseq(accompLowSecSeq.slice(nil, 1)),
\dur, Pseq(accompLowSecSeq.slice(nil, 2)) * 0.08,
\bus, if(secIndex % 2 == 0, {~accompLowBusA.index}, {~accompLowBusB.index}))
}, {
Pmono(
\accompBass,
\amp, 0.5,
\freq1, Pseq([accompLowSecSeq[0][0]]),
\freq2, Pseq([accompLowSecSeq[0][1]]),
\dur, Pseq([accompLowSecSeq[0][2]]) * 0.08,
\bus, if(secIndex % 2 == 0, {~accompLowBusA.index}, {~accompLowBusB.index}))
}),
Pbind(
\instrument, \accompTreble,
\freq, Pseq(accompHighSecSeq.slice(nil, 0)),
\dur, Pseq(accompHighSecSeq.slice(nil, 1)),
\sustain, Pseq(accompHighSecSeq.slice(nil, 2)),
\amp, 0.5,
\bus, if(secIndex % 2 == 0, {~accompHighBusA.index}, {~accompHighBusB.index}))
]);
pattern
}).postln;
};
)

@ -0,0 +1,283 @@
(
~transcribe = {arg scoreData;
var rawMusicData, timeSigData, sectionData, dir, basePath, maxSize, openStrings, musicData;
rawMusicData = scoreData[0];
timeSigData = scoreData[1];
sectionData = scoreData[2];
dir = thisProcess.nowExecutingPath.dirname;
basePath = dir +/+ ".." +/+ "lilypond";
openStrings = [1/1, 3/2, 2/1, 5/2, 35/12, 7/2];
maxSize = 0;
musicData = rawMusicData.collect({arg partData, p;
var res;
res = partData.collect({arg item, i;
var note, rest;
switch(p,
0, {
var string, fret, dur, sus;
string = item[0];
fret = item[1];
dur = item[2];
sus = item[3];
note = sus.collect({[string, fret, i]});
//rest = (dur - sus).collect({[-1, -1]});
},
1, {
var freq, dur, sus;
freq = item[0];
dur = item[1];
sus = item[2];
note = sus.collect({[freq, i]});
if(p < rawMusicData.size, {rest = (dur - sus).collect({[-1, i]})}, {[]});
},
2, {
var freq1, freq2, dur, sus;
freq1 = item[0];
freq2 = item[1];
dur = item[2];
sus = 4;
note = sus.collect({[[freq1, freq2 - freq1], i]});
if(p < rawMusicData.size, {rest = (dur - sus).collect({[-1, i]})}, {[]});
}
);
note ++ rest
}).flatten;
if(res.size > maxSize, {maxSize = res.size});
//res = res.extend(res.size.trunc(16) + 16, res.last)
res
});
musicData = musicData.collect({arg partData, p;
var lastSectionSize, lastSectionSizeTrunc, finalSectionSize, ext;
partData[(partData.size - 10)..];
lastSectionSize = (maxSize - sectionData.last[0]);
lastSectionSizeTrunc = lastSectionSize.trunc(16);
finalSectionSize = if(lastSectionSize != lastSectionSizeTrunc, {lastSectionSizeTrunc + 16}, {lastSectionSize});
ext = finalSectionSize - lastSectionSize;
partData.extend((maxSize + ext), if(p == 0, {partData.last}, {[-1, partData.last[1]]}))
});
musicData.do({arg part, p;
var amps, harm, modi, timeSigIndex, sectionCount, sectionIndex, subSectionIndex, curTimeSig,
lilyFile, lilyString, voices, lastVal, lilyNotes, lilyOcts, lilyGString, isHarmonic, measureCount,
lilyNote, lilyDur, lilyRest, lilyBeatingMark, curTime = 0, noteTuples, markupSuffixes;
//create file
lilyFile = switch(p,
0, {File(basePath +/+ "includes" +/+ "cicc_guitar.ly".standardizePath,"w")},
1, {File(basePath +/+ "includes" +/+ "cicc_high.ly".standardizePath,"w")},
2, {File(basePath +/+ "includes" +/+ "cicc_low.ly".standardizePath,"w")}
);
//start lilypond directives
lilyString = "";
lastVal = nil;
//start voice
lilyString = lilyString ++ "\n{ ";
lilyString = lilyString ++ "\n\\set Score.markFormatter = #format-mark-box-numbers ";
lilyString = lilyString + "\\tempo 8 = 90\n";
if(p != 1, {lilyString = lilyString + "\\override Staff.TimeSignature #'stencil = ##f"});
//lilyString = lilyString + "\\numericTimeSignature \\time 4/4\n \\mark \\default \n";
lilyString = lilyString + "\\numericTimeSignature \\time 4/4\n";
lilyString = switch(p,
0, {lilyString + "\\clef treble\n"},
1, {lilyString + "\\clef \"treble^8\"\n"},
2, {lilyString + "\\clef bass\n"}
);
lilyNotes = ["c", "cis", "d", "dis","e", "f", "fis", "g", "gis", "a", "ais", "b"];
lilyOcts = [",,", ",", "", "'", "''", "'''", "''''"];
timeSigIndex = 0;
sectionCount = 0;
sectionIndex = 1;
subSectionIndex = 1;
curTimeSig = 4;
measureCount = 0;
part.clump(4).do({arg beat, i;
var gSum = 0;
//beat.postln;
beat.separate({arg a, b; ((a[0] != -1) || (b[0] != -1)) && (a != b)}).do({arg group, g; var noteLength, target = 0;
noteLength = group.size;
gSum = gSum + noteLength;
//add ties
lilyString = lilyString ++ if((group[0] == lastVal) && (group[0][0] != -1), {"~ "}, {""});
//add barcheck count
lilyString = lilyString ++ if((curTime % curTimeSig == 0) && (i != 0), {measureCount = measureCount + 1; "| "}, {""});
//lilyString = lilyString ++ if((curTime % curTimeSig == 0) && ((measureCount % 4) == 0) && (i != 0), {"\n\\break \n"}, {""});
if((i == (sectionData[sectionCount][0] / 4)) && (g == 0),{
var barType, pageBreak;
barType = switch(sectionData[sectionCount][1], 0, {"\"||\""}, 1, {"\".|\""}, -1, {"\"|.|\""});
pageBreak = switch(sectionData[sectionCount][1], 0, {""}, 1, {""}, -1, {measureCount = 0; "\n\\pageBreak \n"});
isHarmonic = switch(sectionData[sectionCount][1], 0, {false}, 1, {true}, -1, {false});
lilyString = lilyString + " \\bar " ++ barType ++ " \\mark \\markup { \\bold \\box " ++ sectionIndex ++ "." ++ subSectionIndex ++ " }" ++ pageBreak;
if(sectionCount < (sectionData.size - 1), {sectionCount = sectionCount + 1});
switch(sectionData[sectionCount][1],
0, {subSectionIndex = subSectionIndex + 1},
1, {subSectionIndex = subSectionIndex + 1},
-1, {sectionIndex = sectionIndex + 1; subSectionIndex = 1})
});
if((i == (timeSigData[timeSigIndex][0] / 4)) && (g == 0),{
timeSigData[timeSigIndex][0];
curTimeSig = timeSigData[timeSigIndex][1];
lilyString = lilyString + "\n\\time " ++ curTimeSig.asString ++ "/4\n";
if(timeSigIndex < (timeSigData.size - 1), {timeSigIndex = timeSigIndex + 1});
curTime = 0;
});
switch(p,
0, {
lilyNote = lilyNotes[(((62.midicps * openStrings[group[0][0]]).cpsmidi + group[0][1]).round(1) % 12)];// * 2];
lilyNote = lilyNote ++ lilyOcts[(((62.midicps * openStrings[group[0][0]]).cpsmidi + group[0][1]).round(1) / 12).asInteger - 2];
},
1, {
if(group[0][0] != -1, {
lilyNote = lilyNotes[((group[0][0].cpsmidi).round(1) % 12)];// * 2];
lilyNote = lilyNote ++ lilyOcts[(((group[0][0]).cpsmidi).round(1) / 12).asInteger - 2];
},{lilyNote = "r"});
},
2, {
if(group[0][0] != -1, {
lilyNote = lilyNotes[((group[0][0][0].cpsmidi).round(1) % 12)];// * 2];
lilyNote = lilyNote ++ lilyOcts[(((group[0][0][0]).cpsmidi).round(1) / 12).asInteger - 2];
lilyBeatingMark = "^ \\markup{ " ++ group[0][0][1].round(0.1) ++ " } ";
},{lilyNote = "r"});
}
);
//duration
lilyDur = switch(noteLength, 1, {"16 "}, 2, {"8 "}, 3, {"8. "}, 4, {"4 "});
//append rest directive
lilyRest = "";
lilyGString = if(((group[0] != lastVal) && (p == 0)), {
var stringString, fretString;
stringString = ["VI ", "V ", "IV ", "III ", "II ", "I "][group[0][0]];
fretString = group[0][1].asString;
if(isHarmonic, {fretString = "\\musicglyph \"noteheads.s0harmonic\""});
"_\\markup{\\concat{ " ++ stringString ++ " \\super " ++ fretString ++ "}} "
}, {""});
if((p != 2) || (lilyNote == "r"), {
lilyString = lilyString ++ lilyNote ++ lilyDur ++ lilyGString;
}, {
lilyString = lilyString ++ " <<{ " ++ lilyNote ++ lilyDur ++ lilyBeatingMark ++ " } \\new Voice { \\voiceTwo " ++
lilyNote ++ lilyDur ++ " }>> \\oneVoice " ++ lilyGString;
});
//beam group
if((g == 0) && (noteLength != 4), {lilyString = lilyString ++ " [ "});
if((gSum == 4) && (noteLength != 4), {lilyString = lilyString ++ " ] "});
lastVal = group[0];
curTime = curTime + (noteLength / 4);
});
});
//end voice
lilyString = lilyString ++ " ] \\bar \"|.\" } \n";
noteTuples = [lilyNotes, lilyOcts].allTuples.collect({arg val; val.join}).join("|");
markupSuffixes = ["VI ", "V ", "IV ", "III ", "II ", "I "].collect({arg stringString;
(["\\\\musicglyph \\\"noteheads.s0harmonic\\\""] ++ (0..14)).collect({arg fret;
"_\\\\markup{\\\\concat{ " ++ stringString ++ " \\\\super " ++ fret.asString ++ "}}"})}).flatten.join("|");
lilyString.findRegexp(
"(" ++ noteTuples ++ ")4 (" ++ markupSuffixes ++ ") ~ " ++
"(" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4"
).clump(7).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2. " ++ match[2][1] ++ " ~ " ++ match[1][1] ++ "2")});
lilyString.findRegexp(
"(" ++ noteTuples ++ ")4 (" ++ markupSuffixes ++ ") ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4"
).clump(6).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "1 " ++ match[2][1])});
lilyString.findRegexp(
"(" ++ noteTuples ++ ")4 (" ++ markupSuffixes ++ ") ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4"
).clump(5).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2. " ++ match[2][1])});
lilyString.findRegexp("(" ++ noteTuples ++ ")4 (" ++ markupSuffixes ++ ") ~ (" ++ noteTuples ++ ")4").clump(4).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2 " ++ match[2][1])});
//consolidate notes
lilyString.findRegexp(
"(" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4"
).clump(6).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2. ~ " ++ match[1][1] ++ "2")});
lilyString.findRegexp(
"(" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4"
).clump(5).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "1")});
lilyString.findRegexp("(" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4").clump(4).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2.")});
lilyString.findRegexp("(" ++ noteTuples ++ ")4 ~ (" ++ noteTuples ++ ")4").clump(3).do({arg match;
lilyString = lilyString.replace(match[0][1], match[1][1] ++ "2")});
//consolidate rests
lilyString.findRegexp("r4 r4 r4 r4 r4").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "r2. r2")});
lilyString.findRegexp("r4 r4 r4 r4").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "r1")});
lilyString.findRegexp("r4 r4 r4").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "r2.")});
lilyString.findRegexp("r4 r4").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "r2")});
lilyString.findRegexp("\\| r1").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "| R1")});
lilyString.findRegexp("4\nr1").clump(2).do({arg match;
lilyString = lilyString.replace(match[0][1], "4\n R1")});
//write file
lilyFile.write(lilyString);
lilyFile.close;
});
};
~genScoreData = {arg guitarSeq, accompLowSeq, accompHighSeq, timeSigInsSeq, sectionSeq;
var stringSeq, fretSeq, durSeq,
partData, timeSigData, sectionData;
stringSeq = guitarSeq.slice(nil, 0);
fretSeq = guitarSeq.slice(nil, 1);
durSeq = guitarSeq.slice(nil, 2);
partData = [
[stringSeq, fretSeq, durSeq, durSeq].flop,
accompHighSeq.collect({arg item; [item[0], (item[1] / 0.08).round.asInteger, (item[2] / 0.08).round.asInteger]}),
accompLowSeq
];
timeSigData = timeSigInsSeq;
sectionData = sectionSeq;
[partData, timeSigData, sectionData]
};
)
Loading…
Cancel
Save