dear all!
I am writing a precise scheduler connected with the tempo changes and meter changes at certain bars and beats. I want the time signature at bar 94 to change to 2/4 and at bar 97 to change to 3/4.
I don’t understand what is happening while the .beatsPerBar is changed , that causes the beats and bars numbers to be messed up in the post window. In the first case (b.93) the scheduling between the beats somehow does the trick, but in b.96 the same thing does not do the trick - the bars and beats are messed up.
what am I doing wrong?
(
s.waitForBoot({
~tempo1 = 66/60;
t = TempoClock.new(~tempo1, 0);
s.sync;
t.beats = ((t.bar) + 92 ) * t.beatsPerBar; //bars offset
s.sync;
~postInfo = {
var tbeat, eighth;
~tbar = (t.bar);
~tbeat = (((t.beats.floor)%t.beatsPerBar)+1);
("beat :" + ~tbeat).postln;
("bar :" + ~tbar).postln;
case
{ (~tbar == 93.0) && ((((t.beats)%(t.beatsPerBar)+1) > 2.0)) } {
t.schedAbs(t.nextBar, {t.beatsPerBar = 2;});
}
{(~tbar == 94.0) && (~tbeat == 1.0)}{
// ~metronome.play(t);
}
{ (~tbar == 95.0) && (~tbeat == 1.0) } {
}
{ (~tbar == 96.0) && ((((t.beats)%(t.beatsPerBar)+1) > 1.0)) } {
t.schedAbs(t.nextBar, {t.beatsPerBar = 3;});
}
{ (~tbar == 97.0) && (~tbeat == 1.0) } {
}
;
"".postln;
1.0;
}
;
t.schedAbs(t.nextBar, {
~postInfo.value;
});
}))