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 20:47:15 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Carl D. Sorensen schrieb:

On 4/27/09 3:38 AM, "Marc Hohl" <address@hidden> wrote:

Neil Puttock schrieb:
2009/4/25 Marc Hohl <address@hidden>:

          (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.


Marc, did you get the email from Robin Bannister?  He found the problem we
were having with customTabClef.  I had you put the baseline-skip override as
a cons to  the property list, instead of using it as an :override function,
and the :fontsize reset the baseline-skip.  That's why things weren't
working right.  I think the code below works with your original quadratic:

#(define-markup-command (customTabClef layout props) ()
   (define (square x) (* x x))
   (let* ((num-strings (length (chain-assoc-get 'stringTunings props '())))
          (raise-value (- (* num-strings 0.4) 0.9))
          (base-skip (square (+ (* num-strings 0.2) 0.4)))
          (font-size (- (* num-strings 1.5) 7)))
    (interpret-markup layout props
     (markup #:raise raise-value #:bold
             #:override #'(font-family . sans)
             #:fontsize font-size
             #:override #(cons 'baseline-skip base-skip)
             #:column ("T" "A" "B")))))

No, I didn't get this mail. I played around with your suggestions and the
improvements given by Neil and have now:

#(define-markup-command (customTabClef layout props tuning) (pair?)
   (define (square x) (* x x))
   (let* ((num-strings (min (max (length tuning) 4) 7))
          (font-size (- (* num-strings 1.5) 7))
          (base-skip (square (+ (* num-strings 0.2) 0.4))))
      (interpret-markup layout props
        (markup #:vcenter #:bold
                ;;#:override #'(font-family . sans)
                #:fontsize font-size
                #:override #'(cons 'baseline-skip base-skip)
                #:center-column ("T" "A" "B")))))

The raise-value calculation has gone, because I use #:vcenter, but I had to comment out the font-family line, because I got an error saying "unbound variable: font-family"
if it is in the source. What's going wrong here?

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.


Here Neil points out the thing he's most concerned about.  It's not a
concern about the magic numbers per se, it's that they don't change with
staff-spacing.  In my earlier email (let me know if you didn't get it), I
asked for his help with that problem.

With the definition above, I inserted #(set-global-staff-size <num>)
and tried values from 10 to 100, and it worked as expected.
So the quadratic equation seems to be the right way.

Marc
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


Thank you, too, Marc!

Carl







reply via email to

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