diff options
author | Thomas Morley <thomasmorley65@gmail.com> | 2015-11-01 16:18:26 +0100 |
---|---|---|
committer | Thomas Morley <thomasmorley65@gmail.com> | 2015-11-07 19:17:25 +0100 |
commit | 7f1b4934f96cfea964986c29d4048e6e794b9611 (patch) | |
tree | 3c2d3572cdc471069c1d3d4137932814bc7076fb | |
parent | 0f3099177a2a23347b0a8c0895adbebc87d416be (diff) |
quarter tones in tablature
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
-rw-r--r-- | Documentation/changes.tely | 18 | ||||
-rw-r--r-- | Documentation/notation/fretted-strings.itely | 38 | ||||
-rw-r--r-- | input/regression/tablature-micro-tone.ly | 42 | ||||
-rw-r--r-- | ly/engraver-init.ly | 3 | ||||
-rw-r--r-- | scm/translation-functions.scm | 36 |
5 files changed, 129 insertions, 8 deletions
diff --git a/Documentation/changes.tely b/Documentation/changes.tely index f6af535df5..5f01072a35 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -62,6 +62,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 one-time settings. diff --git a/Documentation/notation/fretted-strings.itely b/Documentation/notation/fretted-strings.itely index 3e0a52ae40..d6a97470af 100644 --- a/Documentation/notation/fretted-strings.itely +++ b/Documentation/notation/fretted-strings.itely @@ -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 index 0000000000..ff02d79bdb --- /dev/null +++ b/input/regression/tablature-micro-tone.ly @@ -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 +>> diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 62559ca40f..eade287f1a 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -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" diff --git a/scm/translation-functions.scm b/scm/translation-functions.scm index 7413f6875e..2bb980a2f4 100644 --- a/scm/translation-functions.scm +++ b/scm/translation-functions.scm @@ -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 |