./../../src/bar-holder.lsp

## bar-holder/change-pitches [ Methods ]

[ Top ] [ bar-holder ] [ Methods ]

DESCRIPTION

     Change the pitches in the specified bars to the specified new pitches.

     NB: This method requires that full bars be given, even if not all pitches
         are being changed.

ARGUMENTS

     - A bar-holder object (such as the PIECE slot within a slippery-chicken
      object).
     - The ID of the player whose part is to be changed.
     - An integer that is the number of the first bar in which pitches are to be
       changed.
     - A list of lists of note-name symbols, each sublist representing a
       consecutive bar and containing the same number of note-name symbols as
       there are rhythms in that bar. A NIL in these lists means no change is to
       be made to the corresponding rhythm or bar (see example below). NB: This
       method counts tied notes rather than just attacked notes.

OPTIONAL ARGUMENTS

     keyword arguments:
     - :use-last-octave.  T or NIL to indicate whether the method is to require
       that each note-name symbols in the <new-pitches> list has an octave
       indicator. If this argument is set to NIL, each note-name symbol must
       have an octave indicator (e.g., the 4 in c4). If this argument is set to
       T, only the first note-name symbol in the bar is required to have an
       octave indicator, and all subsequent note-name symbols without octave
       indicators will use the last octave indicated; e.g. '((a3 b g cs4)). NB:
       This feature does not work with chords. Default = T.
     - :written.  T or NIL to indicate whether these are the written or sounding
       notes for a transposing instrument. Default = NIL.

RETURN VALUE

     Always returns T.

EXAMPLE

    ;;; NIL indicates that no change is to be made; this applies to single rhythms
    ;;; as well as entire bars.
    (let ((mini
           (make-slippery-chicken
            '+mini+
            :ensemble '(((cl (b-flat-clarinet :midi-channel 1))
                         (vc (cello :midi-channel 2))))
            :set-palette '((1 ((c2 d2 e2 f2 g2 a2 b2
                                   c3 d3 e3 f3 g3 a3 b3
                                   c4 d4 e4 f4 g4 a4 b4 c5))))
            :set-map '((1 (1 1 1 1 1)))
            :rthm-seq-palette '((1 ((((4 4) h q e (s) s))
                                    :pitch-seq-palette ((1 (2) 3 4)))))
            :rthm-seq-map '((1 ((cl (1 1 1 1 1))
                                (vc (1 1 1 1 1))))))))
      (change-pitches (piece mini) 'cl 2 '((c4 d4 e4 f4)))
      (change-pitches (piece mini) 'vc 3 '((c3 d e f) nil (g3 nil b c4))))

    => T

SYNOPSIS

    (defmethod change-pitches ((bh bar-holder) player start-bar new-pitches
                               &key (use-last-octave t) written)

## bar-holder/delete-all-marks [ Methods ]

[ Top ] [ bar-holder ] [ Methods ]

DESCRIPTION

     Delete all marks from the MARKS slots of all events in the specified
     measure range of a given bar-holder object and set the slot to NIL.

     This method always applies to full bars.

ARGUMENTS

     - A bar-holder object.
     - An integer that is the number of the first bar from which all marks are
       to be deleted.
     - An integer that is the number of consecutive bars including the first
       bar from which all marks are to be deleted.
     - The ID of the player from whose part the marks are to be deleted.

RETURN VALUE

     Always returns T.

EXAMPLE

    (let ((mini
           (make-slippery-chicken
            '+mini+
            :ensemble '(((cl (b-flat-clarinet :midi-channel 1))
                         (vc (cello :midi-channel 2))))
            :set-palette '((1 ((c2 d2 e2 f2 g2 a2 b2
                                   c3 d3 e3 f3 g3 a3 b3
                                   c4 d4 e4 f4 g4 a4 b4 c5))))
            :set-map '((1 (1 1 1 1 1)))
            :rthm-seq-palette '((1 ((((4 4) h q e (s) s))
                                    :pitch-seq-palette ((1 (2) 3 4))
                                    :marks (a 1 s 2 te 3 as 4))))
            :rthm-seq-map '((1 ((cl (1 1 1 1 1))
                                (vc (1 1 1 1 1))))))))
      (delete-all-marks (piece mini) 2 2 'vc))

    => T

SYNOPSIS

    (defmethod delete-all-marks ((bh bar-holder) start-bar num-bars player)

## bar-holder/get-note [ Methods ]

[ Top ] [ bar-holder ] [ Methods ]

DESCRIPTION

     Return the event object (or pitch object, if accessing a note within a
     chord) from a specified bar and note within a given bar-holder object.

ARGUMENTS

     - A bar-holder object (e.g. PIECE slot of a slippery-chicken object).
     - An integer that is the 1-based number of the bar from which the note is
       to be retrieved.
     - An integer or two-item list of integers that is the 1-based number of the
       note to retrieve within the specified bar. If an integer, the entire
       event object is retrieved. A two-item list of integers is used to
       retrieve a specific note from within a chord, in the form '(2 1), where 2
       is the second note (or non-rhythm event) in the bar, and 1 is the first
       note in the chord counting from the bottom. NB: This argument also counts
       tied notes, not just attacked notes.
     - The ID of the player from whose part the note is to be retrieved.

OPTIONAL ARGUMENTS

     - T or NIL to indicate whether, when accessing a pitch in a chord, to
       return the written or sounding pitch. T = written. Default = NIL.

RETURN VALUE

     An event object, or single pitch object if accessing a note within a
     chord.

EXAMPLE

    (let ((mini
           (make-slippery-chicken
            '+mini+
            :ensemble '(((cl (b-flat-clarinet :midi-channel 1))
                         (vc (cello :midi-channel 2))))
            :set-palette '((1 ((c2 d2 e2 f2 g2 a2 b2
                                   c3 d3 e3 f3 g3 a3 b3
                                   c4 d4 e4 f4 g4 a4 b4 c5))))
            :set-map '((1 (1 1 1 1 1)))
            :rthm-seq-palette '((1 ((((4 4) h q e s s))
                                    :pitch-seq-palette ((1 (2) 3 4 5)))))
            :rthm-seq-map '((1 ((cl (1 1 1 1 1))
                                (vc (1 1 1 1 1))))))))
      (print (get-note (piece mini) 3 '(2 1) 'vc)) ; single pitch within a chord
      (print (get-note (piece mini) 3 2 'vc)) ; entire chord event
      (print (get-note (piece mini) 5 3 'cl)))

SYNOPSIS

    (defmethod get-note ((bh bar-holder) bar-num note-num player &optional written)

## bar-holder/transpose-bars [ Methods ]

[ Top ] [ bar-holder ] [ Methods ]

DESCRIPTION

     Transpose the pitches of the specified bars in a given player's part by a
     specified number of semitones.

ARGUMENTS

     - A bar-holder object (such as the PIECE slot of a slippery-chicken
       object).
     - A positive or negative integer that is the number of semitones by which
       the pitches of the specified bars are to be transposed.
     - An integer that is the number of the first bar in which the pitches are
       to be transposed.
     - An integer that is the number of consecutive bars, including the
       start-bar, in which the pitches are to be transposed.
     - The ID of the player whose part is to be changed.

OPTIONAL ARGUMENTS

     keyword arguments:
     - :destructively. T or NIL to indicate whether the transposed pitches are
       to replace the existing pitches of the given bar-holder object. This must
       be set to T if the pitches of the original object are to be transposed
       before, for example, generating output. If NIL, the original object will
       first be cloned, the pitches of the original object will be left
       untouched and the changes will be made to the copy. Default = NIL.
     - :print-bar-nums. T or NIL to indicate whether the method should print
       feedback about which bars have been transposed to the listener.
       T = print feedback. Default = NIL.
     - :chord-function. The function that is to be used for transposition of
       chords objects. Default = #'transpose (of the chord class).
     - :chord-function. The function that is to be used for transposition of
       pitch objects. Default = #'transpose (of the pitch class).

RETURN VALUE

     Returns a list of the rthm-seq-bar objects that have been transposed.

EXAMPLE

    (let ((mini
           (make-slippery-chicken
            '+mini+
            :ensemble '(((cl (b-flat-clarinet :midi-channel 1))
                         (vc (cello :midi-channel 2))))
            :set-palette '((1 ((c2 d2 e2 f2 g2 a2 b2
                                   c3 d3 e3 f3 g3 a3 b3
                                   c4 d4 e4 f4 g4 a4 b4 c5))))
            :set-map '((1 (1 1 1 1 1)))
            :rthm-seq-palette '((1 ((((4 4) h q e (s) s))
                                    :pitch-seq-palette ((1 (2) 3 4)))))
            :rthm-seq-map '((1 ((cl (1 1 1 1 1))
                                (vc (1 1 1 1 1))))))))
      (transpose-bars (piece mini) 11 2 2 'cl
                      :destructively t
                      :print-bar-nums t))

SYNOPSIS

    (defmethod transpose-bars ((bh bar-holder) semitones start-bar num-bars player
                               &key
                               (destructively nil)
                               (print-bar-nums nil)
                               ;; the default functions are the class methods for
                               ;; pitch or chord.
                               (chord-function #'transpose)
                               (pitch-function #'transpose))

## linked-named-object/bar-holder [ Classes ]

[ Top ] [ linked-named-object ] [ Classes ]

NAME

     bar-holder

     File:             bar-holder.lsp

     Class Hierarchy:  named-object -> linked-named-object -> bar-holder

     Version:          1.0.12

     Project:          slippery chicken (algorithmic composition)

     Purpose:          This class is meant to be sub-classed by piece, section
                       and sequence, all of which hold each other or, ultimately
                       a list of bars with relevant rhythms, timings, pitches
                       etc.

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

     Creation date:    16th February 2002

     $$ Last modified:  17:53:05 Wed Dec 30 2020 CET

     SVN ID: $Id$