lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extending event-listener.ly


From: Phil Hézaine
Subject: Re: extending event-listener.ly
Date: Tue, 26 Mar 2013 20:12:42 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

Le 26/03/2013 02:29, Graham Percival a écrit :
On Mon, Mar 25, 2013 at 10:05:28PM +0100, Phil Hézaine wrote:
Le 25/03/2013 17:29, Graham Percival a écrit :
To add \parenthesize, you need to create a similar function or
extend that original one to deal with those events.  To see the
events, try:

\displayMusic { c'4 \parenthesize d' e }

Today, after the same discovery I was wondering the same question
than Luis but for drum-types (in \drummode, ie: sna, wbl... )
N.R. says: "Not all lilypond music events are supported by
‘event-listener.ly’."
Is it possible to 'listen' the drums symbols?

I think the above hint should suffice.

- Graham

You're right. Though it was not evident at starting it was not so difficult to solve the problem. Thanks for your clarification.
I paste for Luis and others my solution.

for NoteEvent:

#(define (format-note engraver event)
   (let* ((origin (ly:input-file-line-char-column
                   (ly:event-property event 'origin))))
     (print-line engraver
                 "note"
                 ;; get a MIDI pitch value.
                 ;(+ 60 (ly:pitch-semitones
                        (ly:event-property event 'drum-type) ;))
                 (ly:duration->string
                  (ly:event-property event 'duration))
                 (format-moment (ly:duration-length
                                 (ly:event-property event 'duration)))
                 ;; point and click info
                 ;(ly:format "point-and-click ~a ~a"
                 ;           (caddr origin)
                 ;           (cadr origin))
                            )))

For EventChord:

#(define (format-note engraver event-chord)
   (let* ((origin (ly:input-file-line-char-column
                   (ly:event-property event-chord 'origin))))
     (print-line engraver
                 "note"
                 ;; get a MIDI pitch value.
                 ;(+ 60 (ly:pitch-semitones
                        (ly:event-property event-chord 'drum-type) ;))
                 (ly:duration->string
                  (ly:event-property event-chord 'duration))
                 (format-moment (ly:duration-length
(ly:event-property event-chord 'duration)))
                 ;; point and click info
                 ;(ly:format "point-and-click ~a ~a"
                 ;           (caddr origin)
                 ;           (cadr origin))
                            )))

then far below in the file:

#(define (format-dynamic engraver event-chord)
   (print-line engraver
               "dynamic"
               (ly:event-property event-chord 'text)
               ))

and finally at the bottom:
               (dynamic-event-chord . format-dynamic)


All is working, however I have an issue with the *non-orthodox* syntax I used for "Le Puzzle du Batteur - The Drummer's 'G'igsaw".
example:     <bd_\ff toml_\p>2
With 2.12 and 2.14 all was right. The dynamics inside a chord was recognized. At present time lilypond doesn't make a difference beetween the first and the second dynamics.
I checked out the midi with midicomp.
I have tried a ugly workaround which gives a uglier layout:
       <<bd2_\ff toml_\p>>
Lilypond says:
Avertissement : Deux événements absolute-dynamic simultanés, rejet de celui-ci
<<bd2_\ff toml
              _\p>> sna2_\p |
Avertissement : Événement absolute-dynamic précédent ici
<<bd2
     _\ff toml_\p>> sna2_\p |

But with the event-listener I get:
0.00000000      note    bassdrum        2       0.50000000
0.00000000      dynamic ff
0.00000000      note    lowtom  2       0.50000000
0.00000000      dynamic p

Very interesting for me because the 'G'igsaw is sadly dead.
Is there a proper solution with these *non-orthodox* syntaxs apart from the event-listener?

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]