«beats to bar printing» by vtz

on 06 Dec'24 13:05 in beats bar print

Prints beats to bars for a mutiple of bar. How many beats left until next 1, 2, 4, 8, 16, 32, etc bar.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(
f = ();
f.beatAndBar =  {
	var t = currentEnvironment.clock;  // t= TempoClock.new;
	var text = "xB: ";

	var nBeatsPerBar = { arg n, beats, clock;
		var nBpb = clock.beatsPerBar * n;
		"" ++ n ++ text ++ (nBpb - (beats%(nBpb))).asInteger
	};

	t.play({arg beats, time, clock;
		(  //["beat: " ++ (t.beatInBar + 1).asInteger] ++ //uncomment for beat in bar
			[1,2,4,8,16,32].collect( {|n,i| nBeatsPerBar.value(n, beats, clock)})
		).postln;
		1});
	"beatAntBar";
}
)

f[\beatAndBar].value;

(
f[\beatAndBar].value;
CmdPeriod.add(f[\beatAndBar]);
)
raw 575 chars (focus & ctrl+a+c to copy)
reception
comments