lilypond-user
[Top][All Lists]
Advanced

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

Entering (lute) tablature


From: David Kastrup
Subject: Entering (lute) tablature
Date: Sat, 18 Mar 2017 23:36:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Well, lute tablature has the obvious advantage(?) to be using letters
instead of fret numbers.

I went totally annoyed over entering the first few measures of the
following tablature appended as PDF

Attachment: weep.pdf
Description: Adobe PDF document

so I finally decided that this wasn't working for me.

So here is a sketch of entering this score by tab:

\version "2.19.50"

lute-tuning = \stringTuning <d, g, c f a d' g'>

tabtranslate =
#(define-music-function (pitches tuning music) (ly:music? pair? ly:music?)
   (define my-pitch (make-semitone->pitch (event-chord-pitches pitches)))
   (define string-number? (music-type-predicate 'string-number-event))
   (define semivec (list->vector (map ly:pitch-semitones tuning)))
   (map-some-music
    (lambda (m)
      (and (music-is-of-type? m 'note-event)
           (let* ((strs (ly:music-property m 'articulations))
                  (no
                   (case (length strs)
                     ((0) (ly:music-warning m "Needs string number") 1)
                     ((1) (ly:music-property (car strs) 'string-number))
                     (else (ly:music-warning m "Multiple string numbers")
                           (ly:music-property (car strs) 'string-number))))
                  (pit (ly:music-property m 'pitch))
                  (ab? (> (ly:pitch-notename pit) 4))
                  (num (+ (ly:pitch-steps pit) (if ab? 2 9)))
                  (no (if (and (integer? no)
                               (<= 1 no (vector-length semivec)))
                          (1- no)
                          (begin
                            (ly:music-warning (car strs)
                                              "Invalid string number")
                           0))))
             (set! (ly:music-property m 'pitch)
                   (my-pitch (+ (vector-ref semivec no) num)))
             m)))
    (tabChordRepeats music)))
%%

content =
\tabtranslate <c cis d dis e f fis g gis a bes b> \lute-tuning
{
  \set Staff.midiInstrument = "acoustic guitar (nylon)"
  \time 4/8
  <e\4 d\3 c\2>4
  q8 d\2 |
  <c\4 c\3 d\2>16
  c\2 c8\2
  <a\4 a\3 c\2>16
  a32\2 d\3 a8\2 |
  <e\5 e\4 c\3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d\2>8 c16\2 c\1 e\5 a\1 <e\6 a\2> <a\5 c\4 d\3 c\2>16. d32\2
  <a\6 c\3 a\2 a\1>16 <c\6 d\2>32 c\2 d16\3 |
  e\4 c\6 <a\6 c\3>8 <d\7 e\4 d\3>16. d32\3 <c\3 a\2>16 a\3 |
  <c\7 e\6 e\5 d\4 c\3 c\2>8. c16\2 q4 |
}

content = #(map-some-music
            (lambda (m)
             (and (music-is-of-type? m 'bar-check)
              #{ \bar "|" #}))
            content)

\score {
  \new Score \with { defaultBarType = "" }
  \new StaffGroup
  <<
    \new Staff \with { \clef "treble_8"
                       \omit StringNumber
                     } \content
    \new TabStaff \with { stringTunings = \lute-tuning } \content
  >>
  \layout {}
}

\score {
  \new Score \with { defaultBarType = "" }
  \new TabStaff \with { stringTunings = \lute-tuning } \content
  \midi {}
}
Pretty sure I entered stuff wrong here (there is some programming error,
too) and probably did not decipher all of the tab correctly.  Anybody
wanting to proofread?

At any rate, at least for lettered tabs this is a somewhat cure entry
method (of course, the "letters" start over since the order is
a b c d e f g a' b' c' d' ...).

Should something like this, though likely more robust against bad
entries, be part of LilyPond's standard tool chest?

-- 
David Kastrup

reply via email to

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