lilypond-user
[Top][All Lists]

## Re: tablature.ly

 From: Marc Hohl Subject: Re: tablature.ly Date: Wed, 29 Apr 2009 11:22:53 +0200 User-agent: Thunderbird 2.0.0.21 (X11/20090318)

```Marc Hohl schrieb:
```
```Neil Puttock schrieb:
```
```2009/4/27 Carl D. Sorensen <address@hidden>:
```
```Neil,

Thanks for your input.  I think it's all really good.

On 4/26/09 1:49 PM, "Neil Puttock" <address@hidden> wrote:

```
```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:

```
```<SNIP>
```
```          (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?

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.
```
```Marc, there are probably at least two ways to do this.  The easiest one
```
would be to take each of these magic numbers and divide them by the default
```staff-space setting, and then change to something like

(base-skip (cond ((= 4 num-strings) (* staff-space 1.03))

and so forth.  (1.03 = 1.55/1.5)  And you'd need to find the value of
staff-space in order to be able to do this multiplication.
```
Ok, as Neil has posted somewhere else in this thread, the formula works only with a
```fixed staff-space. But I don't know how to find the value of staff-space.
I think it could be done similar to the proposals for the line-count
(see below), but this is far beyond my possibilities - any help is highly
appreciated!
```
```The second way would be to try to define fundamental relationships for
base-skip, but I'm not sure exactly how you'd do that, so I'm not
recommending it right now.

<SNIP>
```
calligraphicTabClef = #(define-music-function (parser location tuning)
```(pair?)
#{
\revert TabStaff.Clef #'stencil
\set TabStaff.stringTunings = \$tuning
#})
```
```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.
```
I'd also like to do that. But I don't know how to help Marc do it. Neil,
```if you can help him figure it out, I'd appreciate it.

There are two issues that I can't address:

```
1) I wasn't able to figure out how to get stringTunings in a music function
```or a markup function.   How do we do that?
```
```
You don't need to know stringTunings, since it's possible to access
'line-count from any grob which is placed on a StaffSymbol:

(let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
(line-count (ly:grob-property staff-symbol 'line-count)))

```
This is way beyond my knowledge of the internals. I simply added these lines
```accordingly in my definition of customTabClef:

#(define-markup-command (customTabClef layout props tuning) (pair?)
(define (square x) (* x x))
(let* ((staff-symbol (ly:grob-object 'grob 'staff-symbol))
(num-strings (ly:grob-property staff-symbol 'line-count))
(font-size (- (* num-strings 1.5) 7))
(base-skip (square (+ (* num-strings 0.195) 0.4))))
(interpret-markup layout props
(markup #:vcenter #:bold
#:override #'(cons 'font-family 'sans)
#:fontsize font-size
#:override #'(cons 'baseline-skip base-skip)
#:left-align
#:center-column ("T" "A" "B")))))

but this doesn't work. Lilypond complains with

Unbound variable: grob

How can I assign the right value to this symbolic variable?

```
```Arrrg, as soon as I have posted this mail, I came up with an idea:

#(define-markup-command (customTabClef layout props num-strings) (integer?)
(define (square x) (* x x))
(let* ((font-size (- (* num-strings 1.5) 7))
(base-skip (square (+ (* num-strings 0.195) 0.4))))
(interpret-markup layout props
(markup #:vcenter #:bold
#:override #'(cons 'font-family 'sans)
#:fontsize font-size
#:override #'(cons 'baseline-skip base-skip)
#:left-align
#:center-column ("T" "A" "B")))))

sansSerifTabClef = #(define-music-function (parser location tuning) (pair?)
#{
\override TabStaff.Clef #'stencil = \$(lambda (grob)
(let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
(line-count (ly:grob-property staff-symbol 'line-count)))
```
(grob-interpret-markup grob (make-customTabClef-markup line-count))))
```     \set TabStaff.stringTunings = \$tuning
#})

And this worked!
```
So I'll try to figure out the rest... ( the \$tuning-stuff has to be removed, but just as a first attempt,
```it worked).

Marc

```
```Marc

```
2) I'm not sure how to use a markup, instead of a glyph, as a clef without
```redefining the 'stencil property, and I don't know how to redefine the
```
'stencil property by means of a \clef cleftype command. If you can show us
```how to do that, it would be really helpful.
```
```
If we add entries in parser-clef.scm to supported-clefs and
c0-pitch-alist (either directly or by consing the new entries within
the tablature file) for the modern tab,

("moderntab" . ("markup.moderntab" 0 0))

("markup.moderntab" . 0)

we can override the Clef 'stencil to check 'glyph before calling the
default print-function.  If the string "markup.moderntab" is found,
then it's simple to return a stencil for the new tab markup.

There's one potential pitfall: it's expected that each clef type has a
variant at a smaller size which is obtained by appending "_change" to
the glyph-name.  You'd probably want to disable this feature by
setting 'full-size-change = ##t.

Regards,
Neil

```
```

_______________________________________________
lilypond-user mailing list
http://lists.gnu.org/mailman/listinfo/lilypond-user

```
```

```