# Score Layout

- slippery chicken itself does not produce printable output.
- Generates data and files for CMN and LilyPond.
- Moving colliding symbols etc. not possible using slippery chicken code.
    - Use 3rd-party SVG software like Adobe Illustrator or Inkscape (open source).
- sc has arguments for:
    - inserting elements into the header.
    - defining attributes of systems. 
    - attributes related to measures.
- Not all arguments available for both CMN and LilyPond.

----

## The header

- Title and composer.
- Set within `make-slippery-chicken` using `:title`, `:composer`.
    - `:composer` not available for CMN.
- LilyPond files generated with title as base name.
- Only English characters. 
    - Accents, umlauts etc. not supported.

----

### Example code using header values

    (let* ((mini
            (make-slippery-chicken
             '+mini+
             :title "A Slippery Chicken Piece"
             :composer "Joe Green"   
             :ensemble '(((vn (violin :midi-channel 1))))
             :set-palette '((1 ((f4 g4 a4))))
             :set-map '((1 (1 1 1 1 1 1)))
             :rthm-seq-palette '((1 ((((4 4) - e e e e - - e e e e -))
                                     :pitch-seq-palette ((1 2 3 2 1 2 3 2)))))
             :rthm-seq-map '((1 ((vn (1 1 1 1 1 1))))))))
       (cmn-display mini)
       (write-lp-data-for-all mini))

----

### LilyPond output of above code

\includegraphics[scale=0.6]{../doc/manual/resources/scores-header.png}

----

## Systems

### Score order

- Order of players in ensemble slot determines order of players in score.

        :ensemble '(((vn-solo (violin :midi-channel 1))
                     (fl (flute :midi-channel 2))
                     (ob (oboe :midi-channel 3))
                     (hn (french-horn :midi-channel 4))
                     (tp (b-flat-trumpet :midi-channel 5))
                     (vn (violin :midi-channel 6))
                     (va (viola :midi-channel 7))
                     (vc (cello :midi-channel 8))))

----

#### LilyPond output of above score order

\includegraphics[scale=0.55]{./resources/score-order.png}

----

### Player groups

- Default: All one group.
- Use `:staff-groupings` to specify groups.
- List of integers.
    - Number of consecutive players from the ensemble in each bracket.
- Single-staff groups: LilyPond adds bracket, CMN doesn't.

<!-- end list -->

    :ensemble '(((fl (flute :midi-channel 1))
                 (ob (oboe :midi-channel 2))
                 (hn (french-horn :midi-channel 3))
                 (tp (b-flat-trumpet :midi-channel 4))
                 (vn (violin :midi-channel 5))
                 (va (viola :midi-channel 6))
                 (vc (cello :midi-channel 7))))
    :staff-groupings '(2 2 3)

----

#### LilyPond output of above staff groupings

\includegraphics[scale=0.6]{../doc/manual/resources/scores-groups.png}

----

### Bars per system

- CMN only.
- Set the number of bars in each system.
- `:bars-per-system-map`.
- List of two-item lists
    - Starting bar number paired with number of measures.

    `:bars-per-system-map '((1 1) (2 2) (3 3) (7 4) (11 5))`

----

#### CMN output from above values

\includegraphics[scale=0.55]{../doc/manual/resources/scores-bars-per-sys.png}

----

\vspace*{5mm}
## Bars

### Bar line types

- Default: All bar lines single and last measure final double.
- Changed using post-generation editing method `change-bar-line-type`.
- Affects score only, i.e. not reflected in MIDI/CLM playback.
- 6 bar line types, indicated by number IDs:

\small 

--- -----------------
 0  normal
 1  double
 2  final double
 3  begin repeat
 4  begin and end repeat
 5  end repeat
--- ------------------

\normalsize

----

#### `change-bar-line-type` arguments

- slippery-chicken object (or variable it has been assigned to).
- Number of bar whose right bar line is to be changed.
- Number ID of bar line type.

\small

        (let* ((mini
                (make-slippery-chicken
                 '+bar-lines-piece+
                 :ensemble '(((fl (flute :midi-channel 1))))
                 :set-palette '((1 ((f4 g4 a4))))
                 :set-map '((1 (1 1 1)))
                 :rthm-seq-palette '((1 ((((4 4) - e e e e - - e e e e -))
                                         :pitch-seq-palette ((1 1 1 1 1 1 1 1)))))
                 :rthm-seq-map '((1 ((fl (1 1 1))))))))
           (change-bar-line-type mini 1 1)
           (change-bar-line-type mini 3 5)
           (cmn-display mini)
           (write-lp-data-for-all mini :base-path "/tmp/"))

\normalsize

----

#### LilyPond output of above example

\includegraphics[scale=0.8]{../doc/manual/resources/scores-barlines-change.png}

----

### Rehearsal letters

- Two options:
    - Within call to `make-slippery-chicken`.
    - Post-generation editing method.
- Attached to bar lines, which are only placed at the end of bar.
- Internally, adding to measure 5 actually adds to right bar line of measure 4.
    - *User still specifies 5*.
- So: No rehearsal letter on first measure of piece.
- CMN: large font, bold, no frame. 
- LilyPond: frames each letter in a thin box.

----

#### Within `make-slippery-chicken`

- `:rehearsal-letters` argument of `make-slippery-chicken`.
    - List of measure numbers.
    - sc adds consecutive letters starting with `A`.

    `:rehearsal-letters '(3 6 10)`

----

##### Lilypond output of above rehearsal letters

\includegraphics[scale=0.6]{../doc/manual/resources/scores-letters-single.png}

----

#### Adding rehearsal letters via post-generation editing

- `set-rehearsal-letter` method.
    - slippery-chicken object.
    - bar number.
    - rehearsal indicator (e.g. letter, number).

    `(set-rehearsal-letter +sc-object+ 3 1)`

\includegraphics[scale=0.6]{./resources/rehearsal-letter-post-gen.png}

----

#### Adding rehearsal letters to all players' parts.

- Default: Only added to top player of each group.
- All players: Change behavior of `cmn-display` or `write-lp-data-for-all`.
    - Set `:rehearsal-letters-all-players` argument to `T`.
- Although letters then in all parts, LilyPond still groups them in the score.
    - CMN places letters above all parts in score as well.

    `(write-lp-data-for-all +sc-object+ :rehearsal-letters-all-players t)`

----

### Clefs

#### Default

- Handled automatically based on `instrument` object slots:
    - `clefs`
    - `starting-clef`
    - `clefs-in-c`
- `write-lp-data-for-all` and `cmn-display`: both add clef-changes by default.
    - if `instrument` object has more than one clef.

----

#### Disabling the automatic clef-changes

- Prevent `write-lp-data-for-all` and `cmn-display` from adding clef changes.
    - Set `:auto-clefs` to `NIL`.
- Prevents them from running `auto-clefs` internally before output.
- Does not affect starting-clef.

        (write-lp-data-for-all +sc-object+ :auto-clefs nil)

----

#### Auto-clefs as post-generation editing method

- When `:auto-clefs` is `T`, user must manually add all clef changes.
- If basically satisfied with `auto-clefs` results but want some manual
  changes:
    - Disable feature in output methods.
    - Call as post-generation editing method. 
    - Then call `add-clef` and `delete-clefs`.
    - Prior to `cmn-display` or `write-lp-data-for-all`.

<!-- end list -->

    (auto-clefs +sc-object+)
    (add-clef +sc-object+ 'vc 2 2 'tenor)
    (add-clef +sc-object+ 'vc 3 3 'treble)
    (write-lp-data-for-all +sc-object+ :auto-clefs nil)

----

#### The add-clef and delete-clefs methods

- Manually insert or remove clef for a player at any point in piece.
- `:auto-clefs` for `cmn-display` or `write-lp-data-for-all` must be `NIL`.
    - Changes using these methods otherwise overwritten.
- `add-clefs` arguments:
    - player, bar number, event number, new clef
- `delete-clefs` arguments:
    - player, bar number, event number
    - Must already be a clef in specified event.

----

\small

#### `add-clef` example

    (let* ((mini
            (make-slippery-chicken
             '+mini+
             :ensemble '(((vc (cello :midi-channel 1))))
             :tempo-map '((1 (q 72)))
             :set-palette '((1 ((g3 a3 b3 c4 d4 e4 f4 g4))))
             :set-map '((1 (1 1 1)))
             :rthm-seq-palette '((1 ((((4 4) - e e e e - - e e e e -))
                                     :pitch-seq-palette (1 2 3 4 5 6 7 8))))
             :avoid-melodic-octaves nil
             :rthm-seq-map '((1 ((vc (1 1 1)))))))) 
       (add-clef mini 'vc 2 2 'tenor)
       (add-clef mini 'vc 3 3 'treble)
       (cmn-display mini :auto-clefs nil)
       (write-lp-data-for-all mini :auto-clefs nil))

\normalsize

----

##### LilyPond output of above code

\includegraphics[scale=1.0]{../doc/manual/resources/scores-clefs.png}

----

\small

#### `delete-clefs` example

    (let* ((mini
            (make-slippery-chicken
             '+mini+
             :ensemble '(((vc (cello :midi-channel 1))))
             :tempo-map '((1 (q 72)))
             :set-palette '((1 ((g3 a3 b3 c4 d4 e4 f4 g4))))
             :set-map '((1 (1 1 1)))
             :rthm-seq-palette '((1 ((((4 4) - e e e e - - e e e e -))
                                     :pitch-seq-palette (1 2 3 4 5 6 7 8))))
             :avoid-melodic-octaves nil
             :rthm-seq-map '((1 ((vc (1 1 1)))))))) 
       (add-clef mini 'vc 2 2 'tenor)
       (add-clef mini 'vc 3 3 'treble)
       (delete-clefs mini 'vc 2 2)
       (delete-clefs mini 'vc 3 3)
       (cmn-display mini :auto-clefs nil)
       (write-lp-data-for-all mini :auto-clefs nil))

\normalsize

----

##### LilyPond output of above code

\includegraphics[scale=1.0]{../doc/manual/resources/scores-delete-clefs.png}

----

## Non-C scores

- Default: scores produced at reading pitch (not "in C").
- Disable by setting the `:in-c` argument to `T`.

        (write-lp-data-for-all mini :in-c t)

----

### C score vs. Transposed score

#### In C:

\includegraphics[scale=0.65]{../doc/manual/resources/scores-in-c.png}

#### Transposed:

\includegraphics[scale=0.65]{../doc/manual/resources/scores-transposed.png}

----

## Parts

### CMN

- `cmn-display` keyword argument `:players`.
- Generate scores with only specified players.
- One-item list with single player ID.

        (cmn-display mini :players '(cl))

----

### LilyPond

- All LilyPond parts files generated automatically by `write-lp-data-for-all`.
- File names: player ID plus `-part.ly`
- Automatically transposed for given instruments regardless of `:in-c` 
    - (which only affects the `-score.ly` file).

----

### Exercise: SCORE LAYOUT

See http://michael-edwards.org/sc/workshop-exercises.lsp

