bar-holder/piece [ Classes ]

[ Top ] [ bar-holder ] [ Classes ]

NAME

 piece

 File:             piece.lsp

 Class Hierarchy:  named-object -> linked-named-object -> sclist -> 
                   circular-sclist -> assoc-list -> recursive-assoc-list ->
                   piece
                                   AND

                   named-object -> linked-named-object -> bar-holder ->
                   piece  

 Version:          1.0.0-beta2

 Project:          slippery chicken (algorithmic composition)

 Purpose:          Implementation of the piece class which holds all the
                   note information for a whole piece in the form of
                   sections (possibly subsections), which then contain
                   player-sections, sequenzes and rthm-seq-bars.  

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

 Creation date:    16th February 2002

 $$ Last modified: 21:42:56 Mon May  7 2012 BST

 SVN ID: $Id: piece.lsp 1982 2012-05-24 15:35:54Z medward2 $

piece/copy-bars [ Methods ]

[ Top ] [ piece ] [ Methods ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defmethod copy-bars ((p piece) from-start-bar to-start-bar 
                      from-player to-player num-bars 
                      &optional (print-bar-nums nil))

piece/delete-sequenzes [ Methods ]

[ Top ] [ piece ] [ Methods ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defmethod delete-sequenzes ((p piece) bar-num player &optional (how-many 1))

piece/get-nth-sequenz [ Methods ]

[ Top ] [ piece ] [ Methods ]

DESCRIPTION

 Get the sequenz object from a specified section of a piece object by
 specifying a position index and a player.

 This is the primary method that should be called to access player
 sequences, as it handles cases in which a player doesn't play in a sequence.

 When the specified player has no note events in the specified sequence and
 the optional argument create-rest-seq is set to T, this method creates a
 rest sequence (one that consists of the correct number of bars with the
 right time signatures, but in which the bars are only rest bars) based on a
 sequence in one of the playing instruments.

ARGUMENTS

 - A piece object.
 - The ID of the section in from which the sequenz object is to be
   returned. 
 - The ID of the player from whose part the sequenz object is to be
   returned. 
 - An integer that is the index (position) of the desired sequenz object
   within the given section. This number is 0-based.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether to convert sequenz objects that are NIL (the
   specified player has no events in the specified sequenz) to sequenz
   objects consisting of full-bar rests. T = create rest sequences. 
   Default = T.

RETURN VALUE

 Returns a sequenz object.

EXAMPLE

;;; Returns a sequenz object
(let ((mini
       (make-slippery-chicken
        '+mini+
        :ensemble '(((hn (french-horn :midi-channel 1))
                     (vc (cello :midi-channel 2))))
        :set-palette '((1 ((f3 g3 a3 b3 c4 d4 e4 f4 g4 a4 b4 c5))))
        :set-map '((1 (1 1 1 1 1))
                   (2 (1 1 1 1 1))
                   (3 (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 ((hn (1 1 1 1 1))
                            (vc (1 1 1 1 1))))
                        (2 ((hn (nil nil nil nil nil))
                            (vc (1 1 1 1 1))))
                        (3 ((hn (1 1 1 1 1))
                            (vc (1 1 1 1 1))))))))
  (get-nth-sequenz (piece mini) 3 'hn 2))

=> 

SEQUENZ: pitch-curve: (1 2 3 4 5)
RTHM-SEQ: num-bars: 1
          num-rhythms: 5
          num-notes: 5
          num-score-notes: 5
          num-rests: 0
          duration: 4.0
          psp-inversions: NIL
          marks: NIL
          time-sigs-tag: NIL
          handled-first-note-tie: NIL
         (for brevity's sake, slots pitch-seq-palette and bars are not printed)
SCLIST: sclist-length: 3, bounds-alert: T, copy: T
LINKED-NAMED-OBJECT: previous: NIL, this: (1), next: NIL
BAR-HOLDER: 
            start-bar: 13
            end-bar: 13
            num-bars: 1
            start-time: 48.0
            end-time: 52.0
            start-time-qtrs: 48.0
            end-time-qtrs: 52.0
            num-notes (attacked notes, not tied): 5
            num-score-notes (tied notes counted separately): 5 
            num-rests: 0
            duration-qtrs: 4.0 
            duration: 4.0 (4.000)

SYNOPSIS

(defmethod get-nth-sequenz ((p piece) section player seq-num ; 0-based
                            &optional (create-rest-seq t))

piece/get-sequenz-from-bar-num [ Methods ]

[ Top ] [ piece ] [ Methods ]

DESCRIPTION

 Get the specified sequenz object located at a specified bar-number location
 of a specified player's part in a given piece object.

ARGUMENTS

 - A piece object. 
 - An integer that is the number of the bar from which to return the sequenz
   object. 
 - The ID of the player from whose part the sequenz object is to be
   returned. 

RETURN VALUE

 A sequenz object.

EXAMPLE

(let ((mini
       (make-slippery-chicken
        '+mini+
        :ensemble '(((hn (french-horn :midi-channel 1))
                     (vc (cello :midi-channel 2))))
        :set-palette '((1 ((f3 g3 a3 b3 c4 d4 e4 f4 g4 a4 b4 c5))))
        :set-map '((1 (1 1 1 1 1))
                   (2 (1 1 1 1 1))
                   (3 (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 ((hn (1 1 1 1 1))
                            (vc (1 1 1 1 1))))
                        (2 ((hn (1 1 1 1 1))
                            (vc (1 1 1 1 1))))
                        (3 ((hn (1 1 1 1 1))
                            (vc (1 1 1 1 1))))))))
  (get-sequenz-from-bar-num (piece mini) 7 'vc))

=>
SEQUENZ: pitch-curve: (1 2 3 4 5)
RTHM-SEQ: num-bars: 1
          num-rhythms: 5
          num-notes: 5
          num-score-notes: 5
          num-rests: 0
          duration: 4.0
          psp-inversions: NIL
          marks: NIL
          time-sigs-tag: NIL
          handled-first-note-tie: NIL
         (for brevity's sake, slots pitch-seq-palette and bars are not printed)
SCLIST: sclist-length: 3, bounds-alert: T, copy: T
LINKED-NAMED-OBJECT: previous: NIL, this: (1), next: NIL
BAR-HOLDER: 
            start-bar: 7
            end-bar: 7
            num-bars: 1
            start-time: 24.0
            end-time: 28.0
            start-time-qtrs: 24.0
            end-time-qtrs: 28.0
            num-notes (attacked notes, not tied): 5
            num-score-notes (tied notes counted separately): 5 
            num-rests: 0
            duration-qtrs: 4.0 
            duration: 4.0 (4.000)

SYNOPSIS

(defmethod get-sequenz-from-bar-num ((p piece) bar-num player)

piece/insert-bar [ Methods ]

[ Top ] [ piece ] [ Methods ]

DESCRIPTION

ARGUMENTS

 <bar-num> is the bar-number within the rsb BEFORE which the new bar is to
 be inserted.

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defmethod insert-bar ((p piece) (rsb rthm-seq-bar) bar-num 
                       ;; these aren't actually optional but we don't
                       ;; need them in the rthm-seq method 
                       &optional section player seq-num ; seq-num is 1-based!
                                 ;; this really is optional
                                 pitch-seq)

piece/rebar [ Methods ]

[ Top ] [ piece ] [ Methods ]

DATE

 29-Jan-2010

DESCRIPTION

 Go through the sequences and rebar according to the first one that has the
 least number of bars (but following the player hierarchy).

ARGUMENTS

 - A piece object (usually provided by calling from the slippery-chicken
   class)

OPTIONAL ARGUMENTS

 - A list of player IDs from the given piece object, ordered in terms of
   importance i.e. which instrument's bar structure should take precedence.
 
 NB: The optional arguments are actually required in this class (not in
     slippery-chicken) but the rebar-fun is not yet used.

RETURN VALUE

 Always T.

SYNOPSIS

(defmethod rebar ((p piece) &optional instruments-hierarchy rebar-fun)