Dear users,
sclang often posts too many “late 0.xxxxxxxxx” messages when evaluating the following code. Is the code not ideally constructed?
(
var tune, pitches, rhythms, tempo, rand;
tune = [
[[0, 4], 2, 4, 0]!2,
[[4, 4], 5, [7, 2]]!2,
[[7, 8], 9, 7, 5, [4, 4], 0]!2,
[[0, 4], -5, [0, 2]]!2
].flatten(2);
pitches = tune.size.collect{ |i| tune[i].asArray[0] };
rhythms = {
var number;
tune.size.collect{ |i|
var thisItem;
thisItem = tune[i].asArray[1];
number = if (thisItem != nil) { thisItem } { number };
if (thisItem == nil) { number } { thisItem }
.reciprocal;
}
}.();
pitches.postln;
rhythms.postln;
tempo = TempoClock.new( 63 / 60 );
rand = Pbrown(-0.005, 0.005, 0.00125);
rand = rand.asStream.nextN(tune.size);
rand.postln;
Ptpar([
0, Pbind(
\note, Pseq(pitches, 1) + 24,
\dur, Pseq(rhythms, inf) + Pseq(rand, 1),
\legato, Pseq(rhythms, inf) * 0.2,
\pan, -0.3),
2 + rand[0..7].sum, Pbind(
\rand, Pseq(rand, 1),
\note, Pseq(pitches, 1) + 12,
\dur, Pseq(rhythms, inf) + Pseq(rand, 1),
\legato, Pseq(rhythms, inf) * 0.4,
\pan, 0.3),
4 + (rand[0..7].sum * 2), Pbind(
\rand, Pseq(rand, 1),
\note, Pseq(pitches, 1),
\dur, Pseq(rhythms, inf) + Pseq(rand, 1),
\legato, Pseq(rhythms, inf) * 0.8,
\pan, -0.6),
6 + (rand[0..7].sum * 3), Pbind(
\rand, Pseq(rand, 1),
\note, Pseq(pitches, 1) - 12,
\dur, Pseq(rhythms, inf) + Pseq(rand, 1),
\pan, 0.6)
]).play(clock: tempo);
)