]> git.donarmstrong.com Git - lilypond.git/commitdiff
quarter tones in tablature
authorThomas Morley <thomasmorley65@gmail.com>
Sun, 1 Nov 2015 15:18:26 +0000 (16:18 +0100)
committerThomas Morley <thomasmorley65@gmail.com>
Sat, 7 Nov 2015 18:17:25 +0000 (19:17 +0100)
issue 4643

micro-tones in TabStaff are now printable.  Unless the chosen
string-tuning will allow it, this feature is disabled for
FretBoards.
- changing determine-frets (adding an optional argument) and
  fret-number-tablature-format
- adding a regtest with quarter-tone-string-tuning
- documenting it in Documentation/notation/fretted-strings.itely
  and Documentation/changes.tely

Documentation/changes.tely
Documentation/notation/fretted-strings.itely
input/regression/tablature-micro-tone.ly [new file with mode: 0644]
ly/engraver-init.ly
scm/translation-functions.scm

index f6af535df5f58c030c7eb33ea2c025524098c123..5f01072a353e0a3863ab2daef94070e4f13b19ab 100644 (file)
@@ -61,6 +61,24 @@ which scares away people.
 
 @end ignore
 
+@item
+@code{TabStaff} is now able to print micro-tones for bendings etc.
+@lilypond[quote,verbatim]
+\layout {
+  \context {
+    \Score
+    noteToFretFunction = #(determine-frets #t)
+  }
+}
+
+mus = \relative { c'4 cih d dih }
+
+<<
+  \new Staff << \clef "G_8" \mus >>
+  \new TabStaff \mus
+>>
+@end lilypond
+
 @item
 All of @code{\override}, @code{\revert}, @code{\set}, and
 @code{\unset} now work with the @code{\once} prefix for making
index 3e0a52ae4017b565715353c7fa374c054b054077..d6a97470af0ebf0cf260bc1e06c6f0dbcfb0c2bb 100644 (file)
@@ -713,6 +713,44 @@ A modern tab clef can also be used.
 
 The modern tab clef supports tablatures from 4 to 7 strings.
 
+@cindex micro-tones, tab
+@cindex quarter-tones, tab
+@cindex tab micro-tones
+@cindex tab quarter-tones
+
+@code{TabStaff} may support micro-tones like quarter-tones, which
+can be played using bendings.
+@code{noteToFretFunction = #(determine-frets #t)} needs to be set in
+Score-context.  However, micro-tones are not supperted in @code{FretBoards}.
+
+@lilypond[quote,ragged-right,verbatim]
+\layout {
+  \context {
+    \Score
+    noteToFretFunction = #(determine-frets #t)
+  }
+}
+
+custom-tuning = \stringTuning <e, a, d ges beh eeh'>
+
+mus = \relative {
+  eeses'4
+  eeseh
+  ees
+  eeh
+  e
+  eih
+  eis
+  eisih
+  eisis
+}
+
+<<
+  \new Staff << \clef "G_8" \mus >>
+  \new TabStaff \with { stringTunings = \custom-tuning } \mus
+>>
+@end lilypond
+
 @seealso
 Notation Reference:
 @ref{Absolute octave entry},
diff --git a/input/regression/tablature-micro-tone.ly b/input/regression/tablature-micro-tone.ly
new file mode 100644 (file)
index 0000000..ff02d79
--- /dev/null
@@ -0,0 +1,42 @@
+\version "2.19.31"
+
+\header {
+  texidoc = "The @code{TabStaff} will print micro-tones as mixed numbers of
+fret-number and a fraction.
+@code{noteToFretFunction = #(my-determine-frets #t)} needs to be set in Score.
+@code{FretBoards} will print those micro-tones only if they can be found in the
+chosen settings for @code{stringTunings}, otherwise a warning (surpressed here)
+will be printed and an empty @code{FretBoard} returned.  Which should be the
+case here for the first pitch: @code{gih}"
+}
+
+#(ly:set-option 'warning-as-error #f)
+#(ly:expect-warning (_ "No string for pitch ~a (given frets ~a)") #{ gih #} '())
+
+\layout {
+  \context {
+    \Score
+    noteToFretFunction = #(determine-frets #t)
+  }
+}
+
+custom-tuning = \stringTuning <e, a, d ges beh eeh'>
+
+mus = \relative {
+  gih4
+  eeses'
+  eeseh
+  ees
+  eeh
+  e
+  eih
+  eis
+  eisih
+  eisis
+}
+
+<<
+  \new Staff << \clef "G_8" \mus >>
+  \new FretBoards \with { stringTunings = \custom-tuning } \mus
+  \new TabStaff \with { stringTunings = \custom-tuning } \mus
+>>
index 62559ca40fb6df178f3ab3b9d18954e6ad50769f..eade287f1a52fda7c182909dd459074e6a9ce5a6 100644 (file)
@@ -620,7 +620,8 @@ automatically when an output definition (a @code{\\score} or
   \accepts "TabStaff"
   \accepts "VaticanaStaff"
 
-  noteToFretFunction = #determine-frets
+  %% (determine-frets #t) would support micro-tones
+  noteToFretFunction = #(determine-frets)
   predefinedDiagramTable = ##f
   soloText = #"Solo"
   soloIIText = #"Solo II"
index 7413f6875edcd7143a17712f727b4f993f37fd32..2bb980a2f49e29ad00ba4c1a999c64166598b028 100644 (file)
@@ -233,8 +233,9 @@ way the transposition number is displayed."
     ;; Create the dot-placement list for the grob
     (set! (ly:grob-property grob 'dot-placement-list) placement-list)))
 
-(define-public
-  (determine-frets context notes specified-info . rest)
+(define*-public
+  ((determine-frets #:optional (support-non-integer-fret? #f))
+                    context notes specified-info . rest)
   "Determine string numbers and frets for playing @var{notes}
 as a chord, given specified information @var{specified-info}.
 @var{specified-info} is a list with two list elements,
@@ -247,7 +248,9 @@ Will look for predefined fretboards if @code{predefinedFretboardTable}
 is not @code {#f}.  If @var{rest} is present, it contains the
 @code{FretBoard} grob, and a fretboard will be
 created.  Otherwise, a list of @code{(string fret finger)} lists will
-be returned."
+be returned.
+If the optional @var{support-non-integer-fret?} is set @code{#t}, micro-tones
+are supported for TabStaff, but not not for FretBoards."
 
   ;;  helper functions
 
@@ -356,7 +359,9 @@ notes?"
         (and (or (and (not restrain-open-strings)
                       (zero? fret))
                  (>= fret minimum-fret))
-             (integer? fret)
+             (if (and support-non-integer-fret? (null? rest))
+                 (integer? (truncate fret))
+                 (integer? fret))
              (close-enough fret))))
 
     (define (open-string string pitch)
@@ -372,7 +377,7 @@ the current tuning?"
         (if (< this-fret 0)
             (ly:warning (_ "Negative fret for pitch ~a on string ~a")
                         (car pitch-entry) string)
-            (if (not (integer? this-fret))
+            (if (and (not (integer? this-fret)) (not support-non-integer-fret?))
                 (ly:warning (_ "Missing fret for pitch ~a on string ~a")
                             (car pitch-entry) string)))
         (delete-free-string string)
@@ -584,8 +589,25 @@ only ~a fret labels provided")
 ;; Display the fret number as a number
 (define-public (fret-number-tablature-format
                 context string-number fret-number)
-  (make-vcenter-markup
-   (format #f "~a" fret-number)))
+  (if (integer? fret-number)
+      (make-vcenter-markup
+        (format #f "~a" fret-number))
+      ;; for non-integer fret-number print p.e. "2½"
+      (let* ((whole-part (truncate fret-number))
+             (remaining (- fret-number whole-part))
+             (fret
+               (if (and (zero? whole-part) (not (zero? remaining)))
+                   ""
+                   (format #f "~a" whole-part)))
+             (frac
+               (if (zero? remaining)
+                   ""
+                   (format #f "~a" remaining))))
+        (make-concat-markup
+          (list (make-vcenter-markup fret)
+                (make-vcenter-markup
+                  ;; the value `-2.5' is my choice
+                  (make-fontsize-markup -2.5 frac)))))))
 
 ;; The 5-string banjo has got an extra string, the fifth (duh), which
 ;; starts at the fifth fret on the neck.  Frets on the fifth string