slippery chicken documentation - changing the tempo

## Changing the tempo

### + Associated example files

- tempo-examples.lsp

close

slippery chicken provides two options for managing tempo and tempo changes over the course of a piece. The first, `tempo-map`, allows the user to set static changes at the beginning of specified sequences within a composition. The second, `tempo-curve`, allows for gradual, interpolated changes in tempo over an x-axis as specified through a list of breakpoint pairs. These two approaches cannot be used in combination.

### + tempo-map

The `tempo-map` takes a list of bar numbers coupled with two-item tempo indications. The bar numbers can be given either as simple bar numbers (integers) or as references to a bar in the form (section-number sequence-number bar-number) (see below). The tempo indications are given as a beat type (rhythmic unit) paired with a beats-per-minute number, such as (q 84), (as also described in the core usage guide). Text descriptions for the given tempo can also be included, as is described in the source code documentation for the tempo class.

Thus, to produce a piece whose tempo starts at quarter=60, then changes to eighth=72 at bar 15, and changes again to dotted-quarter=176 with the text description "prestissimo" at bar 84, the user would enter the following:

    :tempo-map '((1 (q 60)) (15 (e 72)) (84 (q. 176 "prestissimo")))

In the context of a call to the `make-slippery-chicken` function, that may, for example, be incorporated like this:

    (let* ((mini
           (make-slippery-chicken
    	'+mini+
    	:ensemble '(((vn (violin :midi-channel 1))))
    	:tempo-map '((1 (q 60)) (15 (e 72)) (84 (q. 176 "prestissimo")))
    	:set-palette '((1 ((c4 d4 e4 f4 g4 a4 b4 c5))))
    	:set-map (list (list 1 (loop repeat 100 collect 1)))
    	:rthm-seq-palette '((1 ((((2 4) (s) (s) e e e))
    				:pitch-seq-palette ((1 2 3)))))
    	:rthm-seq-map (list (list 1
    				  (list
    				   (list 'vn (loop repeat 100 collect 1))))))))
      (midi-play mini)
      (cmn-display mini))

Using the references approach, to indicate a tempo map that starts with quarter=60, then changes to eighth=72 at the first bar of the first sequence of the second section, then again to dotted-quarter=176 with the text description "prestissimo" at the first bar of the third sequence of the third section, the user would enter:

    :tempo-map '((1 (q 60)) ((2 1 1) (e 72)) ((3 3 1) (q. 176 "prestissimo")))

close

### + tempo-curve

Instead of using references to static bar numbers, interpolated changes to the tempo over the course of a given piece can be indicated using a list of breakpoint pairs, as seen in this example here:

    :tempo-curve '(10 q (0 60 30 144 75 52 100 120))

The first argument to `tempo-curve`, the `10` in this example, is the frequency at which the interpolated tempo is printed in the score. In this instance, the current tempo will be printed every 10 bars. The second argument is the beat type (rhythmic unit) on which the tempo is to be based, in this example a quarter-note, or `q`. The last argument is a list of breakpoint pairs, the first of each pair being a number representing the x-axis, and the second being the beats-per-minute value. The x-axis scale is arbitrary; any scale chosen by the user will be fitted to the number of sequences in the compositions, though the curve should start at 0.

As with other x-axis curves (or "envelopes") in slippery chicken, the x-axis of the `tempo-curve` is scaled to the number of sequences in the given composition, not, for example, bars, notes, or time. More can be found on envelopes in general on the envelopes page of the manual.

In the context of a call to the `make-slippery-chicken` function, this feature may, for example, be incorporated like this:

    (let* ((mini
           (make-slippery-chicken
    	'+mini+
    	:ensemble '(((vn (violin :midi-channel 1))))
    	:tempo-curve '(10 q (0 60 30 144 75 52 100 120))
    	:set-palette '((1 ((c4 d4 e4 f4 g4 a4 b4 c5))))
    	:set-map (list (list 1 (loop repeat 100 collect 1)))
    	:rthm-seq-palette '((1 ((((2 4) (s) (s) e e e))
    				:pitch-seq-palette ((1 2 3)))))
    	:rthm-seq-map (list (list 1
    				  (list
    				   (list 'vn (loop repeat 100 collect 1))))))))
      (midi-play mini)
      (cmn-display mini))

close

### + A note on tempo changes and the chop method

As described in the documentation on intra-phrasal looping, the `chop` method, when applied to a `rthm-seq-palette` object, produces a series of new `rthm-seq` objects that are each one bar long, with durations that are each a fragment of the original, and whose time signatures correspond to the duration of the fragment created. Thus, the example in the Second Law tutorial initially produces only 1/8 and 1/4 bars, as these are the only time signatures that can result from the specified chop points.

Any list passed to the `tempo-map` of such a piece would require bar numbers that refer to these original, very short bars, and any integer passed as the first argument to `tempo-curve` would also refer to these short bars. This means that if the material is re-barred using the `re-bar` method, as in the Second Law tutorial, the tempo indications still remain attached to their original locations, rather than being re-adjusted to the new bars.

#### Placing tempo marks using post-generation editing

slippery chicken allows for various indications, including tempo marks, to be added to and removed from a piece after the creation of the `slippery-chicken` object. This makes it possible to place tempo indications according to new bar numbers after the `re-bar` method has been applied. See the documentation on post-generation data editing for more detail.

close