]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4768 Support additional bass strings in TabStaff
authorThomas Morley <thomasmorley65@gmail.com>
Tue, 9 Feb 2016 09:21:00 +0000 (10:21 +0100)
committerThomas Morley <thomasmorley65@gmail.com>
Mon, 15 Feb 2016 23:33:47 +0000 (00:33 +0100)
- new context-property: additionalBassStrings
- new regtest
- new entries in NR, Changes

Pitches on those additional bass strings will be printed as:
a, /a, //a, ///a, 4, 5 ...
as common for baroque lute, depending on settings for fretLabel and
additionalBassStrings.

Documentation/changes.tely
Documentation/notation/fretted-strings.itely
input/regression/tablature-additional-bass-strings.ly [new file with mode: 0644]
scm/define-context-properties.scm
scm/translation-functions.scm

index ce41e0aefa5319043a52bf5b3b944d78890fc799..93e1976ef956e1f61c9fe88753b21ac16df33c41 100644 (file)
@@ -61,6 +61,28 @@ which scares away people.
 
 @end ignore
 
+@item
+Additional bass strings (for lute tablature) are supported.
+@lilypond[quote,verbatim]
+m = { f'4 d' a f d a, g, fis, e, d, c,  \bar "|." }
+
+\score {
+  \new TabStaff \m
+  \layout {
+    \context {
+      \Score
+      tablatureFormat = #fret-letter-tablature-format
+    }
+    \context {
+      \TabStaff
+      stringTunings = \stringTuning <a, d f a d' f'>
+      additionalBassStrings = \stringTuning <c, d, e, fis, g,>
+      fretLabels = #'("a" "b" "r" "d" "e" "f" "g" "h" "i" "k")
+    }
+  }
+}
+@end lilypond
+
 @item
 The markup-list-command @code{\table} is now available.
 Each column may be aligned differently.
index eb111e3ce81d17ed10d1cef8ebf0b5fddb558b45..c7c18bacb686c6f7a475860919ded4caa0940d68 100644 (file)
@@ -27,6 +27,7 @@ to fretted string instruments.
 * Common notation for fretted strings::
 * Guitar::
 * Banjo::
+* Lute::
 @end menu
 
 @node Common notation for fretted strings
@@ -2010,3 +2011,56 @@ Installed Files:
 
 Snippets:
 @rlsr{Fretted strings}.
+
+
+@node Lute
+@subsection Lute
+
+@menu
+* Lute tablatures::
+@end menu
+
+@node Lute tablatures
+@unnumberedsubsubsec Lute tablatures
+
+@cindex lute tablatures
+@cindex tablature, lute
+
+LilyPond supports tablature for lute.
+
+To get additional bass strings use @code{additionalBassStrings}, where the
+pitches of those strings are set. They will be printed below lowest line as:
+a, /a, //a, ///a, 4, 5 etc.
+
+@code{fret-letter-tablature-format} for @code{tablatureFormat} should be used,
+probably @code{fretLabels} for further customizing.
+
+@lilypond[quote,ragged-right,verbatim]
+m = { f'4 d' a f d a, g, fis, e, d, c,  \bar "|." }
+
+\score {
+  <<
+    \new Staff { \clef bass \cadenzaOn  \m }
+    \new TabStaff \m
+  >>
+  \layout {
+    \context {
+      \Score
+      tablatureFormat = #fret-letter-tablature-format
+    }
+    \context {
+      \TabStaff
+      stringTunings = \stringTuning <a, d f a d' f'>
+      additionalBassStrings = \stringTuning <c, d, e, fis, g,>
+      fretLabels = #'("a" "b" "r" "d" "e" "f" "g" "h" "i" "k")
+    }
+  }
+}
+@end lilypond
+
+@cindex lute tunings
+@cindex tunings, lute
+
+@knownissues
+Using @code{FretBoards} with @code{additionalBassStrings} is not supported and
+will yield unsatisfying results.
diff --git a/input/regression/tablature-additional-bass-strings.ly b/input/regression/tablature-additional-bass-strings.ly
new file mode 100644 (file)
index 0000000..a094f9a
--- /dev/null
@@ -0,0 +1,38 @@
+\version "2.19.37"
+
+\header
+{
+  texidoc = "Additional bass strings (for baroque lute, etc.) are supported in
+  TabStaff.  They are printed below lowest line as: a, /a, //a, ///a, 4, 5 etc.
+  @code{additionalBassStrings} needs to be set accordingly."
+}
+
+m = { e' b g d a, e, d, c, b,,\9 a,, g,, }
+mus = { \m \bar "||" \transpose c cis \m \bar "|." }
+
+\score {
+  <<
+    \new Staff { \clef bass \cadenzaOn  \mus }
+    %% FretBoards with `additionalBassStrings' return weird output
+    %% A warning is thrown if uncommented
+    %\new FretBoards \mus
+    \new TabStaff { \mus }
+  >>
+  \layout {
+    \context {
+      \Score
+      tablatureFormat = #fret-letter-tablature-format
+    }
+    \context {
+      \FretBoards
+      stringTunings = \stringTuning <e, a, d g b e'>
+      additionalBassStrings = \stringTuning <g,, a,, b,, c, d,>
+    }
+    \context {
+      \TabStaff
+      stringTunings = \stringTuning <e, a, d g b e'>
+      additionalBassStrings = \stringTuning <g,, a,, b,, c, d,>
+      fretLabels = #'("a" "b" "r" "d" "e" "f" "g" "h" "i" "k")
+    }
+  }
+}
index 3c9e159eb57e9b406b3283a11b17444104c09c42..3ee68e5e6a5ebceba368c151b01e13effddc64aa 100644 (file)
@@ -48,6 +48,9 @@
 on the same note in different octaves may be horizontally staggered
 if in different voices.")
      (aDueText ,markup? "Text to print at a unisono passage.")
+     (additionalBassStrings ,list? "The additional tablature bass-strings, which
+will not get a seprate line in TabStaff.  It is a list of the pitches of each
+string (starting with the lowest numbered one).")
      (additionalPitchPrefix ,string? "Text with which to prefix
 additional pitches within a chord name.")
      (alignAboveContext ,string? "Where to insert newly created context in
index f9f532b0d0bcbc9265ee359e13a130c2ce1b037c..22f8648c31e8c0dcaacdad9a4894c6ef057bd0fc 100644 (file)
@@ -515,10 +515,18 @@ chords.  Returns a placement-list."
                  (cons tuning (map (lambda (x) (shift-octave x -1))
                                    pitches))))))))
 
+  ;; TODO: Does it make sense to have additional bass strings in a fret-diagram?
+  (if (and (not (null? rest))
+           (not (null? (ly:context-property context 'additionalBassStrings))))
+      (ly:warning "additional bass strings are not supported by FretBoards"))
+
   ;; body of determine-frets
   (let* ((predefined-fret-table
           (ly:context-property context 'predefinedDiagramTable))
-         (tunings (ly:context-property context 'stringTunings))
+         (tunings
+           (append
+             (ly:context-property context 'stringTunings)
+             (ly:context-property context 'additionalBassStrings '())))
          (string-count (length tunings))
          (grob (if (null? rest) '() (car rest)))
          (pitches (map (lambda (x) (ly:event-property x 'pitch)) notes))
@@ -576,18 +584,33 @@ chords.  Returns a placement-list."
 ;; The fret letter is taken from 'fretLabels if present
 (define-public (fret-letter-tablature-format
                 context string-number fret-number)
-  (let ((labels (ly:context-property context 'fretLabels)))
-    (make-translate-scaled-markup '(0 . -0.5)
-     (cond
-      ((= 0 (length labels))
-       (string (integer->char (+ fret-number (char->integer #\a)))))
-      ((and (<= 0 fret-number) (< fret-number (length labels)))
-       (list-ref labels fret-number))
-      (else
-       (ly:warning (_ "No label for fret ~a (on string ~a);
+  (let* ((labels (ly:context-property context 'fretLabels))
+         (string-tunings (ly:context-property context 'stringTunings))
+         (string-count (length string-tunings))
+         (letter
+           (cond
+            ((= 0 (length labels))
+             (string (integer->char (+ fret-number (char->integer #\a)))))
+            ((and (<= 0 fret-number) (< fret-number (length labels)))
+             (list-ref labels fret-number))
+            (else
+             (ly:warning
+               (_ "No label for fret ~a (on string ~a);
 only ~a fret labels provided")
-                   fret-number string-number (length labels))
-       ".")))))
+               fret-number string-number (length labels))
+             ".")))
+         (add-bass-string-nr ;; starting at zero
+           (- string-number string-count 1)))
+    (make-translate-scaled-markup '(0 . -0.5)
+      ;; For additional bass strings, we add zero up to three "/"-signs before
+      ;; the letter, even more bass strings will get numbers, starting with "4".
+      ;; In the rare case such a string isn't played open, we put out, eg."4b"
+      (make-concat-markup
+        (if (> string-number (+ string-count 4))
+            (list (number->string add-bass-string-nr)
+                  (if (zero? fret-number) "" letter))
+            (list (make-string (max 0 add-bass-string-nr) #\/)
+                  letter))))))
 
 ;; Display the fret number as a number
 (define-public (fret-number-tablature-format
@@ -635,8 +658,12 @@ only ~a fret labels provided")
 (define-public (tablature-position-on-lines context string-number)
   (let* ((string-tunings (ly:context-property context 'stringTunings))
          (string-count (length string-tunings))
+         (string-nr
+           (if (> string-number (length string-tunings))
+               (1+ (length string-tunings))
+               string-number))
          (string-one-topmost (ly:context-property context 'stringOneTopmost))
-         (staff-line (- (* 2 string-number) string-count 1)))
+         (staff-line (- (* 2 string-nr) string-count 1)))
     (if string-one-topmost
         (- staff-line)
         staff-line)))