fixing patterns for ending fadeout and random number generation

main
mwinter 4 years ago
parent 2c11afac7a
commit 483162b94d

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

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

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

@ -457,21 +457,25 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger]); sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger]);
4.do({arg part; 4.do({arg part;
var musicData, partState, noteCountInd; var musicData, partState, accompRoutine;
# musicData, partState = genEnsemblePart.value(partStates[part], modeState, temporalData[part], roots, part, curLen); # musicData, partState = genEnsemblePart.value(partStates[part], modeState, temporalData[part], roots, part, curLen);
ensData[part] = ensData[part] ++ musicData; ensData[part] = ensData[part] ++ musicData;
partStates[part] = partState; partStates[part] = partState;
//use and independent random number generator for the accompaniment
accompRoutine = Routine({
thisThread.randSeed = Date.seed; thisThread.randSeed = Date.seed;
6.do({arg register; 6.do({arg register;
musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part, register); musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part, register);
accompData[part][register] = accompData[part][register] ++ musicData; accompData[part][register] = accompData[part][register] ++ musicData;
}); });
});
accompRoutine.value;
}); });
subsectionCount = subsectionCount + 1; subsectionCount = subsectionCount + 1;
thisThread.randSeed = (seed + (sectionCount * 200) + subsectionCount); //thisThread.randSeed = (seed + (sectionCount * 200) + subsectionCount);
if(curLen == 0, { if(curLen == 0, {
lastCadenceTemporalData = temporalData; lastCadenceTemporalData = temporalData;

@ -46,12 +46,12 @@ var formatPatternData;
Out.kr(bus, amp.lag) Out.kr(bus, amp.lag)
}); });
sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0; sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0, rel = 0.1;
Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction: 2)) Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, rel), gate, doneAction: 2))
}); });
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0; sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0, rel = 0.01;
Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(attack, 1, 0.01), gate, doneAction: 2)) Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(attack, 1, rel), gate, doneAction: 2))
}); });
sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0; sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0;
@ -74,12 +74,14 @@ var formatPatternData;
// group data by measures for navigation // group data by measures for navigation
formatPatternData = {arg musData, measureLen; formatPatternData = {arg musData, measureLen, rel, print = false;
var dataLen; var dataLen;
dataLen = musData[0][0].size; dataLen = musData[0][0].size + 1;
musData.collect({arg partData; musData.collect({arg partData;
var res; var res;
res = partData.flop; res = partData;
res = res.collect({arg mData, index; mData.add(if(index != (res.size - 1), {rel}, {5.rand + 5}))});
res = res.flop;
res = res.add(res[1]); res = res.add(res[1]);
res[1] = (res[1].differentiate.drop(1) ++ [10]); res[1] = (res[1].differentiate.drop(1) ++ [10]);
res = res.flop ++ measureLen.collect({arg measure; dataLen.collect({0}) ++ [measure * 16]}); res = res.flop ++ measureLen.collect({arg measure; dataLen.collect({0}) ++ [measure * 16]});
@ -103,8 +105,8 @@ formatPatternData = {arg musData, measureLen;
accompData.flatten.collect({arg partData; partData.last[1]}) accompData.flatten.collect({arg partData; partData.last[1]})
).maxItem.ceil(16) / 16).asInteger + 1; ).maxItem.ceil(16) / 16).asInteger + 1;
ensDataFormatted = formatPatternData.value(ensData, measureLen); ensDataFormatted = formatPatternData.value(ensData, measureLen, 0.1, true);
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen); accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen, 0.01);
dUnit = 8.reciprocal; dUnit = 8.reciprocal;
patterns = measureLen.collect({arg measure; patterns = measureLen.collect({arg measure;
@ -114,20 +116,21 @@ formatPatternData = {arg musData, measureLen;
}); });
Ppar( Ppar(
//check how amplitude is being handled //check how amplitude is being handled
ensDataFormatted[measure].collect({arg musData, m; ensDataFormatted[measure].collect({arg musData, p;
Pbind( Pbind(
\instrument, \ens_ ++ ~hash, \instrument, \ens_ ++ ~hash,
\freq, Pseq(musData[0].replace(0, Rest(0))), \freq, Pseq(musData[0].replace(0, Rest(0))),
\dur, Pseq(musData[1] * dUnit), \dur, Pseq(musData[1] * dUnit),
\sustain, Pseq(musData[2] * dUnit), \sustain, Pseq(musData[2] * dUnit),
\amp, [1, 0.7, 0.5, 0.3][m], \amp, [1, 0.7, 0.5, 0.3][p],
//\amp, Pseq(musData[2].collect({arg item; [0, 0.25, 0.5, 0.75][item]}) * [1, 0.5, 0.25, 0.1][m] * 16); //\amp, Pseq(musData[2].collect({arg item; [0, 0.25, 0.5, 0.75][item]}) * [1, 0.5, 0.25, 0.1][p] * 16);
\ampBus, preampBusses[0].index, \ampBus, preampBusses[0].index,
\bus, postampBusses[m].index \bus, postampBusses[p].index,
\rel, Pseq(musData[6])
) )
}) ++ }) ++
//check how amplitude and attack are being handled //check how amplitude and attack are being handled
accompDataFormatted[measure].collect({arg musData, m; accompDataFormatted[measure].collect({arg musData;
Pbind( Pbind(
\instrument, \accomp_ ++ ~hash, \instrument, \accomp_ ++ ~hash,
\freq, Pseq(musData[0].replace(0, Rest(0))), \freq, Pseq(musData[0].replace(0, Rest(0))),
@ -137,7 +140,8 @@ formatPatternData = {arg musData, measureLen;
//\attack, Pseq(musData[1] * abs(musData[3].clip(0, 0.25) * 2 - 1) * dUnit), //\attack, Pseq(musData[1] * abs(musData[3].clip(0, 0.25) * 2 - 1) * dUnit),
\attack, Pseq(musData[2] * 1 * dUnit), \attack, Pseq(musData[2] * 1 * dUnit),
\ampBus, preampBusses[0].index, \ampBus, preampBusses[0].index,
\bout, Pseq(musData[4].collect({arg index; accompBusses[index].index})) \bout, Pseq(musData[4].collect({arg index; accompBusses[index].index})),
\rel, Pseq(musData[5])
) )
}) ++ }) ++
[ [

@ -23,8 +23,9 @@ formatMusicData = {arg rawMusicData;
}); });
// make them all the same length // make them all the same length
maxSize = maxSize.trunc(16) + 16; maxSize = maxSize.trunc(64) + 64;
musicData = musicData.collect({arg partData, p; partData.extend(maxSize, [-1, -1, -1, partData.last[1]])}); //musicData = musicData.collect({arg partData, p; partData.extend(maxSize, [-1, -1, -1, partData.last[1]])});
musicData = musicData.collect({arg partData, p; partData.extend(maxSize, partData.last)});
musicData musicData
}; };
@ -68,7 +69,7 @@ lyFinalizeMusic = {arg lyStr, part, name, nameShort, nameMidi, clef;
"\n\\set Score.markFormatter = #format-mark-box-numbers " + "\n\\set Score.markFormatter = #format-mark-box-numbers " +
"\\tempo 2 = 60\n" + "\\tempo 2 = 60\n" +
"\\numericTimeSignature \\time 2/2\n" + "\\numericTimeSignature \\time 2/2\n" +
"\\clef " ++ clef ++ "\n" ++ lyStr ++ "\\clef " ++ clef ++ "\n" ++ lyStr + "\\fermata" +
" }>> \\bar \"|.\" \n} \n\n>>" ++ " }>> \\bar \"|.\" \n} \n\n>>" ++
"\n>>" "\n>>"
}; };

Loading…
Cancel
Save