«Gradually change TempoClock tempo [ accelerando / decelerando ]» by Tom Dugovic

on 30 Jan'22 19:49 in tempoaccelerandodecelerando

This gradually changes the tempo of a TempoClock, each beat of a specified number of beats, and starting at the next bar.

Personally, I was not able to heavily distinguish between .linlin and .linexp for reasonable musical tempos.

There may be a mathematically smoother way of handling this at the control rate.

This function does not gracefully handle multiple simultaneous invocations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
t = TempoClock(120/60).permanent_(true);

(
~change_clock_tempo = {|clock, tempo, beats=1|
    beats.do {|beat|
        var stepTempo = beat.linexp(0, beats-1, clock.tempo, tempo);
        clock.schedAbs(clock.nextBar + beat, {
            "New Tempo: ".post; (stepTempo*60).post; " BPM".postln;
            clock.tempo_(stepTempo);
        });
    };
    nil;
};
Pbindef(\n,
    \octave, 4,
    \dur, 0.5,
    \degree, Pseq((0..7), inf)
).play(t, quant: 4);
);

~change_clock_tempo.value(t, 200/60, 16);
~change_clock_tempo.value(t, 50/60, 8);
t.tempo*60
raw 577 chars (focus & ctrl+a+c to copy)
reception
comments
thanachokkaeo2529 user 31 Jan'22 09:44

good