shelt...@berkeley.edu wrote:
> I would like to develop some harmonica tablature using
> Lilypond. What I need is to put a one or two digit number
> above (possibly below instead) each note in the standard
> notation. I would like to have this happen automatically -
> ie whenever I enter a note in the usual manner the one or
> two digit number would appear as a tablature. Any
> suggestions on how I might accomplish this?

How are the numbers determined according to the notes?
Since you didn't mention that, I just used the
"ly:pitch-notename" value for each note.  I'm sure this
isn't what you want, but this should at least give you an
idea of a reasonable approach.

Hope this helps.
- Mark


      
\version "2.13.19"

#(define (NoteEvent? music)
   (equal? (ly:music-property music 'name) 'NoteEvent))

#(define (EventChord? music)
   (equal? (ly:music-property music 'name) 'EventChord))

#(define (get-notename NoteEvent)
   (ly:pitch-notename (ly:music-property NoteEvent 'pitch)))

#(define (make-textscript dir txt)
   (make-music 'TextScriptEvent
               'direction dir
               'text txt))

#(define (make-tab-number NoteEvent)
   (make-textscript
     UP
     (number->string (get-notename NoteEvent))))

#(define (make-tab-numbers EventChord)
   (let ((elts (ly:music-property EventChord 'elements)))
     (map make-tab-number (filter NoteEvent? elts))))

#(define (add-tab-numbers music)
   (if (EventChord? music)
       (set! (ly:music-property music 'elements)
             (append (ly:music-property music 'elements)
                     (make-tab-numbers music))))
    music)

harmonicaTab =
#(define-music-function
  (parser location music)
  (ly:music?)
  (music-map add-tab-numbers music))

\relative c' \harmonicaTab {
  c d <c e> <d f>
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to