representation; using one of those might be easiest for keeping legacy
code operative.
-The advantages of making input and music match more closely are
-numerous: music functions previously worked differently when used inside
-or outside of chords. Now they are the same, including all the
-possibilities of argument parsing. You can now use music variables
-inside of chords: a construct like
+The following three items are consequences of this change.
+
+@item
+Music functions now work the same when used inside or outside of chords,
+including all the possibilities of argument parsing. Music variables
+can be used inside of chords: a construct like
@lilypond[verbatim,quote,ragged-right]
tonic=fis'
{ <\tonic \transpose c g \tonic> }
@end lilypond
@noindent
-would have been unthinkable previously. You can use
-@code{#@{@dots{}#@}} for constructing chord constituents. Music
-functions inside of chords are no longer specially treated and thus
-accept the same arguments as outside of chords. @code{\tweak} now works
-on single notes without needing to wrap them in a chord. In theory, it
-can also work on command events and lyrics now. Since that was not
-possible before, it depends on luck on a case-by-case basis whether the
-tweak internals are already receiving the necessary information. Users
-are asked to report those cases where they find @code{\tweak} not
-working according to reasonable expectations.
+now works as expected. One can use @code{#@{@dots{}#@}} for
+constructing chord constituents. @code{\tweak} now works on single
+notes without needing to wrap them in a chord. Using it on command
+events and lyrics is now possible, but not likely to give results yet.
+
+@item
+The repetitive chord entry aid @code{q} has been reimplemented.
+Repeated chords are now replaced right before interpreting a music
+expression. In case the user wants to retain some events of the
+original chord, he can run the repeat chord replacement function
+@code{\chordRepeats} manually.
@item
-As one consequence, it was possible to reimplement the repetitive chord
-entry aid @code{q}. Repeated chords are now replaced right before
-interpreting a music expression. In case the user wants to retain
-some events of the original chord, he can run the repeat chord
-replacement function @code{\chordRepeats} manually.
+String numbers and right hand fingerings on single notes now appear
+without having to be written inside of chord brackets.
@item
Scheme expressions inside of embedded Lilypond (@code{#@{@dots{}#@}})
music. If a Voice context is not explicitly declared one is created
automatically, as we saw at the beginning of this chapter. Some
instruments such as an Oboe can play only one note at a time. Music
-written for such instruments is monophonic and requires just a single
-voice. Instruments which can play more than one note at a time like
-the piano will often require multiple voices to encode the different
-concurrent notes and rhythms they are capable of playing.
+written for such instruments requires just a single voice. Instruments
+which can play more than one note at a time like the piano will often
+require multiple voices to encode the different concurrent notes and
+rhythms they are capable of playing.
A single voice can contain many notes in a chord, of course,
so when exactly are multiple voices needed? Look first at
@code{\\}, to place them in separate voices. Without these, the
notes would be entered into a single voice, which would usually
cause errors. This technique is particularly suited to pieces of
-music which are largely monophonic with occasional short sections
+music which are largely homophonic with occasional short sections
of polyphony.
Here's how we split the chords above into two voices and add both
}
@end lilypond
-Now let's look at three different ways to notate the same passage
-of polyphonic music, each of which is advantageous in different
+Now let's look at three different ways to notate the same passage of
+polyphonic music, each of which is advantageous in different
circumstances, using the example from the previous section.
-An expression that appears directly inside a @code{<< >>} belongs
-to the main voice (but, note, @strong{not} in a @code{<< \\ >>}
-construct). This is useful when extra voices appear while the
-main voice is playing. Here is a more correct rendition of our
-example. The red diamond-shaped notes
-demonstrate that the main melody is now in a single voice context,
+An expression that appears directly inside a @code{<< >>} belongs to the
+main voice (but, note, @strong{not} in a @code{<< \\ >>} construct).
+This is useful when extra voices appear while the main voice is playing.
+Here is a more correct rendition of our example. The red diamond-shaped
+notes demonstrate that the main melody is now in a single voice context,
permitting a phrasing slur to be drawn over them.
@lilypond[quote,ragged-right,verbatim]
\new Staff \relative c' {
\voiceOneStyle
- % The following notes are monophonic
+ % This section is homophonic
c16^( d e f
% Start simultaneous section of three voices
<<
@emph{beyond} the main note.
@lilypond[verbatim,quote,relative=2]
-c2-\bendAfter #+4
-c2-\bendAfter #-4
-c2-\bendAfter #+6.5
-c2-\bendAfter #-6.5
-c2-\bendAfter #+8
-c2-\bendAfter #-8
+c2\bendAfter #+4
+c2\bendAfter #-4
+c2\bendAfter #+6.5
+c2\bendAfter #-6.5
+c2\bendAfter #+8
+c2\bendAfter #-8
@end lilypond
-The dash @code{-} immediately preceding the @code{\bendAfter}
-command is @emph{required} when writing falls and doits.
-
-
@snippets
@lilypondfile[verbatim,quote,texidoc,doctitle]
@cindex fingering vs. string numbers
The string on which a note should be played may be indicated by
-appending @code{\@var{number}} to a note inside a chord construct
-@code{<>}.
-
-@warning{String numbers @strong{must} be defined inside a chord
-construct even if there is only a single note.}
+appending @code{\@var{number}} to a note.
@lilypond[verbatim,quote,relative=0]
\clef "treble_8"
-<c\5>4 <e\4> <g\3>2
+c4\5 e\4 g2\3
<c,\5 e\4 g\3>1
@end lilypond
When fingerings and string indications are used together, their
-placement is controlled by the order in which the two items appear
-in the code:
+placement can be controlled by the order in which the two items appear
+in the code @emph{only} if they appear inside of an explicit chord:
+applied to whole chords or single notes @emph{outside} of chords,
+fingerings are placed using a different mechanism.
@lilypond[verbatim,quote,relative=1]
\clef "treble_8"
-<g\3-0>2
+g4\3-0
+g-0\3
+<g\3-0>
<g-0\3>
@end lilypond
By default pitches are assigned to the lowest playing position on the
fret-board (first position). Open strings are automatically preferred.
-If you would like a certain pitch to be played on a specific string
-you can add a string number indication to the pitch name. If you
-define pitch names and string numbers without a chord construct
-(@code{<>}) the string number indications do not appear in traditional
-notation. It is much more comfortable to define the playing position
-by using the value of @code{minimumFret}. The default value for
-minimumFret is 0.
+If you would like a certain pitch to be played on a specific string you
+can add a string number indication to the pitch name. If you don't want
+to have string number indications appear in traditional notation, you
+can override the respective stencil. Usually it will be more
+comfortable to define the playing position by using the value of
+@code{minimumFret}. The default value for minimumFret is 0.
@lilypond[quote,ragged-right,verbatim]
+\layout { \override Voice.StringNumber #'stencil = ##f }
\new StaffGroup <<
\new Staff \relative c {
\clef "treble_8"
@lilypond[quote,verbatim]
guitar = \relative c' {
- r8 <gis-6 cis-6 b-0>~ q4 q8~ q q4
+ r8 <gis-2 cis-3 b-0>~ q4 q8~ q q4
}
\new StaffGroup <<
pitches:
@lilypond[verbatim,quote]
+\layout { \override Voice.StringNumber #'stencil = ##f }
firstHarmonic = {
d'4\4\harmonic
g'4\3\harmonic
@lilypond[quote,ragged-right,verbatim]
<<
- \new Staff {
+ \new Voice \with {
+ \override StringNumber #'stencil = ##f
+ } {
\clef "bass_8"
\relative c, {
c4 d e f
}
}
- \new TabStaff {
- \set TabStaff.stringTunings = #bass-tuning
+ \new TabStaff \with {
+ stringTunings = #bass-tuning
+ } {
\relative c, {
c4 d e f
}
@funindex rightHandFinger
@funindex \rightHandFinger
-Right-hand fingerings @var{p-i-m-a} must be entered within a
-chord construct @code{<>} for them to be printed in the score,
-even when applied to a single note.
+Right-hand fingerings @var{p-i-m-a} must be entered using
+@code{\rightHandFinger} followed by a number.
-@warning{There @strong{must} be a hyphen before
-@code{@bs{}rightHandFinger} and a space before the closing @code{>}.}
+@warning{If the number is entered in Scheme notation, remember to append
+a space before following it with a closing @code{>} or similar.}
@lilypond[quote,verbatim,relative=0]
\clef "treble_8"
-<c-\rightHandFinger #1 >4
-<e-\rightHandFinger #2 >
-<g-\rightHandFinger #3 >
-<c-\rightHandFinger #4 >
-<c,-\rightHandFinger #1 e-\rightHandFinger #2
- g-\rightHandFinger #3 c-\rightHandFinger #4 >1
+c4\rightHandFinger #1
+e\rightHandFinger #2
+g\rightHandFinger #3
+c\rightHandFinger #4
+<c,\rightHandFinger #1 e\rightHandFinger #2
+ g\rightHandFinger #3 c\rightHandFinger #4 >1
@end lilypond
For convenience, you can abbreviate @code{\rightHandFinger} to something
short, for example @code{RH},
@example
-#(define RH rightHandFinger)
+RH=#rightHandFinger
@end example
@c used for news about the upcoming release; see CG 10.2
+@newsItem
+@subsubheading LilyPond takes part in Google Summer of Code 2012! @emph{April 25, 2012}
+
+Being a part of @uref{http://www.gnu.org/, GNU project}, we are participating in
+@uref{http://www.google-melange.com/gsoc/homepage/google/gsoc2012,
+Google Summer of Code program}, which offers students stipends for
+working on open source software.
+
+Our contributor Janek WarchoĊ was accepted for 2012 edition of GSoC.
+He will be working on advanced lyrics positioning in LilyPond.
+
+@newsEnd
+
+
@newsItem
@subsubheading Release candidate 5 of 2.16 - LilyPond 2.15.37 released! @emph{April 19, 2012}
#endif
}
+bool
+Dispatcher::is_listened (Stream_event *ev)
+{
+ SCM class_symbol = ev->get_property ("class");
+ if (!scm_is_symbol (class_symbol))
+ {
+ warning (_ ("Event class should be a symbol"));
+ return false;
+ }
+
+ for (SCM cl = scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), class_symbol);
+ scm_is_pair (cl); cl = scm_cdr (cl))
+ {
+ SCM list = scm_hashq_ref (listeners_, scm_car (cl), SCM_EOL);
+ if (scm_is_pair (list))
+ return true;
+ }
+ return false;
+}
+
+
void
Dispatcher::broadcast (Stream_event *ev)
{
void stop_translation_timestep ();
void process_music ();
DECLARE_TRANSLATOR_LISTENER (fingering);
- DECLARE_TRANSLATOR_LISTENER (stroke_finger);
DECLARE_ACKNOWLEDGER (rhythmic_head);
DECLARE_ACKNOWLEDGER (stem);
events_.push_back (ev);
}
-IMPLEMENT_TRANSLATOR_LISTENER (Fingering_engraver, stroke_finger);
-void
-Fingering_engraver::listen_stroke_finger (Stream_event * /* ev */)
-{
- /*
- FIXME: should do something.
-
- This function is mainly here to shut up a warning
- */
-}
-
void
Fingering_engraver::acknowledge_stem (Grob_info inf)
{
public:
Dispatcher ();
void broadcast (Stream_event *ev);
+ bool is_listened (Stream_event *ev);
void add_listener (Listener, SCM event_class);
void remove_listener (Listener, SCM event_class);
void register_as_listener (Dispatcher *dist);
SCM unlistened = SCM_EOL;
for (; scm_is_pair (arts); arts = scm_cdr (arts))
{
- if (scm_is_true
- (scm_call_2
- (ly_lily_module_constant ("any"),
- ly_lily_module_constant ("ly:is-listened-event-class"),
- scm_call_1
- (ly_lily_module_constant ("ly:make-event-class"),
- unsmob_stream_event (scm_car (arts))
- ->get_property ("class")))))
- listened = scm_cons (scm_car (arts), listened);
+ SCM art = scm_car (arts);
+
+ if (c->event_source ()->is_listened (unsmob_stream_event (art)))
+ listened = scm_cons (art, listened);
else
- unlistened = scm_cons (scm_car (arts), unlistened);
+ unlistened = scm_cons (art, unlistened);
}
ev->set_property ("articulations", scm_reverse_x (unlistened, SCM_EOL));
c->event_source ()->broadcast (ev);
cbn n))))))
bendAfter =
-#(define-music-function (parser location delta) (real?)
+#(define-event-function (parser location delta) (real?)
(_i "Create a fall or doit of pitch interval @var{delta}.")
(make-music 'BendAfterEvent
'delta-step delta))
(revert-time-signature-setting time-signature))
rightHandFinger =
-#(define-music-function (parser location finger) (number-or-string?)
+#(define-event-function (parser location finger) (number-or-string?)
(_i "Apply @var{finger} as a fingering indication.")
(make-music
(define unlistened-music-event-classes
'(harmonic-event line-break-event page-break-event page-turn-event label-event
solo-one-event solo-two-event skip-event unisono-event
- part-combine-force-event break-dynamic-span-event))
+ part-combine-force-event break-dynamic-span-event
+ stroke-finger-event))
;; produce neater representation of music event tree.
;; TODO: switch to this representation for the event-classes list?