Post-generation data editing
+ Associated example files
NB: An exercise relating to the material covered in this tutorial can be found on the Exercises page.
While it is the goal of slippery chicken, Common Music
Notation (CMN), and LilyPond to generate finished pieces and scores
without the need for further tweaking, some editing of the
post-generation output may be occasionally desired. In addition to the
option of using third-party software to tweak the output (either by
editing the .eps
or .pdf
files directly using
SVG editing software or by importing the generated MIDI files into
notation software, as described on
the output page), editing the generated
data from within the Lisp environment is also possible.
The make-slippery-chicken
function generates
a slippery-chicken
object when it is run (evaluated) in
Lisp. This object contains all of the data generated by slippery
chicken for the given piece and is assigned to the variable given
as the first argument to the make-slippery-chicken
function. Since this is a global variable, the data remains accessible
to the user after it has been generated and can be modified within
the slippery-chicken
object.
+ Events vs. notes
The primary two kinds of data within a
given slippery-chicken
object that the user will want to
modify are its event
objects and its notes.
An event
in slippery chicken consists of an
individual rhythm
object, either a note or a rest, and
all of the data associated with that object, such as its duration,
its pitch if it is not a rest (or pitches if it is a chord), and any
marks or clefs attached to it, etc.
A note is a non-rest event
. Some of the
post-generation editing methods will have arguments
for event
numbers within a specific bar or sequence, and
others will require the note number.
An example of getting the first event of a bar:
(let* ((mini (make-slippery-chicken '+mini+ :ensemble '(((vn (violin :midi-channel 1)))) :set-palette '((1 ((c4 d4 e4 f4 g4 a4 b4 c5)))) :set-map '((1 (1))) :rthm-seq-palette '((1 ((((2 4) (s) (s) e e e)) :pitch-seq-palette ((1 2 3))))) :rthm-seq-map '((1 ((vn (1)))))))) (data (get-event mini 1 1 'vn))) => S
An example of getting the first note from the same bar:
(let* ((mini (make-slippery-chicken '+mini+ :ensemble '(((vn (violin :midi-channel 1)))) :set-palette '((1 ((c4 d4 e4 f4 g4 a4 b4 c5)))) :set-map '((1 (1))) :rthm-seq-palette '((1 ((((2 4) (s) (s) e e e)) :pitch-seq-palette ((1 2 3))))) :rthm-seq-map '((1 ((vn (1)))))))) (data (get-note mini 1 1 'vn))) => E
+ Basic usage
A number of methods exist for editing data within
a slippery-chicken
object. These will all take
a slippery-chicken
object as their first argument, which
can also be passed as a local variable or as the global variable
created for the given slippery-chicken
object. The other
arguments required for these methods can be found in the source code
documentation for
the slippery
chicken post-generation editing methods, but will generally
consist of at least the bar-number and event- or note-number of the
data to be changed, and the new value to be set.
For example, adding a ppp
mark to the 4th note
(non-rest) of the 2nd bar of the va
part of
the slippery-chicken
object assigned to the
variable mini
after it has been generated
(outside of the scope of
the make-slippery-chicken
function) can be done in the
following manner:
(let* ((mini (make-slippery-chicken '+mini+ :ensemble '(((vn (violin :midi-channel 1)) (va (viola :midi-channel 2)) (vc (cello :midi-channel 3)))) :set-palette '((1 ((c3 d3 e3 f3 g3 a3 b3 c4 d4 e4 f4 g4 a4 b4 c5)))) :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))))) :rthm-seq-map '((1 ((vn (1 1 1)) (va (1 1 1)) (vc (1 1 1)))))))) (add-mark-to-note mini 2 4 'va 'ppp) (cmn-display mini))
+ A few methods for post-generation data editing
The full list of methods available for post-generation editing of the
data in a slippery-chicken
object can be found in the
source code documentation for the
the slippery-chicken-edit
file. A few of these methods will also be mentioned here in brief:
change-pitch
: Change the pitch of an event. Arguments:+sc-object+
,bar-num
,note-num
,player
,new-pitch
.(change-pitch +sc-object+ 3 2 'va 'c4)
add-mark-to-note
: Add an articulation, dynamic, performance technique or other mark to a note. Arguments:sc-object
,bar-num
,note-num
,player
,mark
.(add-mark-to-note +sc-object+ 3 2 'va 'ppp)
rm-marks-from-note
: Remove one or more specified marks from a note. Arguments:sc-object
,bar-num
,note-num
,player
,mark
.(rm-marks-from-note +sc-object+ 3 2 'va 'ppp)
trill
: (LilyPond only.) Place a trill indication (with trill note) in the score starting on the specified note and spanning to the next. Arguments:sc-object
,player
,start-bar
,start-event
,trill-note
.(trill +sc-object+ 'va 3 2 'd4)
tie-over-rests
: Extend the duration of a specified note over all directly subsequent rests. Arguments:sc-object
,bar-num
,note-num
,player
;&key
arguments:end-bar
,:auto-beam
,:consolidate-notes
.(tie-over-rests +sc-object+ 1 1 'va :auto-beam 'q :consolidate-notes t)
re-bar
: Reorganize the data of a givenslippery-chicken
object into new bars. This method will only combine short bars into longer ones; it won't split up longer bars and recombine them. Best when used with the:min-time-sig
argument.(re-bar +sc-object+ :min-time-sig '(4 4))
move-events
: Copy all events from one player to another and delete that data from the first player. This method can copy segments of bars from the source but can only paste full bars into the target player; i.e., any existing events in the target player's part at the beginning of the start-bar or end of the end-bar will be deleted and replaced with rests, making this method best for copying into completely empty bars. Arguments:sc-object
,from-player
,to-player
,start-bar
,start-event
,end-bar
,end-event
.(move-events +sc-object+ 'vn 'vc 1 1 3 1)
double-events
: Copy all events from one player to one or more other players, without deleting the source data from the original player's part. This method can copy segments of bars from the source but can only paste full bars into the target player; i.e., any existing events in the target player's part at the beginning of the start-bar or end of the end-bar will be deleted and replaced with rests, making this method best for copying into completely empty bars. Arguments:sc-object
,master-player
,doubling-players
,start-bar
,start-event
,end-bar
,end-event
.(double-events +sc-object+ 'vn '(va vc) 1 1 3 1)
+ All post-generation editing methods
add-arrow-to-events
add-auxiliary-notes
add-clef
add-ensemble-players
add-event-to-bar
add-half-beat-rest
add-mark-all-players
add-mark-before-note
add-mark-to-event
add-mark-to-note
add-mark-to-notes-from-to
add-marks-sh
add-marks-to-note
add-marks-to-notes
add-pitches-to-chord
add-player
add-tuplet-bracket-to-bar
add-tuplet-brackets-to-beats
auto-accidentals
auto-beam
auto-clefs
auto-slur
change-bar-line-type
change-pitch
change-pitches
change-time-sig
consolidate-all-notes
consolidate-all-rests
copy-bars
copy-to-combo
delete-all-rehearsal-letters
delete-bars
delete-clefs
delete-events
delete-rehearsal-letter
delete-slur
delete-tempi
double-events
double-player-inverted
enharmonic-spellings
enharmonics
fast-microtone-to-chromatic
force-artificial-harmonics
force-harmonics
force-in-range
force-natural-harmonics
force-rest-bars
free-to-double
get-combo
get-nearest-note
get-nearest-note-after
get-nearest-note-before
make-hammer-friendly
map-over-bars
map-over-events
map-over-notes
map-over-sequenzes
move-clef
move-dynamics-from-rests
move-events
move-rehearsal-letter
note-add-bracket-offset
octavise-repeated-notes
orchestrate
pause-last
process-events-by-time
re-bar
rehearsal-letters-at-sections
remove-extraneous-dynamics
replace-events
replace-multi-bar-events
replace-tempo-map
reset-midi-channels
respell-bars
respell-notes
respell-notes-for-player
rest-to-note
rm-marks-from-note
rm-marks-from-notes
rm-pitches-from-chord
rm-repeated-pitches
rm-slurs
round-to-nearest
sc-delete-beams
sc-delete-marks
sc-delete-marks-before
sc-delete-marks-from-event
sc-force-rest
sc-force-rest2
sc-move-dynamic
sc-remove-dynamic
sc-remove-dynamics
set-cautionary-accidental
set-limits-by-section
set-midi-channels
set-rehearsal-letter
set-score-order
staff-groupings-inc
swap-marks
thin
tie
tie-all-last-notes-over-rests
tie-over-all-rests
tie-over-rest-bars
tie-over-rests
tie-repeated-notes
trill
unset-cautionary-accidental