lilypond-user
[Top][All Lists]
Advanced

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

Re: tablature.ly


From: Marc Hohl
Subject: Re: tablature.ly
Date: Mon, 27 Apr 2009 11:38:52 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Neil Puttock schrieb:
2009/4/25 Marc Hohl <address@hidden>:
Hello tablature users*,

Like Carl, I'm not a tablature user, so I can only comment on matters of coding.

Some suggestions and thoughts follow below:

% some publications use the triangled note head
% for palm mute, so here we go:
palmMuteOn = { \set shapeNoteStyles = #'#(do do do do do do do ) }

You can use make-vector here, since every entry is the same symbol:

palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 'do)

palmMuteOff = { \unset shapeNoteStyles }
% for single notes (or groups of notes within { ...} :
palmMute =  #(define-music-function (parser location note) (ly:music?)
     #{
        \set shapeNoteStyles = #'#(do do do do do do do )
        $note
        \unset shapeNoteStyles
     #})

You've just defined palmMuteOn/Off.  Why not use them here?

palmMute =  #(define-music-function (parser location note) (ly:music?)
      #{
         \palmMuteOn
         $note
         \palmMuteOff
      #})

% for single notes or groups of notes within {...}:
deadNotes = #(define-music-function (parser location notes) (ly:music?)
  #{
     \override NoteHead #'style = #'cross
     \set tablatureFormat = #x-tab-format
     $notes
     \unset tablatureFormat
     \revert NoteHead #'style
  #})

As above, using deadNotesOn/Off.

#(define-markup-command (customTabClef layout props tuning) (pair?)
   (let* ((num-strings (length tuning))
          ;; the number of strings has to be in 4...7
          (num-strings (cond ((< num-strings 4) 4)
                             ((> num-strings 7) 7)
                             (else num-strings)))

This looks a bit strange, since you've just defined num-strings.  You
can use min and max to keep it within range:

(let* ((num-strings (min (max (length tuning) 4) 7))
Thank you for your suggestions! As I am no expert in scheme, some things can
surely be done more elegant. I corrected my file as you suggested above.

          (raise-value (- (* num-strings 0.4) 0.9))

You can junk this, since #:vcenter in the markup below will do it automatically.

Ok.
          (font-size (- (* num-strings 1.5) 7))
          (base-skip (cond ((= 4 num-strings) 1.55)
                           ((= 5 num-strings) 1.84)
                           ((= 6 num-strings)  2.00)
                           ((= 7 num-strings) 2.08)))

Can you rework these so they're not hard-coded?
That's a bigger problem: first, I used a definition as shown in the LSR and played a bit with the
values for base-skip, font-size and raise. Here is my first attempt:

tabClefIV = \markup {
 \raise #0.7 {
   \override #'(font-family . sans)
   \bold\fontsize #-1.0
   \override #'(baseline-skip . 1.44)
   \column { "T" "A" "B" }
 }
}

I found out that the base-line for 4 ... 7 strings follows a quadratic equation:
base-skip = ( 0.2 * num-strings + 0.4 )**2
but inserting this into the definition of customTabClef didn't work, and neither
Carl nor I could nail down the problem, so finally, I hard-coded the values.

If you can help me with that, it would be great.
Imagine a user doesn't like the default staff-space setting for
TabStaff (1.5).  If they change it, none of these empirical values
will work properly.

          (new-props (cons (list
                             '(font-family . sans)
                             (cons 'baseline-skip base-skip))
                            props)))
      (interpret-markup layout new-props
        (markup #:raise raise-value #:bold #:fontsize font-size
               #:column ("T" "A" "B")))))

Do you want the TAB column left-aligned rather than centred (like the
LSR snippet)?

Ok, #:column changed to #:center-column, I simply have overlooked this.
% Wrappers for the different clefs
% the argument is the string-tuning, which is automatically set.
sansSerifTabClef = #(define-music-function (parser location tuning) (pair?)
  #{
     \override TabStaff.Clef #'stencil = #ly:text-interface::print

Use grob-interpret-markup instead of ly:text-interface::print:

\override TabStaff.Clef #'stencil = $(lambda (grob)
(grob-interpret-markup grob (make-customTabClef-markup tuning)))

The docs are slightly lagging behind here, but
ly:text-interface::print should only be used with objects which
support text-interface.

     \override TabStaff.Clef #'text = \markup \customTabClef $tuning

Can be removed if using grob-interpret-markup.

calligraphicTabClef = #(define-music-function (parser location tuning)
(pair?)
  #{
     \revert TabStaff.Clef #'stencil
     \set TabStaff.stringTunings = $tuning
  #})

Ok, changed.
On a general note, I'd prefer to keep the string tunings separate from
setting the clef.  To set the traditional tab clef, we have the
command \clef tab, so it would be nice to be able to set the modern
style using e.g. \clef moderntab without having to use a new function.
Yes, that would be better, but I didn't manage to get the information about
the number of strings internally, so I used the tuning as an argument.
Then, to avoid setting it twice, I wrote the wrappers.
On the other hand, I would have to set the tuning before setting \clef moderntab,
but this could be easily mentioned in the docs.

As said above, any help for the base-skip problem and finding a way to get the number of strings
without explicitly using the tuning as an argument are appreciated.

Thank you!

Marc
Regards,
Neil






reply via email to

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