lilypond-devel
[Top][All Lists]
Advanced

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

Re: Problems with 'q' in tablature


From: Nicolas Sceaux
Subject: Re: Problems with 'q' in tablature
Date: Sat, 27 Feb 2010 12:47:25 +0100

Le 27 févr. 2010 à 11:07, Marc Hohl a écrit :
> 
> the 'q' functionality has changed after 2.13.11 was released. Nicolas Sceaux 
> pushed a patch
> to remove multiple fingerings etc., but the string information should be 
> copied, IMHO.

Precisely for the reason fingerings shall not be repeated (in a staff),
string information shall not be repeated too (in a staff).  But in a
TabStaff this is different indeed.

I don't know how to deal with this issue in a generic way.  To solve
your problem, you can use a custom chord repetition function, like the
following one:

\version "2.13.13"

#(define-public (tab-repeat-chord previous-chord location duration 
articulations)
   "Copy the previous chord, filter out events which are not notes, set
the chord duration, add articulations.
Events attached to notes in the previous chord are also filtered out, except
StringNumberEvents.
"
   (define (filter-events event-type events)
     (filter (lambda (event)
               (and (eqv? (ly:music-property event 'name) event-type) event))
             events))
   ;; If previous-chord has an length property, then it means that it
   ;; has been processed by a music iterator.  In other words, the chord
   ;; has been memorized in an other music block, which is certainly not
   ;; what the user has intended.  In that case, raise a warning.
   (if (not (and (ly:music? previous-chord)
                 (null? (ly:music-property previous-chord 'length))))
       (ly:input-message location
                         (_ "No memorized chord in music block before chord 
repetition")))
   ;; Instead of copying the previous chord, then removing the
   ;; undesired elements (like articulations), a new empty chord is
   ;; built.  Then, the pitch found in the previous chord are added to
   ;; the new chord, without any "decoration" (e.g. cautionary
   ;; accidentals, fingerings, text scripts, articulations), except
   ;; StringNumberEvents.
   (make-music
    'EventChord
    'origin location
    'elements (append! (map (lambda (note)
                              (let ((articulations
                                     (filter-events 'StringNumberEvent
                                                    (ly:music-property note 
'articulations)))
                                    (new-note (make-music 'NoteEvent
                                                          'pitch 
(ly:music-property note 'pitch)
                                                          'duration duration)))
                                (if (not (null? articulations))
                                    (set! (ly:music-property new-note 
'articulations)
                                          articulations))
                                new-note))
                            (filter-events 'NoteEvent (ly:music-property 
previous-chord 'elements)))
                       articulations)))

#(ly:parser-set-repetition-function parser tab-repeat-chord)

Guitar = \relative c' {
  % Intro
  r8 <gis\4 cis\3 b\2> ~ q4 q8 ~ q q4
}

\score {
  \new StaffGroup <<
    \new Staff {
      \new Voice {
        \clef "treble_8"
        \override Voice.StringNumber #'transparent = ##t
        \Guitar
      }
    }
    \new TabStaff { \new TabVoice { \Guitar } }
  >>
}





reply via email to

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