./../../src/rthm-chain.lsp

## rthm-chain/add-voice [ Methods ]

[ Top ] [ rthm-chain ] [ Methods ]

FUNCTION

     The main rthm-chain algorithm generates only two voices.  Rather than
     generate further voices in the same fashion, use the already created
     rthm-seqs to create other voices.  The challenge here is that each rthm-seq
     has potentially its own time signature structure: there could be a 2/4 bar
     followed by 5/4 then 3/16; or any other combination of any meter.  So first
     of all, we analyse the time-signature structure of the existing rthm-seqs
     and save those with the same bar/meter structure together in the order in
     which they occurred.  When creating the extra voice then, we actually start
     ahead of the main voice, by choosing <offset> similar rthm-seqs in advance

ARGUMENTS

     - the rthm-chain instance
     - the parent voice i.e. a reference into the create rthm-seq-map (e.g. '(1
     perc1)
     - the id of the new player (symbol)
     - (optional: offset default 1): which similar rthm-seq to start at (so
     generated voice will be ahead of main voice)

RETURN VALUE

     t

EXAMPLE

DATE

SYNOPSIS

    (defmethod add-voice ((rc rthm-chain) parent new-player &optional (offset 1))

## rthm-chain/hash-least-used [ Functions ]

[ Top ] [ rthm-chain ] [ Functions ]

FUNCTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

    (defun hash-least-used (hash &key (start 0) end ignore (auto-inc t))

## rthm-chain/make-rthm-chain [ Functions ]

[ Top ] [ rthm-chain ] [ Functions ]

FUNCTION

     Create an instance of a rthm-chain object. The rthm-chain class enables the
     algorithmic generation of a rthm-seq-map (with just one section) and its
     associated rthm-seq-palette, which consists in turn of algorithmically
     generated rthm-seq objects.

     The rhythm-seq objects are made up of both faster material based on 1-beat
     groups and slower-moving counterpoint based on 2- or 3-beat groups.

     The rthm-chain class also allows for control of the degree of activity in
     the parts over time through user-specified envelopes.

     Rests are automatically inserted at regular but changing intervals.

     Specified 'sticking points' cause individual rhythms to be repeated a
     certain number of times. Sticking happens after rests and can also be
     controlled with an activity envelope.

     NB: Because this method uses the procession method internally, each
         collection of 1-beat-rthms and slower-rthms defined must contain at
         least four items.

     NB: Since this method automatically inserts rests into the chains, the user
         may like to implement the various tie-over-rests post-generation
         editing methods. If this is done, the handle-ties method may also be
         recommended, as the tie-over-rests methods only affect printed output
         and not MIDI output.

ARGUMENTS

     - A number, symbol, or string that is to be the ID of the new rthm-chain
       object.
     - An integer that is the number of beats to be generated prior to adding
       additional material created from sticking points and the automatic
       addition of rests.
     - A list with sublists of rhythms that are to be the 1-beat rhythms used to
       construct the faster-moving material of the rthm-seq-palette. Each
       sublist represents the repertoire of rhythms that will be used by the
       procession method. Each sublist must contain the same number of rthms but
       their number and the number of sublists is open. A transition will be
       made from one group of rhythms to the next over the whole output
       (i.e. not one unit to another within e.g. the 1-beat rhythms) according
       to a fibonacci-transition method.
     - A list with sublists of 2-beat and 3-beat full bars of rhythms used to
       construct the slower-moving counterpoint material of the
       rthm-seq-palette. This will be turned into a rthm-chain-slow object, and
       will therefore remain as lists of unparsed rhythms. Each sublist must
       contain the same number of rthms but their number and the number of
       sublists is open. A transition will be made from one group of rhythms to
       the next over the whole output (i.e. not one unit to another within
       e.g. the 1-beat rhythms) according to a fibonacci-transition method.
       NB: The rhythm units of slower-rthms must be expressed in single beats;
       e.g., a 2/4 bar must consist of q+q rather than h. The consolidate-notes
       method can be called afterwards if desired.

OPTIONAL ARGUMENTS

     keyword arguments:
     - :beat. An integer that indicates the rhythmic unit of the primary beat
       basis of the rhythms specified. Default = 4.
     - :1-beat-fibonacci. T or NIL to indicate whether the sequence of 1-beat
       rhythms is to be generated using the fibonacci-transitions method or the
       processions method. T = use fibonacci-transitions method. Default = NIL.
     - :slow-fibonacci. T or NIL to indicate whether the sequence of the slow
       rhythms will be generated using the fibonacci-transitions method or the
       processions method. This affects the order in which each 2- or 3-beat
       unit is used when necessary, not the order in which each 2- or 3-beat
       unit is selected; the latter is decided by the next element in the DATA
       slot of the rthm-chain-slow object, which simply cycles through
       '(2 3 2 2 3 2 2 3 3 3). T = use fibonacci-transisitions method.
       Default = NIL.
     - :players. A list of player IDs. When used in conjunction with a
       slippery-chicken object (which is the standard usage), these must be IDs
       as they are defined in that object's ENSEMBLE slot.
       Default = '(player1 player2).
     - :section-id. An integer that will be used as the ID of the rthm-seq-map
       created. NB: rthm-chain only creates rthm-seq-maps with one section,
       making it possible to create several different ones for different
       sections in the given piece, and requiring that these be manually
       assigned IDs. Default = 1.
     - :rests. The rhythmic duration unit(s) of the rests that will be used when
       the method uses the rest-insertion algorithm to automatically insert
       rests into the resulting objects. The specified rests are used in a
       sequence determined by a recurring-event object. Default = '(e q q. w).
     - :do-rests. T or NIL to indicate whether to apply the automatic
       rest-insertion algorithm. T = use. Default = T.
     - :rest-cycle. A list of 2-item lists that indicate the pattern by which
       rests of specific rhythmic durations will be selected from the RESTS slot
       for automatic insertion. The first number of each pair is a 0-based
       position referring to the list of rests in the RESTS slot, and the second
       number is the number of times the rest at that particular position should
       be inserted. (This number does not mean that the selected rest will be
       inserted that many times at once, but rather that each consecutive time
       the rest algorithm selects one rest to be inserted, it will insert that
       specific rest, for the specified number of consecutive times.) For
       example, (0 3) indicates that for the next three times that the rest
       algorithm selects one rest to insert, it will select the rest located at
       position 0 in the list of rests in the RESTS slot (e by default).
       Default ='((0 3) (1 1) (0 2) (2 1) (1 1) (3 1)).
     - :do-rests-curve. A list of break-point pairs with y values of either 0 or
       1 indicating whether the do-rests algorithm is active or disabled. This
       values are interpolated between each pair, with all values 0.5 and higher
       being round up to 1 and all below 0.5 rounded to 0. Default = NIL.
     - :rest-re. A list of 2-item lists that indicate the pattern by which rests
       will be automatically inserted. The first number of each pair determines
       how many events occur before inserting a rest, and the second number of
       each pair determines how many times that period will be repeated. For
       example, (2 3) indicates that a rest will be inserted every two events,
       three times in a row. The list passed here will be treated as data for a
       recurring-event object that will be repeatedly cycled through.
       Default = '((2 3) (3 2) (2 2) (5 1) (3 3) (8 1)).
     - :activity-curve. A list of break-point pairs with y values from 1 to 10
       indicating the amount of activity there should be over the course of the
       piece. A value of 1 indicates that only 1 in 10 beats will have notes
       in/on them, and a value of 10 indicates that all beats will have
       notes. This process uses the patterns given in
       activity-levels::init-instance below, where 1 means 'play' and 0 means
       'rest'. There are three examples of each level, so that if the curve
       remains on one level of activity for some time it won't always return the
       same pattern; these will be rotated instead. If the activity curve
       indicates a rest for one of the slower-rhythms groups, the whole 2-3 beat
       group is omitted.
     - :harmonic-rthm-curve. A list of break-point pairs that indicates how many
       slower-rthms will be combined into one rthm-seq (each rthm-seq has a
       single harmony). The default is 2 bars (slower-rthms) per rthm-seq,
       i.e. '(0 2 100 2).
     - :do-sticking. T or NIL to indicate whether the method should apply the
       sticking algorithm. T = apply. Default = T.
     - :do-sticking-curve. A list of break-point pairs that can be used,
       alternatively, to control whether the sticking algorithm is being applied
       or not at any given point over the course of the piece. The y values for
       this curve should be between 0 and 1, and the decimal fractions achieved
       from interpolation will be rounded. The 1 values resulting from this
       curve will only be actively applied to if do-sticking is set to T.
     - :sticking-curve. A list of break-point pairs that acts as an activity
       envelope to control the sticking, which always occurs after rests. As
       with the activity curve, this curve can take y values up to 10, but also
       allows 0. A y value of 0 or 1 here refers to either a specific number of
       repeats (1) or none (0). The number of repeats may be determined, for
       example, by use of the procession method, such as
       (procession 34 '(2 3 5 8 13) :peak 1 :expt 3). Every sticking point is
       accompanied by a slower group, which is simply chosen in sequence and
       repeated for the duration of the sticking period.
     - :sticking-repeats. A list of integers to indicate the number of
       repetitions applied in sticking segments. When the values of this list
       have been exhausted, the method cycles to the beginning and continues
       drawing from the head of the list again. NB: This list is made into a
       circular-sclist object when the given rthm-chain object is initialized
       unless a circular-sclist object is explicitly provided.
     - :sticking-rthm. A list of rhythmic units that will serve as the rhythms
       employed by the sticking algorithm. These are generated at initialization
       if not specified here. NB: This list is used to create a list using the
       procession algorithm at initialization, so it is best to apply something
       similar to the default if not accepting the default (if the user would
       like to specify a different list). If a circular-sclist object is
       provided here, it will be used instead of the default procession.
     - :split-data. NIL or a two-item list of integers that are the minimum and
       maximum beat duration of bars generated. If NIL, the bars will not be
       split. Default = '(2 5)

RETURN VALUE

     A rthm-chain object.

EXAMPLE

    ;; An example using a number of the keyword arguments.
    (make-rthm-chain
     'test-rch 14
     '((((e) e) ; 4 in total
        (- s (s) (s) s -)
        ({ 3 (te) - te te - })
        ((e.) s))
       (({ 3 (te) te (te) }) ; what we transition to
        ({ 3 - te (te) te - })
        ({ 3 (te) - te te - })
        ({ 3 (te) (te) te })))
     '((((q q) ; the 2/4 bars: 5 total
         ((q) q)
         ((q) q)
         ((q) (s) e.)
         (- e e - (e) e))
        (({ 3 te+te te+te te+te }) ; what we transition to
         (q - s e. -)
         (q (s) e.)
         (q (s) - s e -)
         ({ 3 te+te te+te - te te - })))
       ((((e.) s (e) e (s) e.) ; the 3/4 bars: 4 total
         (- e e - (e) e (q))
         (- e. s - - +e e - (q))
         (q (e.) s (q)))
        (({ 3 (te) (te) te+te te+te } (q)) ; what we transition to
         (- e. s - (q) (s) - s e -)
         ({ 3 te+te te } (q) q)
         ({ 3 - te te te - } (e) e { 3 (te) (te) te }))))
     :players '(fl cl)
     :slow-fibonacci t
     :activity-curve '(0 1 100 10)
     :harmonic-rthm-curve '(0 1 100 3)
     :do-sticking t
     :do-sticking-curve '(0 1 25 0 50 1 75 0 100 1)
     :sticking-curve '(0 0 100 10)
     :sticking-repeats '(3 5 7 11 2 7 5 3 13)
     :sticking-rthms '(e s. 32 e.)
     :split-data '(4 7))

    =>
    RTHM-CHAIN: 1-beat-rthms: (((E E) (S S S S) (TE TE TE) (E. S))
                               ((TE TE TE) (TE TE TE) (TE TE TE) (TE TE TE)))
                slower-rthms: ((((Q Q) ((Q) Q) ((Q) Q) ((Q) (S) E.)
                                 (- E E - (E) E))
                                (({ 3 TE+TE TE+TE TE+TE }) (Q - S E. -)
                                 (Q (S) E.) (Q (S) - S E -)
                                 ({ 3 TE+TE TE+TE - TE TE - })))
                               ((((E.) S (E) E (S) E.) (- E E - (E) E (Q))
                                 (- E. S - - +E E - (Q)) (Q (E.) S (Q)))
                                (({ 3 (TE) (TE) TE+TE TE+TE } (Q))
                                 (- E. S - (Q) (S) - S E -)
                                 ({ 3 TE+TE TE } (Q) Q)
                                 ({ 3 - TE TE TE - } (E) E { 3 (TE) (TE) TE
                                  }))))
                1-beat-fibonacci: NIL
                num-beats: 14
                slow-fibonacci: NIL
                num-1-beat-rthms: 4
                num-1-beat-groups: 2
                sticking-curve: (0.0 0 13 10)
                harmonic-rthm-curve: (0.0 1 13 3)
                beat: 4
                do-sticking: T
                do-rests: T
                do-sticking-curve: (0.0 1 3.25 0 6.5 1 9.75 0 13 1)
                do-rests-curve: NIL
                sticking-al: (not printed for brevity's sake)
                sticking-rthms: (E S. E S. 32 E 32 E E E. S. 32 S. E. S. 32 S.
                                 32 E. E)
                sticking-repeats: (3 5 3 5 7 3 7 3 3 11 5 7 5 11 5 7 5 7 11 3
                                   7 3 3 11 5 7 5 11 3 7 3 7 11 5 7 5 5 11 3
                                   11 3 2 11 2 11 2 7 2 7 2 2 5 5 3 5)
                activity-curve: (0.0 1 13 10)
                main-al: (not printed for brevity's sake)
                slower-al: (not printed for brevity's sake)
                num-slower-bars: 11
                rcs: (not printed for brevity's sake)
                rests: (E Q Q. W)
                rest-re: (not printed for brevity's sake)
                rest-cycle: ((0 3) (1 1) (0 2) (2 1) (1 1) (3 1))
                num-rthm-seqs: 11
                section-id: 1
                split-data: (4 7)
    RTHM-SEQ-MAP: num-players: 2
                  players: (CL FL)
    SC-MAP: palette id: RTHM-CHAIN-RSP
    [...]

SYNOPSIS

    (defun make-rthm-chain (id num-beats 1-beat-rthms slower-rthms &key
                            (beat 4)
                            (1-beat-fibonacci nil)
                            (slow-fibonacci nil)
                            (players '(player1 player2))
                            (section-id 1)
                            (rests '(e q q. w))
                            (do-rests t)
                            (do-rests-curve nil)
                            (rest-re '((2 3) (3 2) (2 2) (5 1) (3 3) (8 1)))
                            (rest-cycle '((0 3) (1 1) (0 2) (2 1) (1 1) (3 1)))
                            (activity-curve '(0 10 100 10))
                            (sticking-curve '(0 2 100 2))
                            (harmonic-rthm-curve '(0 2 100 2))
                            (do-sticking t)
                            (do-sticking-curve nil)
                            (sticking-repeats '(3 5 3 5 8 13 21))
                            (sticking-rthms '(e e e. q e s))
                            (split-data '(2 5)))

## rthm-chain/procession [ Functions ]

[ Top ] [ rthm-chain ] [ Functions ]

DATE

     26-Jan-2010

FUNCTION

     Generate a list of a specified length consisting of items extrapolated from
     a specified starting list. All elements of the resulting list will be
     members of the original list.

     The method generates the new list by starting with the first 3 elements of
     the initial list and successively adding consecutive elements from the
     initial list until all elements have been added.

ARGUMENTS

     - An integer that is the number of items in the list to be generated.
     - A list of at least 4 starting items or an integer >=4. If an integer is
       given rather than a list, the method will process a list of consecutive
       numbers from 1 to the specified integer.

OPTIONAL ARGUMENTS

     keyword arguments:
     - :peak. A decimal number >0.0 and <=1.0. This number indicates the target
       location in the new list at which the last element is to finally occur,
       whereby e.g. 0.7 = ~70% of the way through the resulting list. This is an
       approximate value only. The last element may occur earlier or later
       depending on the values of the other arguments. In particular, initial
       lists with a low number of items are likely to result in new lists in
       which the final element occurs quite early on, perhaps even nowhere near
       the specified peak value. Default = 0.7.
     - :expt. A (decimal) number that indicates the "curve" that determines the
       intervals at which each successive element of the initial list is
       introduced to the new list. A higher number indicates a steeper
       exponential curve. Default = 1.3.
     - :orders. The patterns by which the elements are added. The method
       cyclically applies these orders, the numbers 1, 2, and 3 representing the
       three least used elements at each pass. These orders must therefore
       contain all of the numbers 1, 2, and 3, and those numbers only.
       Default = '((1 2 1 2 3) (1 2 1 1 3) (1 2 1 3)).

RETURN VALUE

     Returns two values, the first being the new list, with a secondary value
     that is a list of 2-item lists that show the distribution of each element
     in the new list.

EXAMPLE

    (procession 300 30 :peak 0.1)

    =>
    (1 2 1 2 3 4 5 4 4 6 7 8 7 9 10 11 10 11 12 13 14 13 13 15 16 17 16 18 19 20 19
       20 21 22 23 22 22 24 25 26 25 27 28 29 28 29 30 3 5 3 3 6 8 9 8 12 14 15 14
       15 17 18 21 18 18 23 24 26 24 27 1 2 1 2 30 5 6 5 5 7 9 10 9 11 12 16 12 16
       17 19 20 19 19 21 23 25 23 26 27 28 27 28 29 4 6 4 4 30 7 8 7 10 11 13 11 13
       14 15 17 15 15 20 21 22 21 24 25 26 25 26 29 1 2 1 1 30 3 6 3 8 9 10 9 10 12
       14 16 14 14 17 18 20 18 22 23 24 23 24 27 28 29 28 28 30 2 5 2 6 7 8 7 8 11
       12 13 12 12 16 17 19 17 20 21 22 21 22 25 26 27 26 26 29 3 4 3 30 5 6 5 6 9
       10 11 10 10 13 15 16 15 18 19 20 19 20 23 24 25 24 24 27 1 29 1 30 2 4 2 4 7
       8 9 8 8 11 13 14 13 16 17 18 17 18 21 22 23 22 22 25 27 28 27 29 3 5 3 5 30
       6 7 6 6 9 11 12 11 14 15 16 15 16 19 20 21 20 20 23 25 26 25 28 1 29 1 29 30
       2 4 2 2 7 9 10 9 12 13 14 13 14 17 18), ((2 12) (20 11) (14 11) (13 11)
       (9 11) (6 11) (1 11) (29 10) (25 10) (22 10) (18 10) (17 10) (16 10) (15 10)
       (12 10) (11 10) (10 10) (8 10) (7 10) (5 10) (4 10) (3 10) (30 9) (28 9)
       (27 9) (26 9) (24 9) (23 9) (21 9) (19 9))

    (procession 300 30 :peak 0.9)

    =>
    (1 2 1 2 3 1 3 1 1 4 2 3 2 4 3 4 3 4 5 2 4 2 2 5 1 3 1 5 3 4 3 4 5 1 5 1 1 6 2
       5 2 6 4 5 4 5 6 3 6 3 3 7 5 6 5 7 2 6 2 6 7 6 7 6 6 8 4 7 4 8 7 8 7 8 9 7 8
       7 7 9 8 9 8 10 8 9 8 9 10 8 9 8 8 10 9 10 9 11 9 10 9 10 11 10 11 10 10 12
       10 11 10 12 11 12 11 12 13 11 12 11 11 13 12 13 12 14 12 13 12 13 14 13 14
       13 13 15 13 14 13 15 11 14 11 14 15 14 15 14 14 16 15 16 15 17 15 16 15 16
       17 16 17 16 16 18 16 17 16 18 17 18 17 18 19 17 18 17 17 19 18 19 18 20 18
       19 18 19 20 19 20 19 19 21 15 20 15 21 20 21 20 21 22 20 21 20 20 22 21 22
       21 23 21 22 21 22 23 22 23 22 22 24 23 24 23 25 23 24 23 24 25 24 25 24 24
       26 23 25 23 26 25 26 25 26 27 26 27 26 26 28 25 27 25 28 27 28 27 28 29 27
       28 27 27 29 28 29 28 30 24 29 24 29 30 26 29 26 26 30 28 29 28 30 19 29 19
       29 30 22 25 22 22 30 12 27 12 30 14 16 14 16 30 17), ((8 12) (22 11)
       (16 11) (14 11) (12 11) (11 11) (10 11) (4 11) (3 11) (2 11) (26 10)
       (19 10) (17 10) (15 10) (13 10) (9 10) (7 10) (6 10) (5 10) (1 10)
       (29 9) (28 9) (27 9) (25 9) (24 9) (23 9) (21 9) (20 9) (18 9) (30 8))

SYNOPSIS

    (defun procession (num-results items
                       &key
                       ;; what proportion of the way through should we aim to reach
                       ;; the max number of items?  NB This is approximate only:
                       ;; you may find the first occurrence of the highest element
                       ;; earlier or later depending on the values of the other
                       ;; arguments.  In particular, with a low number of items the
                       ;; highest element will be hit very early on, perhaps
                       ;; nowhere near the peak argument.
                       (peak 0.7)
                       ;; for an exponential curve going from 3 to num <items>
                       (expt 1.3)
                       ;; these are the orders we'll use at the beginning
                       ;; (cyclically). They will then be used when we've gone
                       ;; beyond 3 items by always using the 3 least used items.
                       ;; NB This must contain the numbers 1, 2, and 3 only but
                       ;; there can be 1 or any number of sublists.
                       (orders '((1 2 1 2 3) (1 2 1 1 3) (1 2 1 3))))

## rthm-chain/reset [ Methods ]

[ Top ] [ rthm-chain ] [ Methods ]

FUNCTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

    (defmethod reset ((rc rthm-chain) &optional where)

## rthm-chain/rthm-chain-gen [ Methods ]

[ Top ] [ rthm-chain ] [ Methods ]

FUNCTION

     Generate a chain of rhythms, also internally making use of the procession
     function.
     The basic algorithm for 2 parts is: we're given an arbitrary number of
     1-beat rthms (e.g. s s (e)) and 2-3 beat slower-moving counterpoints.  We
     generate a sequence of these using the procession function.  Then we apply
     the activity curve, and after that the insertion of 8th rests.  Then come
     the 'sticking points': these come after the rests and the activity curves
     applied to these count inserted rests not seqs or beats.

     NB: Rests are put into the rthm-seq mid-sequence so sticking points won't
         come straight after the rests, rather, at the end of the seq.

     The activity curves that turn notes into rests will be queried every beat
     so if we change an activity level we don't wait until the end of the
     previous level's ten beats.

     NB: This method is not generally called by the user (though it can be of
         course), rather it's called by the init function.

ARGUMENTS

     - A rthm-chain object.

OPTIONAL ARGUMENTS

     keyword arguments:
     - (key :rests ) whether to generate the rests default: t
     - (key :stick)  whether to generate the sticking point s
     - (key :num-beats ) how many beats to use for the
        algorithm. NB we'll generate considerably more if we have sticking and
        rests; this number really just refers to the number of standard 1-beat
        rhythms we'll generate.  If nil, then we use the num-beats slot of the
        rc instance. default: nil
     - (key :use-fibonacci ) whether to use a fibonacci transition to
        move through the 1-beat rhythms (so they'll be repeated) or the
        procession algorithm (where they'll be alternated). default t
     - (key :section-id ) for the sake of the map, what section we'll
        put the references into.  The rthm-seqs themselves will be parcelled up
        into an object with this id too, so we can avoid id conflicts if we
        combine 2+ sections generatd by separate rthm-chain objects. default 1
     - (key :split ): whether to split up longer generated bars
       (e.g. 7/4) into smaller bars.  If this is a two-element list it
        represents the min/max number of beats in a bar (where a 6/8 bar is two
        compound beats) default '(2 5)
     - (key :wrap ): when we create the 1-beat rythms' and slow
        rhythms' order, we can choose to start at any point in the list default nil

RETURN VALUE

     the number of rthm-seqs we've generated

SYNOPSIS

    (defmethod rthm-chain-gen ((rc rthm-chain)
                               &key
                               (use-fibonacci t)
                               (rests t)
                               (stick t)
                               (section-id 1)
                               num-beats
                               wrap)

## rthm-chain/split [ Methods ]

[ Top ] [ rthm-chain ] [ Methods ]

FUNCTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

    (defmethod split ((rc rthm-chain) &key
                      (min-beats 2) (max-beats 5) warn (clone t))

## rthm-seq-map/rthm-chain [ Classes ]

[ Top ] [ rthm-seq-map ] [ Classes ]

NAME

     rthm-chain

     File:             rthm-chain.lsp

     Class Hierarchy:  named-object -> linked-named-object -> sclist ->
                       circular-sclist -> assoc-list -> recursive-assoc-list ->
                       sc-map -> rthm-seq-map -> rthm-chain

     Version:          1.0.0-beta1

     Project:          slippery chicken (algorithmic composition)

     Purpose:          Algorithmic generation of rthm-seqs that include
                       slower-moving counterpoint and a means to control
                       activity development through curves.  Here we generate a
                       rthm-seq-map and its associated palette algorithmically.

                       Say we have 9 irregular 1 beat duration patterns; these
                       would enter in the sequence defined by (procession x 9)
                       where x would be the number of patterns to generate.

                       Rests are inserted at regular but changing intervals e.g

                       3x every 2 beats (6)
                       2x every 3 beats (6)
                       3x every 5 beats (15)
                       2x every 8 beats (16)

                       e, q, and q. rests are used by default, in a sequence
                       determined by a recurring-event instance.

                       In order to make music that 'progresses' we have curves
                       with y values from 1-10 indicating how much activity
                       there should be: 1 would mean only 1 in 10 beats would
                       have notes in/on them, 10 would indicate that all do.  We
                       use the patterns given in activity-levels::init-instance
                       below, where 1 means 'play', 0 means 'rest'.  There are
                       three examples of each level so that if we stick on one
                       level of activity for some time we won't always get the
                       same pattern: these will instead be cycled through.

                       A slower moving (bass) line is also added that is made up
                       of 2 or 3 beat groups---if the activity curve indicates a
                       rest, then the whole 2-3 beat group is omitted.

                       There are also 'sticking points' where a rhythm will be
                       repeated a certain number of times (either s,e,e., or q
                       by default).  Sticking happens after rests.  This can be
                       controlled with an activity envelope too, also indicating
                       one of the 10 patterns above (but also including 0).  A 0
                       or 1 unit here would refer to a certain number of repeats
                       (1) or none (0).  How many repeats could be determined by
                       something like: (procession 34 '(2 3 5 8 13) :peak 1
                       :expt 3) There's always a slower group to accompany the
                       sticking points: simply the next in the sequence,
                       repeated for as long as we stick

                       The harmonic-rthm curve specifies how many slower-rthms
                       will be combined into a rthm-seq (each rthm-seq has a
                       single harmony).  The default is 2 bars (slower-rthms)
                       per rthm-seq.

     Author:           Michael Edwards: m@michael-edwards.org

     Creation date:    4th February 2010

     $$ Last modified: 19:03:14 Mon Apr 30 2012 BST

     SVN ID: $Id: rthm-chain.lsp 1819 2012-05-18 00:33:22Z sreed23 $