Re: tablature.ly - please test and comment

2009-06-19 Thread Grammostola Rosea

David Stocker wrote:
I've got some things typed out, but I still need to write explanations 
for the placement and display of objects, and suggestions for the 
program behavior. As soon as I have those written out, I'll post the 
first batch. I'll try to get it done today or tomorrow.


David

Maybe this weekend? ;)

Regards,

\r



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


Re: tablature.ly - please test and comment

2009-06-15 Thread David Stocker
I've got some things typed out, but I still need to write explanations 
for the placement and display of objects, and suggestions for the 
program behavior. As soon as I have those written out, I'll post the 
first batch. I'll try to get it done today or tomorrow.


David

Grammostola Rosea wrote:

David Stocker wrote:
Thanks, Marc and Carl for making this happen. I'll post some 
editorial suggestions here for how bends should look soon (next week, 
really! I've had occasion to work on it this week)


David

Hi,

Some progress here?


Regards,

\r






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


Re: tablature.ly - please test and comment

2009-06-15 Thread Grammostola Rosea

David Stocker wrote:
Thanks, Marc and Carl for making this happen. I'll post some editorial 
suggestions here for how bends should look soon (next week, really! 
I've had occasion to work on it this week)


David

Hi,

Some progress here?


Regards,

\r



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


Re: tablature.ly - please test and comment

2009-05-30 Thread Marc Hohl

Carl D. Sorensen schrieb:


[...]

But how can I find out whether the tweak is called within a normal or a
tab staff? Within a normal staff, a whiteout should surely be avoided ...



I think you have to do this within the callback, where the context is
available.  Once you have a context, you can see if it's a Voice context or
a TabVoice context.  I'm sure Neil can help with this better than I can.
But if you do a git grep for context, you'll see lots of examples of how to
get information about contexts

  

 [...]

No, the tweaks will work only in chord constructs
as far as I know, so I should have a pair of functions
for each feature, i.e.

c4 d \palmMute e f

< c \chordPalmMute e g >4

c4 d \deadNotes e f

< c \chordDeadNotes e g >4




Oh, I wasn't expecting that the new function wouldn't work outside of chord
constructs.

How about using the same function both inside and outside of the chord
constructs, and just including a check to see if the argument is a
NoteEvent.  If it is, use the \tweak method, and if it's not, use the
existing method?

  
Yes, that would be great. I will dig into the sources and see what I can 
achieve.


Marc

I haven't tried this out, but I think it could be made to work, and if it
could, then it would greatly simplify things for the users.

HTH,

Carl


  




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


Re: tablature.ly - please test and comment

2009-05-29 Thread Carl D. Sorensen



On 5/29/09 9:20 AM, "Marc Hohl"  wrote:

> Carl D. Sorensen schrieb:
>> 
>> On 5/29/09 2:05 AM, "Marc Hohl"  wrote:
>> 
>>  
>>> Carl D. Sorensen schrieb:
>>>
>>>> [...]
>>>>  
>>> There is some drawback/difference: the crosses are drawn without
>>> whiteout, so they look different. Is there a way to change this?
>>>
>> 
>> Yes.  Change the stencil so that it is a composite stencil.
>>  
> But how can I find out whether the tweak is called within a normal or a
> tab staff? Within a normal staff, a whiteout should surely be avoided ...

I think you have to do this within the callback, where the context is
available.  Once you have a context, you can see if it's a Voice context or
a TabVoice context.  I'm sure Neil can help with this better than I can.
But if you do a git grep for context, you'll see lots of examples of how to
get information about contexts

>>  
>>>> 
>>>> Marc, feel free to add this to tablature.ly if you want to.
>>>> 
>>>>  
>>> How should we call this? It should be clear that
>>> \deadNotes works as expected, and the new function is meant
>>> to be used inside chord constructs  only.
>>> \chordNoteDeadNote sounds a bit strange ...
>>>
>> 
>> I would recommend \deadNote, since it only applies to the next note.
>>  
>>> The matching case for \palmMute, namely
>>> \chordNotePalmMute seems to be ok for me.
>>> 
>>>
>> 
>> I haven't reviewed the code carefully, but I think that \palmMute should
>> apply only to the next note, and \palmMuteOn should change all notes to palm
>> mute notes, or \palmMuteNotes could apply to a whole music expression.
>>  
> Yes, that's how it works now (you can use \palmMute { ... } to treat
> several notes at once, or \palmMuteOn ... \palmMuteOff).
>> 
>>  
>>> Or just simply use \chordDeadNote /  \chordPalmMute ?
>>>
>> 
>> I don't like the \chord* notation because they aren't limited to use in
>> chords.  They will work for any single note, won't they?
>>  
> No, the tweaks will work only in chord constructs
> as far as I know, so I should have a pair of functions
> for each feature, i.e.
> 
> c4 d \palmMute e f
> 
> < c \chordPalmMute e g >4
> 
> c4 d \deadNotes e f
> 
> < c \chordDeadNotes e g >4
> 

Oh, I wasn't expecting that the new function wouldn't work outside of chord
constructs.

How about using the same function both inside and outside of the chord
constructs, and just including a check to see if the argument is a
NoteEvent.  If it is, use the \tweak method, and if it's not, use the
existing method?

I haven't tried this out, but I think it could be made to work, and if it
could, then it would greatly simplify things for the users.

HTH,

Carl



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


Re: tablature.ly - please test and comment

2009-05-29 Thread Marc Hohl

Carl D. Sorensen schrieb:


On 5/29/09 2:05 AM, "Marc Hohl"  wrote:

  

Carl D. Sorensen schrieb:


[...]

Here's one way to do it:

deadNote =
#(define-music-function (parser location note) (ly:music?)
(set! (ly:music-property note 'tweaks)
  (acons 'stencil ly:note-head::print
   (acons 'glyph-name "2cross"
(acons 'style 'special (ly:music-property note 'tweaks)
note)

{
  
}

 
  

There is some drawback/difference: the crosses are drawn without
whiteout, so they look different. Is there a way to change this?



Yes.  Change the stencil so that it is a composite stencil.
  

But how can I find out whether the tweak is called within a normal or a
tab staff? Within a normal staff, a whiteout should surely be avoided ...
  
 
Marc, feel free to add this to tablature.ly if you want to.
 
  

How should we call this? It should be clear that
\deadNotes works as expected, and the new function is meant
to be used inside chord constructs  only.
\chordNoteDeadNote sounds a bit strange ...



I would recommend \deadNote, since it only applies to the next note.
  

The matching case for \palmMute, namely
\chordNotePalmMute seems to be ok for me.




I haven't reviewed the code carefully, but I think that \palmMute should
apply only to the next note, and \palmMuteOn should change all notes to palm
mute notes, or \palmMuteNotes could apply to a whole music expression.
  

Yes, that's how it works now (you can use \palmMute { ... } to treat
several notes at once, or \palmMuteOn ... \palmMuteOff).
 
  

Or just simply use \chordDeadNote /  \chordPalmMute ?



I don't like the \chord* notation because they aren't limited to use in
chords.  They will work for any single note, won't they?
  

No, the tweaks will work only in chord constructs
as far as I know, so I should have a pair of functions
for each feature, i.e.

c4 d \palmMute e f

< c \chordPalmMute e g >4

c4 d \deadNotes e f

< c \chordDeadNotes e g >4


Marc




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


Re: tablature.ly - please test and comment

2009-05-29 Thread Marc Hohl

Carl D. Sorensen schrieb:


On 5/29/09 1:56 AM, "Marc Hohl"  wrote:

  

David Stocker schrieb:


If I may chime in...

This may just be a matter of editorial taste, but would it be possible
to make it so the 'X' on in the Tab staff is not the musical glyph
from Feta, but rather the character 'capital X' from the same font set
being used for tab numbers? For example, instead of #'glyph-name
#"2cross", use whatever command would call the capital X from
whichever font tab numbers are set to?

I believe that this looks better on the page than mixing music glyphs
and text glyphs in the tab staff, particularly where tab numbers and
muted strings are part of the same chord.
  

Hm, in my opinion, this looks not very convincing. I defined

#(define (xx-tab-format str context event)
  (make-whiteout-markup
(make-vcenter-markup
  (markup "X"

so the "X" matches the font and font-size of the numbers.
I have attached an example.



Have you tried a sans-serif font for both the numbers and the X?
  
Not yet. Personally, I don't like the idea of using a letter instead of 
a cross,

but I can give it a try.

Marc

Carl


  




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


Re: tablature.ly - please test and comment

2009-05-29 Thread Carl D. Sorensen



On 5/29/09 1:56 AM, "Marc Hohl"  wrote:

> David Stocker schrieb:
>> If I may chime in...
>> 
>> This may just be a matter of editorial taste, but would it be possible
>> to make it so the 'X' on in the Tab staff is not the musical glyph
>> from Feta, but rather the character 'capital X' from the same font set
>> being used for tab numbers? For example, instead of #'glyph-name
>> #"2cross", use whatever command would call the capital X from
>> whichever font tab numbers are set to?
>> 
>> I believe that this looks better on the page than mixing music glyphs
>> and text glyphs in the tab staff, particularly where tab numbers and
>> muted strings are part of the same chord.
> Hm, in my opinion, this looks not very convincing. I defined
> 
> #(define (xx-tab-format str context event)
>   (make-whiteout-markup
> (make-vcenter-markup
>   (markup "X"
> 
> so the "X" matches the font and font-size of the numbers.
> I have attached an example.

Have you tried a sans-serif font for both the numbers and the X?

Carl



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


Re: tablature.ly - please test and comment

2009-05-29 Thread Carl D. Sorensen



On 5/29/09 2:05 AM, "Marc Hohl"  wrote:

> Carl D. Sorensen schrieb:
>> [...]
>> 
>> Here's one way to do it:
>> 
>> deadNote =
>> #(define-music-function (parser location note) (ly:music?)
>> (set! (ly:music-property note 'tweaks)
>>   (acons 'stencil ly:note-head::print
>>(acons 'glyph-name "2cross"
>> (acons 'style 'special (ly:music-property note 'tweaks)
>> note)
>> 
>> {
>>   
>> }
>> 
>>  
> There is some drawback/difference: the crosses are drawn without
> whiteout, so they look different. Is there a way to change this?

Yes.  Change the stencil so that it is a composite stencil.

>>  
>> Marc, feel free to add this to tablature.ly if you want to.
>>  
> How should we call this? It should be clear that
> \deadNotes works as expected, and the new function is meant
> to be used inside chord constructs  only.
> \chordNoteDeadNote sounds a bit strange ...

I would recommend \deadNote, since it only applies to the next note.
> 
> The matching case for \palmMute, namely
> \chordNotePalmMute seems to be ok for me.
>

I haven't reviewed the code carefully, but I think that \palmMute should
apply only to the next note, and \palmMuteOn should change all notes to palm
mute notes, or \palmMuteNotes could apply to a whole music expression.
 
> Or just simply use \chordDeadNote /  \chordPalmMute ?

I don't like the \chord* notation because they aren't limited to use in
chords.  They will work for any single note, won't they?

Thanks,

Carl



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


Re: tablature.ly - please test and comment

2009-05-29 Thread Grammostola Rosea


Thanks, Marc and Carl for making this happen. I'll post some editorial 
suggestions here for how bends should look soon (next week, really! 
I've had occasion to work on it this week)




Great! Next week, nice.

Take it easy ;)


\r



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


Re: tablature.ly - please test and comment

2009-05-29 Thread Marc Hohl

Carl D. Sorensen schrieb:

[...]

Here's one way to do it:

deadNote =
#(define-music-function (parser location note) (ly:music?)
(set! (ly:music-property note 'tweaks)
  (acons 'stencil ly:note-head::print
   (acons 'glyph-name "2cross"
(acons 'style 'special (ly:music-property note 'tweaks)
note)

{
  
}

  

There is some drawback/difference: the crosses are drawn without
whiteout, so they look different. Is there a way to change this?
  
Marc, feel free to add this to tablature.ly if you want to.
  

How should we call this? It should be clear that
\deadNotes works as expected, and the new function is meant
to be used inside chord constructs  only.
\chordNoteDeadNote sounds a bit strange ...

The matching case for \palmMute, namely
\chordNotePalmMute seems to be ok for me.

Or just simply use \chordDeadNote /  \chordPalmMute ?

Marc

<>___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: tablature.ly - please test and comment

2009-05-29 Thread Marc Hohl

David Stocker schrieb:

If I may chime in...

This may just be a matter of editorial taste, but would it be possible 
to make it so the 'X' on in the Tab staff is not the musical glyph 
from Feta, but rather the character 'capital X' from the same font set 
being used for tab numbers? For example, instead of #'glyph-name 
#"2cross", use whatever command would call the capital X from 
whichever font tab numbers are set to?


I believe that this looks better on the page than mixing music glyphs 
and text glyphs in the tab staff, particularly where tab numbers and 
muted strings are part of the same chord.

Hm, in my opinion, this looks not very convincing. I defined

#(define (xx-tab-format str context event)
 (make-whiteout-markup
   (make-vcenter-markup
 (markup "X"

so the "X" matches the font and font-size of the numbers.
I have attached an example.

Marc


<>___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: tablature.ly - please test and comment

2009-05-28 Thread Carl D. Sorensen



On 5/28/09 6:28 PM, "David Stocker"  wrote:

> If I may chime in...
> 
> This may just be a matter of editorial taste, but would it be possible
> to make it so the 'X' on in the Tab staff is not the musical glyph from
> Feta, but rather the character 'capital X' from the same font set being
> used for tab numbers? For example, instead of #'glyph-name #"2cross",
> use whatever command would call the capital X from whichever font tab
> numbers are set to?

Getting an X from the number font is not hard.  The only challenge would
come in setting the cross notehead for the Staff context, and the number
notehead for the TabStaff context.  But this shouldn't be too hard to do, I
think.  Marc is certainly good enough at programming to make it happen  now,
I'm sure.

Carl



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Julian
> Here's one way to do it:
> 
> deadNote =
> #(define-music-function (parser location note) (ly:music?)
> (set! (ly:music-property note 'tweaks)
>   (acons 'stencil ly:note-head::print
>(acons 'glyph-name "2cross"
> (acons 'style 'special (ly:music-property note 'tweaks)
> note)

Yes, Marc already replied me ( with exactly same function ) some hours ago

Thanks anyway

Julian



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


Re: tablature.ly - please test and comment

2009-05-28 Thread David Stocker

If I may chime in...

This may just be a matter of editorial taste, but would it be possible 
to make it so the 'X' on in the Tab staff is not the musical glyph from 
Feta, but rather the character 'capital X' from the same font set being 
used for tab numbers? For example, instead of #'glyph-name #"2cross", 
use whatever command would call the capital X from whichever font tab 
numbers are set to?


I believe that this looks better on the page than mixing music glyphs 
and text glyphs in the tab staff, particularly where tab numbers and 
muted strings are part of the same chord.


In the industry, most houses are currently using Helvetica Condensed 
Bold or some derivative (which, incidentally, matches better with the 
'modern' tab clef) for tab numbers, but I've seen older copy done with a 
Roman font in the tab staff (and a fancier, more rustic looking tab clef).


Thanks, Marc and Carl for making this happen. I'll post some editorial 
suggestions here for how bends should look soon (next week, really! I've 
had occasion to work on it this week)


David

Carl D. Sorensen wrote:


On 5/28/09 7:22 AM, "Julian"  wrote:

  

But still not within the tablature staff
At the moment, I don't know how to manage this.
  

I found it,

<
   % Dead Note
   \tweak #'stencil #ly:note-head::print
   \tweak #'glyph-name #"2cross"
   \tweak #'style #'special
   f'\1
   % End of Dead Note
   f\4


4
  

Dead note is applied only to "f'\1" as we expect, and "X" is displayed on
both,
staff and tabStaff.

Now i don't have idea how to make it in a lilypond function :) to use
\chordNoteDead instead of add all tweaks lines...
however it don't matters, now we know that it is possible to show X in tab too
by notes instead of chord.




Here's one way to do it:

deadNote =
#(define-music-function (parser location note) (ly:music?)
(set! (ly:music-property note 'tweaks)
  (acons 'stencil ly:note-head::print
   (acons 'glyph-name "2cross"
(acons 'style 'special (ly:music-property note 'tweaks)
note)

{
  
}


Marc, feel free to add this to tablature.ly if you want to.


HTH,

Carl




  

Thanks for your patience.









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


  



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Carl D. Sorensen



On 5/28/09 7:22 AM, "Julian"  wrote:

>> But still not within the tablature staff
>> At the moment, I don't know how to manage this.
> 
> I found it,
> 
> <
>% Dead Note
>\tweak #'stencil #ly:note-head::print
>\tweak #'glyph-name #"2cross"
>\tweak #'style #'special
>f'\1
>% End of Dead Note
>f\4
>> 4
> 
> Dead note is applied only to "f'\1" as we expect, and "X" is displayed on
> both,
> staff and tabStaff.
> 
> Now i don't have idea how to make it in a lilypond function :) to use
> \chordNoteDead instead of add all tweaks lines...
> however it don't matters, now we know that it is possible to show X in tab too
> by notes instead of chord.


Here's one way to do it:

deadNote =
#(define-music-function (parser location note) (ly:music?)
(set! (ly:music-property note 'tweaks)
  (acons 'stencil ly:note-head::print
   (acons 'glyph-name "2cross"
(acons 'style 'special (ly:music-property note 'tweaks)
note)

{
  
}


Marc, feel free to add this to tablature.ly if you want to.


HTH,

Carl




> 
> Thanks for your patience.
> 
> 
> 
> 



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Julian
Great man!

Thanks for your help



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Marc Hohl

Julian schrieb:
But still not within the tablature staff 
At the moment, I don't know how to manage this.



I found it,

<
   % Dead Note 
   \tweak #'stencil #ly:note-head::print

   \tweak #'glyph-name #"2cross"
   \tweak #'style #'special
   f'\1 
   % End of Dead Note 
   f\4
  

4



  

Wow, great!


Dead note is applied only to "f'\1" as we expect, and "X" is displayed on both,
staff and tabStaff.

Now i don't have idea how to make it in a lilypond function :) to use
\chordNoteDead instead of add all tweaks lines...
  

Try

chordNoteDeadNote =
#(define-music-function (parser location note) (ly:music?)
 (set! (ly:music-property note 'tweaks)
   (acons 'stencil ly:note-head::print
(acons 'glyph-name "2cross"
 (acons 'style 'special
  (ly:music-property note 'tweaks)
 note)

it works exactly as your tweaks, within normal and tab staff.

test = \relative c {
< a-0 e'-2 a-3 c-1 e-0 >8
< a \chordNoteDeadNote e'  \chordNoteDeadNote a  \chordNoteDeadNote 
c e >

< a e' a c e >
< a \chordNoteDeadNote e' \chordNoteDeadNote a \chordNoteDeadNote c e >
< a e' a c e>
< a \chordNoteDeadNote e' \chordNoteDeadNote a \chordNoteDeadNote c e >
< a e' a c e>
< a \chordNoteDeadNote e' \chordNoteDeadNote a \chordNoteDeadNote c e >
< a e' a  c  e >1
  }

\score {
  << \new Staff{ \clef "G_8" \test }
 \new TabStaff {\clef "moderntab" \test }
 >>
}

I am not sure about the name - I think it should represent the fact that 
these functions

are to be used inside a chord construct < ... >.

Greetings

Marc


however it don't matters, now we know that it is possible to show X in tab too
by notes instead of chord.

Thanks for your patience.



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

  




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


Re: tablature.ly - please test and comment

2009-05-28 Thread Julian
> But still not within the tablature staff 
> At the moment, I don't know how to manage this.

I found it,

<
   % Dead Note 
   \tweak #'stencil #ly:note-head::print
   \tweak #'glyph-name #"2cross"
   \tweak #'style #'special
   f'\1 
   % End of Dead Note 
   f\4
>4

Dead note is applied only to "f'\1" as we expect, and "X" is displayed on both,
staff and tabStaff.

Now i don't have idea how to make it in a lilypond function :) to use
\chordNoteDead instead of add all tweaks lines...
however it don't matters, now we know that it is possible to show X in tab too
by notes instead of chord.

Thanks for your patience.



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Carl D. Sorensen



On 5/28/09 1:21 AM, "Marc Hohl"  wrote:

> Carl D. Sorensen schrieb:
>> [...]
>> 
>> I think it's better to have the duplication and the ability to switch
>> between \tabNumbersOnly and \tabFullNotation, than to avoid the duplication,
>> and have \tabFullNotation be a non-undoable setting.
>>  
> As you can see, \tabFullNotation works only locally when included in a
> score:
> 
> \version "2.13.0"
> \include "tablature.ly"
> 
> test = \relative c { c4 d e f g a b c }
> 
> \score { \new TabStaff { \clef "tab" \test } }
> 
> \score { \new TabStaff { \clef "tab" \tabFullNotation \test } }
> 
> \score { \new TabStaff { \clef "tab" \test } }
> 
> So according to Neil's proposals, I got rid of the \tabNumbersOnly for
> sake of clarity.
> 

OK, I guess.  I still don't like having a command that is not undoable.  I
can't think of a "reasonable"  application where this would cause a problem,
but LilyPond users regularly try things that I don't consider "reasonable".

I guess that we can deal with the problem later if it ever shows up.

I'll publish the patch to rietveld and obtain comments.

Thanks,

Carl



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


Re: tablature.ly - please test and comment

2009-05-28 Thread Marc Hohl

Carl D. Sorensen schrieb:

[...]

I think it's better to have the duplication and the ability to switch
between \tabNumbersOnly and \tabFullNotation, than to avoid the duplication,
and have \tabFullNotation be a non-undoable setting.
  
As you can see, \tabFullNotation works only locally when included in a 
score:


\version "2.13.0"
\include "tablature.ly"

test = \relative c { c4 d e f g a b c }

\score { \new TabStaff { \clef "tab" \test } }

\score { \new TabStaff { \clef "tab" \tabFullNotation \test } }

\score { \new TabStaff { \clef "tab" \test } }

So according to Neil's proposals, I got rid of the \tabNumbersOnly for
sake of clarity.

Marc


Thanks,

Carl


  




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


Re: tablature.ly - please test and comment

2009-05-27 Thread Carl D. Sorensen



On 5/27/09 2:50 PM, "Neil Puttock"  wrote:

> 2009/5/23 Marc Hohl :
>> Neil Puttock schrieb:
> 
>>> Since none of this works properly (I suspect it will require more than
>>> Scheme hacking to get everything working), I don't think it's suitable
>>> for inclusion.
>>> 
>>> 
>> 
>> Hm, I guess you're right - but as a compromise, how about letting the
>> \clearTabTieBreaks as a default, because it is working most of the time, and
>> when someone needs a more sophisticated tab staff, he has to write a
>> separate
>> score for the tablature?
>> 
>> I would propose to rename it as
>> 
>> #(define (tie::handle-tied-fret-numbers grob)
>>       (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
>>             (ly:grob-set-property! tied-fret-nr 'transparent #t)))
>> 
>> make it default by
>> 
>> \override Tie #'after-line-breaking = #tie::handle-tied-fret-numbers
>> 
>> and use this as a kind of starting point for future improvements?
> 
> Oh go on then.  As long as you promise to leave out \markTabTieBreaks. :)
> 
>>> I'm concerned about the amount of duplication here; this basically
>>> repeats all the code in \tabNumbersOnly, which is really something we
>>> should try to avoid in included files.
>>> 
>> 
>> But how to avoid this? One possibility would be to just get rid of the
>> \tabNumbersOnly, because I don't think that tablatures with and
>> without stems will ever be mixed together in a file, and when someone wants
>> to do so, he can \override everything manually.
> 
> I think that's the only option available, since there's no way of
> inserting identifiers into a context definition.

I think it's better to have the duplication and the ability to switch
between \tabNumbersOnly and \tabFullNotation, than to avoid the duplication,
and have \tabFullNotation be a non-undoable setting.

Thanks,

Carl



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


Re: tablature.ly - please test and comment

2009-05-27 Thread Neil Puttock
2009/5/23 Marc Hohl :
> Neil Puttock schrieb:

>> Since none of this works properly (I suspect it will require more than
>> Scheme hacking to get everything working), I don't think it's suitable
>> for inclusion.
>>
>>
>
> Hm, I guess you're right - but as a compromise, how about letting the
> \clearTabTieBreaks as a default, because it is working most of the time, and
> when someone needs a more sophisticated tab staff, he has to write a
> separate
> score for the tablature?
>
> I would propose to rename it as
>
> #(define (tie::handle-tied-fret-numbers grob)
>       (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
>             (ly:grob-set-property! tied-fret-nr 'transparent #t)))
>
> make it default by
>
> \override Tie #'after-line-breaking = #tie::handle-tied-fret-numbers
>
> and use this as a kind of starting point for future improvements?

Oh go on then.  As long as you promise to leave out \markTabTieBreaks. :)

>> I'm concerned about the amount of duplication here; this basically
>> repeats all the code in \tabNumbersOnly, which is really something we
>> should try to avoid in included files.
>>
>
> But how to avoid this? One possibility would be to just get rid of the
> \tabNumbersOnly, because I don't think that tablatures with and
> without stems will ever be mixed together in a file, and when someone wants
> to do so, he can \override everything manually.

I think that's the only option available, since there's no way of
inserting identifiers into a context definition.

Regards,
Neil


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


Re: tablature.ly - please test and comment

2009-05-27 Thread Marc Hohl

Julian schrieb:
Here, it would be possible to define versions for deadNotes and palmMute 
that

works inside < ... > constructs, i.e.



Yes they works fine, i think it is the best way to use now..
  

But still not within the tablature staff :-(
At the moment, I don't know how to manage this.

Marc


Thanks



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

  




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


Re: tablature.ly - please test and comment

2009-05-27 Thread Julian
> Here, it would be possible to define versions for deadNotes and palmMute 
> that
> works inside < ... > constructs, i.e.

Yes they works fine, i think it is the best way to use now..

Thanks



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


Re: tablature.ly - please test and comment

2009-05-27 Thread Marc Hohl

Julian schrieb:

I think you can make this work with parallel music, instead of chords.

<< c, \deadNotes{ c ]>>

HTH,

Carl




I was looking about this. at first it seems to be a good solution
but then i could see that it give some problems managing voices.
it also displays some warning messages:
"ignoring too many clashing note columns"

if we could tell lilypond that all notes inside << >> are from
\voiceOne or \voiceTwo it could be definitly a perfect solution..
because we could manage beats by string
something like:
--
% measure 1
<< 
\voiceOne

%string 1 beats
{ e'4\1 e'4\1 e'4\1 e'4\1 }
%string 2 beats
{ b4\2  b4\2  b4\2  b4\2  }
%string 3 beats
{ g4\3  g4\3  g4\3  g4\3  }
%string 4 beats
{ d4\4  d4\4  d4\4  d4\4  }
%string 5 beats
{ a,4\5 a,4\5 a,4\5 a,4\5 }
%string 6 beats
{ e,4\6 e,4\6 e,4\6 e,4\6 }
  
--


It solves the slide, palm mute, and dead problem.
  

No, I'm afraid it doesn't. I can call

<<
   \override NoteColumn #'ignore-collision = ##t
   %string 1 beats
   {\voiceOne e'4\1 e4\1 e4\1 \glissando f4\1 }
   %string 2 beats
   { \voiceOne b,4\2  b4\2  b4\2 \glissando c4\2 }
   %string 3 beats
   { \voiceOne g4\3  g4\3  g4\3 \glissando as4\3 }
   %string 4 beats
   { \voiceOne d,4\4  d4\4  d4\4 \deadNotes { d4\4 } }
   %string 5 beats
   { \voiceOne a4\5 a4\5 a4\5 \deadNotes { a4\5 } }
   %string 6 beats
   { \voiceOne e4\6 e4\6 e4\6 \palmMute { f4\6 } }
>>

then I don't get any error messages, but the glissando is misplaced, all 
notes on the last beat

are palm mute style and dead note style in tablature. Weird.

Marc



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


Re: tablature.ly - please test and comment

2009-05-27 Thread Marc Hohl

Julian schrieb:

[...]

i found the "\tweak #'style #'cross" works indide <  >
e.g:
   4 d

  
Here, it would be possible to define versions for deadNotes and palmMute 
that

works inside < ... > constructs, i.e.

chordNoteDeadNote =
#(define-music-function (parser location note) (ly:music?)
 (set! (ly:music-property note 'tweaks)
   (acons 'style 'cross (ly:music-property note 'tweaks)))
 note)

chordNotePalmMute =
#(define-music-function (parser location note) (ly:music?)
 (set! (ly:music-property note 'tweaks)
   (acons 'style 'do (ly:music-property note 'tweaks)))
 note)

so you can write

< a \chordNoteDeadNote e' \chordNoteDeadNote a \chordNoteDeadNote c e >
< a \chordNotePalmMute e' \chordNotePalmMute a \chordNotePalmMute c e >

these definitions could be easily included, but I don't know (yet) to do 
the same

for tablature, because here - as you pointed out, the numbers still appear
(which is okay for palmMute, but not for a deadNote).

Marc

it only affect the score.. not sure if is there any way to change X instead of
number by style.

Cheers,
Julian



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

  




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


Re: tablature.ly - please test and comment

2009-05-26 Thread Julian
> I think you can make this work with parallel music, instead of chords.
> 
> << c, \deadNotes{ c ]>>
> 
> HTH,
> 
> Carl
> 

I was looking about this. at first it seems to be a good solution
but then i could see that it give some problems managing voices.
it also displays some warning messages:
"ignoring too many clashing note columns"

if we could tell lilypond that all notes inside << >> are from
\voiceOne or \voiceTwo it could be definitly a perfect solution..
because we could manage beats by string
something like:
--
% measure 1
<< 
\voiceOne
%string 1 beats
{ e'4\1 e'4\1 e'4\1 e'4\1 }
%string 2 beats
{ b4\2  b4\2  b4\2  b4\2  }
%string 3 beats
{ g4\3  g4\3  g4\3  g4\3  }
%string 4 beats
{ d4\4  d4\4  d4\4  d4\4  }
%string 5 beats
{ a,4\5 a,4\5 a,4\5 a,4\5 }
%string 6 beats
{ e,4\6 e,4\6 e,4\6 e,4\6 }
>>
--

It solves the slide, palm mute, and dead problem.

Other problem here is that we need convinate features..
i could see things like:
c4\harmonic   =  not work
4 =  works fine

but then other features don't work if they are inside a < ... >
so it's very hard to export a note when it have some of these features convined.
this is why i'm trying to find a generic way that can be used
to manage beats 

i found the "\tweak #'style #'cross" works indide <  >
e.g:
   4 d

it only affect the score.. not sure if is there any way to change X instead of
number by style.

Cheers,
Julian



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


Re: tablature.ly - please test and comment

2009-05-25 Thread Carl D. Sorensen



On 5/25/09 12:13 PM, "Julian"  wrote:

> 
> Hello Marc,
> 
> Well at first, english is no my native lang, so sorry for don't speak it well.
> 
> I'm the admin of tuxguitar (a tablature editor) project and now i'm trying to
> implement some of these features to the lilypond exporter plugin.
> 
> But i'm having some problems, when i try to apply them on only 1 note of a
> beat
> that have more notes.
> 
> I'll try to explain them with some examples:
> 
> * Dead Notes
> 
> I was able to build examples like:
> c4 \deadNotes{ 4 } c4 c4
> 
> But if i try to set the dead to only 1 note of the beat:
> c4 4 c4 c4
> 
> lilypond throw me:
> ---
> test.ly:324:20: error: syntax error, unexpected '{', expecting DRUM_PITCH or
> MUSIC_FUNCTION or NOTENAME_PITCH
>c4  { c } >4 c4 c4
> test.ly:324:26: error: syntax error, unexpected >
>c4 > 4 c4 c4
> test.ly:330:3: error: errors found, ignoring music expression
> ---
> 
> So, am i doing something wrong with my sintax, or it is just a non supported
> feature ?
> ( Same thing is happening with palmMute )

I think you can make this work with parallel music, instead of chords.

<< c, \deadNotes{ c ]>>


HTH,

Carl



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


Re: tablature.ly - please test and comment

2009-05-25 Thread Julian
Marc Hohl  hohlart.de> writes:

> 
> [ok, the mail was too big, I removed the attached pdf output]
> I attach the latest version of tablature.ly together with a test file.
> Please have a look at it and reply any corrections/improvements/changes
> /etc.
> before I will send patches to Carl.
> 
> Remember that you have to add
> 
> (define-public (add-new-clef clef-name clef-glyph clef-position
> octavation c0-position)
>"Append the entries for a clef symbol to supported clefs and
> c0-pitch-alist"
>(set! supported-clefs
>  (acons clef-name (list clef-glyph clef-position octavation)
> supported-clefs))
>(set! c0-pitch-alist
>  (acons clef-glyph c0-position c0-pitch-alist)))
> 
> into scm/parser-clef.scm (for now, I think it will be part of the next
> release).
> 
> tablature.ly provides:
> 
> 1) two commands to switch between tablature notation with and without stems
> 2) a sans serif tab clef
> 3) a double stemmed half note (of course only when stems are enabled)
> 4) fret numbers that are 'tied to' are now (mostly) invisible.
> 5) commands for palm mute and dead notes are available
> 6) glissando lines in tablature have now the right slope when sliding from
> higher to lower frets.
> 
> Greetings
> 
> Marc

Hello Marc,

Well at first, english is no my native lang, so sorry for don't speak it well.

I'm the admin of tuxguitar (a tablature editor) project and now i'm trying to
implement some of these features to the lilypond exporter plugin.

But i'm having some problems, when i try to apply them on only 1 note of a beat
that have more notes.

I'll try to explain them with some examples:

* Dead Notes

I was able to build examples like:
c4 \deadNotes{ 4 } c4 c4

But if i try to set the dead to only 1 note of the beat:
c4 4 c4 c4

lilypond throw me: 
---
test.ly:324:20: error: syntax error, unexpected '{', expecting DRUM_PITCH or
MUSIC_FUNCTION or NOTENAME_PITCH
   c4 4 c4 c4
test.ly:324:26: error: syntax error, unexpected >
   c4 4 c4 c4
test.ly:330:3: error: errors found, ignoring music expression
---

So, am i doing something wrong with my sintax, or it is just a non supported
feature ?
( Same thing is happening with palmMute )


* Slides

I'm trying to use "glissando" to represent the slide.
but is there any way to tell lilypond to what note of next beat it should apply
the line ?
I mean when there are 2 beats, and one note of the first beat has an slide,
to one of some notes of the second beat, i need to set what note of the second
beat is slided with the note of the first.

I'm not sure if i'm clear, i'll add a simple tab here:
||---7
||---5-/-7
||
||
||
||

On this example, there is a slide on the second string
beetween frets 5 and 7.

When i try to write this on the .ly file, i don't have idea how to 
tell lilypond that it should be applied to the note F# ( string 2 | fret 7 )
as default it is applying it to the last note added on the beat.

Is there any way to set this ?


Thanks for all, I hope you could understand my english..

Cheers,
Julian



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


Re: tablature.ly - please test and comment

2009-05-23 Thread Marc Hohl

Carl D. Sorensen schrieb:


On 5/23/09 1:09 AM, "Marc Hohl"  wrote:

  

Neil Puttock schrieb:


2009/5/22 Marc Hohl :
  

% for ties in tablature, fret numbers that are tied to should be invisible
% or -after a line break - put in parentheses. Since this is not (easily?)
% possible in lilypond, we offer three commands:
#(define (tie::tab-mark-tied-fret-numbers grob)
(let* ((original (ly:grob-original grob))
   (tied-fret-nr (ly:spanner-bound grob RIGHT))
   (siblings (if (ly:grob? original)
 (ly:spanner-broken-into original) '() )))

  (if (and (>= (length siblings) 2)
   (eq? (car (last-pair siblings)) grob))
  ;; tie is split -> change fret number color to red and
print a message
  (begin (display "\nSplit tie appears in tablature.")
 (display "\nAffected fret number is marked red.\n")
 (ly:grob-set-property! tied-fret-nr 'color red))
  ;; tie is not split -> make fret number invisible


Since none of this works properly (I suspect it will require more than
Scheme hacking to get everything working), I don't think it's suitable
for inclusion.

 
  

Hm, I guess you're right - but as a compromise, how about letting the
\clearTabTieBreaks as a default, because it is working most of the time, and
when someone needs a more sophisticated tab staff, he has to write a
separate
score for the tablature?

I would propose to rename it as

#(define (tie::handle-tied-fret-numbers grob)
(let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
  (ly:grob-set-property! tied-fret-nr 'transparent #t)))

make it default by

\override Tie #'after-line-breaking = #tie::handle-tied-fret-numbers

and use this as a kind of starting point for future improvements?





Marc,

Have you explored the possibility of calling parentheses-item::print on your
tied fret number?

I don't know if it will work, but it appears it may be possible.  It may
need to be defined public in order to call it.

It's found in scm/output-lib.scm.
  
Carl, thank you for your proposal. I made it public, but I came up with 
an error

message. Apparently

(ly:grob-object tied-fret-nr 'elements)

returns an empty list,so ly:grob-common-refpoint-of-array
complains about an empty second argument.
I didn't understand completely how parentheses-item::print
works, so I can't figure out if there is a workaround to use
this or a similar constructed function.


Marc

I haven't tried it, but it looks to me like it takes a grob and adds
parentheses around it.

Carl



  




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


Re: tablature.ly - please test and comment

2009-05-23 Thread Carl D. Sorensen



On 5/23/09 1:09 AM, "Marc Hohl"  wrote:

> Neil Puttock schrieb:
>> 2009/5/22 Marc Hohl :
>>> % for ties in tablature, fret numbers that are tied to should be invisible
>>> % or -after a line break - put in parentheses. Since this is not (easily?)
>>> % possible in lilypond, we offer three commands:
>>> #(define (tie::tab-mark-tied-fret-numbers grob)
>>> (let* ((original (ly:grob-original grob))
>>>(tied-fret-nr (ly:spanner-bound grob RIGHT))
>>>(siblings (if (ly:grob? original)
>>>  (ly:spanner-broken-into original) '() )))
>>> 
>>>   (if (and (>= (length siblings) 2)
>>>(eq? (car (last-pair siblings)) grob))
>>>   ;; tie is split -> change fret number color to red and
>>> print a message
>>>   (begin (display "\nSplit tie appears in tablature.")
>>>  (display "\nAffected fret number is marked red.\n")
>>>  (ly:grob-set-property! tied-fret-nr 'color red))
>>>   ;; tie is not split -> make fret number invisible
>> 
>> Since none of this works properly (I suspect it will require more than
>> Scheme hacking to get everything working), I don't think it's suitable
>> for inclusion.
>> 
>>  
> Hm, I guess you're right - but as a compromise, how about letting the
> \clearTabTieBreaks as a default, because it is working most of the time, and
> when someone needs a more sophisticated tab staff, he has to write a
> separate
> score for the tablature?
> 
> I would propose to rename it as
> 
> #(define (tie::handle-tied-fret-numbers grob)
> (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
>   (ly:grob-set-property! tied-fret-nr 'transparent #t)))
> 
> make it default by
> 
> \override Tie #'after-line-breaking = #tie::handle-tied-fret-numbers
> 
> and use this as a kind of starting point for future improvements?
> 
> 

Marc,

Have you explored the possibility of calling parentheses-item::print on your
tied fret number?

I don't know if it will work, but it appears it may be possible.  It may
need to be defined public in order to call it.

It's found in scm/output-lib.scm.

I haven't tried it, but it looks to me like it takes a grob and adds
parentheses around it.

Carl




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


Re: tablature.ly - please test and comment

2009-05-23 Thread Marc Hohl

Neil Puttock schrieb:

2009/5/22 Marc Hohl :

  

Please have a look at it and reply any corrections/improvements/changes
/etc.
before I will send patches to Carl.



Well done Marc, this is very promising.

  

Thank you!

I still have a few reservations concerning some details (mostly
minor), which I'll comment on below.

  
[...]
  

I will rework the file and adapt the formatting according to your proposals.

% for ties in tablature, fret numbers that are tied to should be invisible
% or -after a line break - put in parentheses. Since this is not (easily?)
% possible in lilypond, we offer three commands:
%
% \clearTabTieBreaks simply makes all tied numbers invisible,
% \drawTabTieBreaks draws numbers that follow a line break
% \markTabTieBreaks draws a red fret number and gives a
% warning message on the terminal, so the user can put the
% parentheses manually and finally changes \mark... with \draw...

#(define (tie::tab-clear-tied-fret-numbers grob)
(let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
  (ly:grob-set-property! tied-fret-nr 'transparent #t)))

#(define (tie::tab-draw-tied-fret-numbers grob)
(let* ((original (ly:grob-original grob))
   (tied-fret-nr (ly:spanner-bound grob RIGHT))
   (siblings (if (ly:grob? original)
 (ly:spanner-broken-into original) '() )))

  (if (and (>= (length siblings) 2)
   (eq? (car (last-pair siblings)) grob))
  ;; tie is split -> make fret number visible
  (ly:grob-set-property! tied-fret-nr 'transparent #f)
  ;; tie is not split -> make fret number invisible
  (ly:grob-set-property! tied-fret-nr 'transparent #t

#(define (tie::tab-mark-tied-fret-numbers grob)
(let* ((original (ly:grob-original grob))
   (tied-fret-nr (ly:spanner-bound grob RIGHT))
   (siblings (if (ly:grob? original)
 (ly:spanner-broken-into original) '() )))

  (if (and (>= (length siblings) 2)
   (eq? (car (last-pair siblings)) grob))
  ;; tie is split -> change fret number color to red and
print a message
  (begin (display "\nSplit tie appears in tablature.")
 (display "\nAffected fret number is marked red.\n")
 (ly:grob-set-property! tied-fret-nr 'color red))
  ;; tie is not split -> make fret number invisible
  (ly:grob-set-property! tied-fret-nr 'transparent #t

clearTabTieBreaks = {
 \override Tie #'after-line-breaking = #tie::tab-clear-tied-fret-numbers
}

drawTabTieBreaks = {
 \override Tie #'after-line-breaking = #tie::tab-draw-tied-fret-numbers
}

markTabTieBreaks = {
 \override Tie #'after-line-breaking = #tie::tab-mark-tied-fret-numbers
}



Since none of this works properly (I suspect it will require more than
Scheme hacking to get everything working), I don't think it's suitable
for inclusion.

  

Hm, I guess you're right - but as a compromise, how about letting the
\clearTabTieBreaks as a default, because it is working most of the time, and
when someone needs a more sophisticated tab staff, he has to write a 
separate

score for the tablature?

I would propose to rename it as

#(define (tie::handle-tied-fret-numbers grob)
   (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
 (ly:grob-set-property! tied-fret-nr 'transparent #t)))

make it default by

\override Tie #'after-line-breaking = #tie::handle-tied-fret-numbers

and use this as a kind of starting point for future improvements?



[...]

  

% the defaults for tablature:
% the clef handler will be included and the tablature
% is displayed \tabNumbersOnly-style:
\layout {
  \context {
 \TabStaff
 % the clef handler
 \override Clef #'stencil = #clef::print-modern-tab-if-set
 % no time signature
 \override TimeSignature #'stencil = ##f
 % behaviour of split ties
 \override Tie #'after-line-breaking = #tie::tab-clear-tied-fret-numbers
  }
  \context {
 \TabVoice
 \override Stem #'stencil = ##f
 \override Beam #'stencil = ##f
 \override Dots #'stencil = ##f
 \override Tie  #'stencil = ##f
 \override Slur #'stencil = ##f
 % the direction for glissando lines will be automatically corrected
 \override Glissando #'extra-dy = #glissando::calc-tab-extra-dy
 \override TupletBracket #'stencil = ##f
 \override TupletNumber #'stencil = ##f
 \override DynamicText #'transparent = ##t
 \override DynamicTextSpanner #'stencil = ##f
 \override TextSpanner #'stencil = ##f
 \override Hairpin #'transparent = ##t
 \override Rest #'stencil = ##f
 \override MultiMeasureRest #'stencil = ##f
 \override Script #'stencil = ##f
 \override TextScript #'stencil = ##f
  }
}



I'm concerned about the amount of duplication here; this basicall

Re: tablature.ly - please test and comment

2009-05-22 Thread Neil Puttock
2009/5/22 Marc Hohl :

> Please have a look at it and reply any corrections/improvements/changes
> /etc.
> before I will send patches to Carl.

Well done Marc, this is very promising.

I still have a few reservations concerning some details (mostly
minor), which I'll comment on below.

>  tablature.ly
> 
>  source file of the GNU LilyPond music typesetter
> 
>  (c) 2009 Marc Hohl 
>
>
> % some publications use the triangled note head
> % for palm mute, so here we go:
> palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 'do) }
> palmMuteOff = { \unset shapeNoteStyles }
> % for single notes (or groups of notes within { ...} :
> palmMute =  #(define-music-function (parser location notes) (ly:music?)

#(define-music-function ... on a new line (see the formatting style
for music functions in music-functions-init.ly).

>      #{
>         \palmMuteOn
>         $notes
>         \palmMuteOff
>      #})

Fix indentation (two spaces).

> % x-tab-format uses a "x" instead of the fret number:
> #(define (x-tab-format str context event)
>    (make-whiteout-markup
>      (make-vcenter-markup
>        (markup #:musicglyph "noteheads.s2cross"
>
> % dead notes are marked with a cross-shape note head,
> % both in normal notation and in tablature:
> deadNotesOn = {
>   \override NoteHead #'style = #'cross
>   \set tablatureFormat = #x-tab-format

Indent two spaces only.

> }
> deadNotesOff = {
>   \unset tablatureFormat
>   \revert NoteHead #'style

Fix indentation.

> }

> % for single notes or groups of notes within {...}:
> deadNotes = #(define-music-function (parser location notes) (ly:music?)
>   #{
>      \deadNotesOn
>      $notes
>      \deadNotesOff
>   #})

Music function formatting as above.

>
> % definitions for the "moderntab" clef:
> % the "moderntab" clef will be added to the list of known clefs,
> % so it can be used as any other clef:
> %
> % \clef "moderntab"
> %
> #(add-new-clef "moderntab" "markup.moderntab" 0 0 0)
>
> % this function decides which clef to take
> #(define (clef::print-modern-tab-if-set grob)
>    (let* ((glyph (ly:grob-property grob 'glyph)))

Use let here.

> % if the stems are drawn, it is nice to have a double stem for
> % (dotted) half notes to distinguish them from quarter notes:
> #(define-public (tabvoice::draw-double-stem-for-half-notes grob)
>   ;; is the note a (dotted) half note?
>   (if (= 1 (ly:grob-property grob 'duration-log))
>       ;; yes -> draw double stem
>       (ly:stencil-combine-at-edge
>           (ly:stem::print grob) 0   1
>           (ly:stem::print grob) 0.5 0 )
>       ;; no -> draw simple stem
>       (ly:stem::print grob)))

Too many (ly:stem::print grob) forms here; better to use let to define
the stencil.

>
> % as default, the glissando line between fret numbers goes
> % upwards, here we have a function to correct this behavior:
> #(define-public (glissando::calc-tab-extra-dy grob)
>   (let* ((original (ly:grob-original grob))
>          (left-bound (ly:spanner-bound original LEFT))
>          (right-bound (ly:spanner-bound original RIGHT))
>          (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
>          (right-pitch (ly:event-property (event-cause right-bound) 'pitch))
>          (left-staff-position (ly:grob-property left-bound 'staff-position))
>          (right-staff-position (ly:grob-property right-bound
> 'staff-position)))
>
>     (if (and (= left-staff-position right-staff-position)
>              (< (ly:pitch-semitones right-pitch) (ly:pitch-semitones
> left-pitch)))
>         -0.75
>          0.75 )))

I think it looks better if you leave out the staff-position
comparison, otherwise all glissandos (up or down) between noteheads on
different strings get the same positive 'extra-dy.

>
>
> % for ties in tablature, fret numbers that are tied to should be invisible
> % or -after a line break - put in parentheses. Since this is not (easily?)
> % possible in lilypond, we offer three commands:
> %
> % \clearTabTieBreaks simply makes all tied numbers invisible,
> % \drawTabTieBreaks draws numbers that follow a line break
> % \markTabTieBreaks draws a red fret number and gives a
> %     warning message on the terminal, so the user can put the
> %     parentheses manually and finally changes \mark... with \draw...
>
> #(define (tie::tab-clear-tied-fret-numbers grob)
>         (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
>               (ly:grob-set-property! tied-fret-nr 'transparent #t)))
>
> #(define (tie::tab-draw-tied-fret-numbers grob)
>     

tablature.ly - please test and comment

2009-05-22 Thread Marc Hohl

[ok, the mail was too big, I removed the attached pdf output]
I attach the latest version of tablature.ly together with a test file.
Please have a look at it and reply any corrections/improvements/changes
/etc.
before I will send patches to Carl.

Remember that you have to add

(define-public (add-new-clef clef-name clef-glyph clef-position
octavation c0-position)
  "Append the entries for a clef symbol to supported clefs and
c0-pitch-alist"
  (set! supported-clefs
(acons clef-name (list clef-glyph clef-position octavation)
supported-clefs))
  (set! c0-pitch-alist
(acons clef-glyph c0-position c0-pitch-alist)))

into scm/parser-clef.scm (for now, I think it will be part of the next
release).

tablature.ly provides:

1) two commands to switch between tablature notation with and without stems
2) a sans serif tab clef
3) a double stemmed half note (of course only when stems are enabled)
4) fret numbers that are 'tied to' are now (mostly) invisible.
5) commands for palm mute and dead notes are available
6) glissando lines in tablature have now the right slope when sliding from
higher to lower frets.

Greetings

Marc

 tablature.ly

 source file of the GNU LilyPond music typesetter

 (c) 2009 Marc Hohl 


% some publications use the triangled note head 
% for palm mute, so here we go:
palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 'do) }
palmMuteOff = { \unset shapeNoteStyles }
% for single notes (or groups of notes within { ...} :
palmMute =  #(define-music-function (parser location notes) (ly:music?)
  #{
 \palmMuteOn
 $notes
 \palmMuteOff
  #})

% x-tab-format uses a "x" instead of the fret number:
#(define (x-tab-format str context event)
(make-whiteout-markup
  (make-vcenter-markup
(markup #:musicglyph "noteheads.s2cross"

% dead notes are marked with a cross-shape note head,
% both in normal notation and in tablature:
deadNotesOn = {
   \override NoteHead #'style = #'cross
   \set tablatureFormat = #x-tab-format
}
deadNotesOff = {
   \unset tablatureFormat
   \revert NoteHead #'style
}
% for single notes or groups of notes within {...}:
deadNotes = #(define-music-function (parser location notes) (ly:music?)
   #{
  \deadNotesOn
  $notes
  \deadNotesOff
   #})

% definitions for the "moderntab" clef:
% the "moderntab" clef will be added to the list of known clefs,
% so it can be used as any other clef:
% 
% \clef "moderntab"
%
#(add-new-clef "moderntab" "markup.moderntab" 0 0 0)

% this function decides which clef to take
#(define (clef::print-modern-tab-if-set grob)
(let* ((glyph (ly:grob-property grob 'glyph)))
  ;; which clef is wanted?
  (if (string=? glyph "markup.moderntab")
  ;; if it is "moderntab", we'll draw it
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
 (line-count   (ly:grob-property staff-symbol 'line-count))
 (staff-space  (ly:grob-property staff-symbol 'staff-space 
1)))
(grob-interpret-markup grob (make-customTabClef-markup 
line-count staff-space)))
  ;; otherwise, we simply use the default printing routine
  (ly:clef::print grob

% define sans serif-style tab-Clefs as a markup:
#(define-markup-command (customTabClef layout props num-strings staff-space) 
(integer? number?)
(define (square x) (* x x))
(let* ((scale-factor (/ staff-space 1.5))
   (font-size (- (* num-strings 1.5 scale-factor) 7))
   (base-skip (* (square (+ (* num-strings 0.195) 0.4)) scale-factor)))
  (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")

% if the stems are drawn, it is nice to have a double stem for
% (dotted) half notes to distinguish them from quarter notes:
#(define-public (tabvoice::draw-double-stem-for-half-notes grob)
   ;; is the note a (dotted) half note?
   (if (= 1 (ly:grob-property grob 'duration-log))
   ;; yes -> draw double stem
   (ly:stencil-combine-at-edge
   (ly:stem::print grob) 0   1
   (ly:stem::print grob) 0.5 0 )
   ;; no -> draw simple stem
   (ly:stem::print grob)))

% as default, the glissando line between fret numbers goes
% upwards, here we have a function to correct this behavior:
#(define-public (glissando::calc-tab-extra-dy grob)
   (let* ((original (ly:grob-original grob))
  (left-bound (ly:spanner-bound original LEFT))
  (right-bound (ly:spanner-bound original RIGHT))
  (left-

Re: tablature.ly, second attempt

2009-05-08 Thread Grammostola Rosea

Marc Hohl wrote:
There is one problem now with the settings in tablature.ly: I simply 
made ties transparent, but
then, the fret number appears as it were a note to be played. 
Hopefully somewhere in the future,
I will find a possibility to let the fret number disappear, but as 
David Stocerk pointed out,
some cases had to be  distinguished (the following is a quote from a 
former posting from David):


(quote...)

It should be noted that a publishing standard is when there is a Note 
Staff + Tab Staff, tied notes (that is, the notes that are 'held') in 
the Tab Staff are indicated by parenthesizing the tab number(s). There 
are several conventions that are related to tied notes in a Notes+Tab 
situation:


  * Tab numbers that are 'tied to' are sometimes parenthesized,
sometimes hidden.
  * In the case that 'tied to' notes are hidden, a parenthesized tab
number is usually forced if the 'tied to' note is at the beginning
of a line (i.e., the note is tied over a system break).
  * Likewise, parenthesized tab numbers are forced when a 'tied to'
note begins a 2nd ending or Coda section.
  * A parenthesized chord in the Tab Staff are indicated with a single
pair of parentheses surrounding all of the notes in the chord (as
opposed to as single pair of parentheses around each individual
note in the chord).

(...quote)

So this seems to be a difficult task, but somehow to manage.

Yeah it would nice if you got the job done so that even the details 
(which are important often) are perfect. I think you can do it with help 
of some brilliant people on the list ;)


@David, this is also my two weekly head up... how are things going ;)

Kind regards,

\r


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


Re: tablature.ly, second attempt

2009-05-04 Thread rosea grammostola
Great job!
Really appreciate it!

\r

On Mon, May 4, 2009 at 9:47 AM, Marc Hohl  wrote:

> Hello tablature users,
>
> after sending my first version of a tablature.ly-file, I got a lot of
> positive resonse,
> and a lot more of corrections/improvements. Thank you all!
>
> Now, there is a (hopefully) better file which includes the following
> features/changes:
>
> 1) the palmmute/deadnote stuff is the same, only the code has been
> simplified, thanks to Neil's proposals
>
> 2) the \tabNumbersOnly settings are now the default, so when tablature.lyis 
> included, the stems etc. are gone
>  (as proposed by Grammostola Rosea)
>
> 3) the modern tab clef is now available as any other clef by typing \clef
> "moderntab"
>
> To implement (3), there is another function necessary, which will be in
> future releases of lilypond, but
> for now, you have to insert the following lines into scm/parser-clef.scm:
>
> ;; a function to add new clefs at runtime
> (define-public (add-new-clef clef-name clef-glyph clef-position octavation
> c0-position)
>  "Append the entries for a clef symbol to supported-clefs and
> c0-pitch-alist"
>  (set! supported-clefs
>   (acons clef-name (list clef-glyph clef-position octavation)
> supported-clefs))
>  (set! c0-pitch-alist
>   (acons clef-glyph c0-position c0-pitch-alist)))
>
> Otherwise the new clef definition won't work.
>
> Thanks again to Carl and Neil for their help!
>
> There is one problem now with the settings in tablature.ly: I simply made
> ties transparent, but
> then, the fret number appears as it were a note to be played. Hopefully
> somewhere in the future,
> I will find a possibility to let the fret number disappear, but as David
> Stocerk pointed out,
> some cases had to be  distinguished (the following is a quote from a former
> posting from David):
>
> (quote...)
>
> It should be noted that a publishing standard is when there is a Note Staff
> + Tab Staff, tied notes (that is, the notes that are 'held') in the Tab
> Staff are indicated by parenthesizing the tab number(s). There are several
> conventions that are related to tied notes in a Notes+Tab situation:
>
>  * Tab numbers that are 'tied to' are sometimes parenthesized,
>sometimes hidden.
>  * In the case that 'tied to' notes are hidden, a parenthesized tab
>number is usually forced if the 'tied to' note is at the beginning
>of a line (i.e., the note is tied over a system break).
>  * Likewise, parenthesized tab numbers are forced when a 'tied to'
>note begins a 2nd ending or Coda section.
>  * A parenthesized chord in the Tab Staff are indicated with a single
>pair of parentheses surrounding all of the notes in the chord (as
>opposed to as single pair of parentheses around each individual
>note in the chord).
>
> (...quote)
>
> So this seems to be a difficult task, but somehow to manage.
>
> Marc
>
>
>
>
>  tablature.ly
> 
>  source file of the GNU LilyPond music typesetter
> 
>  (c) 2009 Marc Hohl 
>
>
> % some publications use the triangled note head
> % for palm mute, so here we go:
> palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 do) }
> palmMuteOff = { \unset shapeNoteStyles }
> % for single notes (or groups of notes within { ...} :
> palmMute =  #(define-music-function (parser location notes) (ly:music?)
>  #{
> \palmMuteOn $notes \palmMuteOff
>  #})
>
> % x-tab-format uses a "x" instead of the fret number:
> #(define (x-tab-format str context event)
>(make-whiteout-markup
>  (make-vcenter-markup
>(markup #:musicglyph "noteheads.s2cross"
>
> % dead notes are marked with a cross-shape note head,
> % both in normal notation and in tablature:
> deadNotesOn = {
>   \override NoteHead #'style = #'cross
>   \set tablatureFormat = #x-tab-format
> }
> deadNotesOff = {
>   \unset tablatureFormat
>   \revert NoteHead #'style
> }
> % for single notes or groups of notes within {...}:
> deadNotes = #(define-music-function (parser location notes) (ly:music?)
>   #{
>  \deadNotesOn  $notes \deadNotesOff
>   #})
>
> % definitions for the "moderntab" clef:
> % the "moderntab" clef will be added to the list of known clefs,
> % so it can be used as any other clef:
> %
> % \clef "moderntab"
> %
> #(add-new-clef "moderntab" "markup.moderntab" 0 0 0)
>
> % this function decides which clef to take
> #(define (clef::print-modern-tab-if-set grob)
>(let* ((glyph (ly:grob-property grob 'glyph)

tablature.ly, second attempt

2009-05-04 Thread Marc Hohl

Hello tablature users,

after sending my first version of a tablature.ly-file, I got a lot of 
positive resonse,

and a lot more of corrections/improvements. Thank you all!

Now, there is a (hopefully) better file which includes the following 
features/changes:


1) the palmmute/deadnote stuff is the same, only the code has been 
simplified, thanks to Neil's proposals


2) the \tabNumbersOnly settings are now the default, so when 
tablature.ly is included, the stems etc. are gone

  (as proposed by Grammostola Rosea)

3) the modern tab clef is now available as any other clef by typing 
\clef "moderntab"


To implement (3), there is another function necessary, which will be in 
future releases of lilypond, but

for now, you have to insert the following lines into scm/parser-clef.scm:

;; a function to add new clefs at runtime
(define-public (add-new-clef clef-name clef-glyph clef-position 
octavation c0-position)
 "Append the entries for a clef symbol to supported-clefs and 
c0-pitch-alist"

 (set! supported-clefs
   (acons clef-name (list clef-glyph clef-position octavation) 
supported-clefs))

 (set! c0-pitch-alist
   (acons clef-glyph c0-position c0-pitch-alist)))

Otherwise the new clef definition won't work.

Thanks again to Carl and Neil for their help!

There is one problem now with the settings in tablature.ly: I simply 
made ties transparent, but
then, the fret number appears as it were a note to be played. Hopefully 
somewhere in the future,
I will find a possibility to let the fret number disappear, but as David 
Stocerk pointed out,
some cases had to be  distinguished (the following is a quote from a 
former posting from David):


(quote...)

It should be noted that a publishing standard is when there is a Note 
Staff + Tab Staff, tied notes (that is, the notes that are 'held') in 
the Tab Staff are indicated by parenthesizing the tab number(s). There 
are several conventions that are related to tied notes in a Notes+Tab 
situation:


  * Tab numbers that are 'tied to' are sometimes parenthesized,
sometimes hidden.
  * In the case that 'tied to' notes are hidden, a parenthesized tab
number is usually forced if the 'tied to' note is at the beginning
of a line (i.e., the note is tied over a system break).
  * Likewise, parenthesized tab numbers are forced when a 'tied to'
note begins a 2nd ending or Coda section.
  * A parenthesized chord in the Tab Staff are indicated with a single
pair of parentheses surrounding all of the notes in the chord (as
opposed to as single pair of parentheses around each individual
note in the chord).

(...quote)

So this seems to be a difficult task, but somehow to manage.

Marc



 tablature.ly

 source file of the GNU LilyPond music typesetter

 (c) 2009 Marc Hohl 


% some publications use the triangled note head 
% for palm mute, so here we go:
palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 do) }
palmMuteOff = { \unset shapeNoteStyles }
% for single notes (or groups of notes within { ...} :
palmMute =  #(define-music-function (parser location notes) (ly:music?)
  #{
 \palmMuteOn $notes \palmMuteOff
  #})

% x-tab-format uses a "x" instead of the fret number:
#(define (x-tab-format str context event)
(make-whiteout-markup
  (make-vcenter-markup
(markup #:musicglyph "noteheads.s2cross"

% dead notes are marked with a cross-shape note head,
% both in normal notation and in tablature:
deadNotesOn = {
   \override NoteHead #'style = #'cross
   \set tablatureFormat = #x-tab-format
}
deadNotesOff = {
   \unset tablatureFormat
   \revert NoteHead #'style
}
% for single notes or groups of notes within {...}:
deadNotes = #(define-music-function (parser location notes) (ly:music?)
   #{
  \deadNotesOn  $notes \deadNotesOff
   #})

% definitions for the "moderntab" clef:
% the "moderntab" clef will be added to the list of known clefs,
% so it can be used as any other clef:
% 
% \clef "moderntab"
%
#(add-new-clef "moderntab" "markup.moderntab" 0 0 0)

% this function decides which clef to take
#(define (clef::print-modern-tab-if-set grob)
(let* ((glyph (ly:grob-property grob 'glyph)))
  ;; which clef is wanted?
  (if (string=? glyph "markup.moderntab")
  ;; if it is "moderntab", we'll draw it
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
 (line-count   (ly:grob-property staff-symbol 'line-count))
 (staff-space  (ly:grob-property staff-symbol 'staff-space 
1)))
(grob-interpret-markup grob (make-customTabClef-markup 
line-count staff-space)))
  ;; otherwise, we simply use the default printing routine
  (ly:clef::print grob

%

Re: tablature.ly

2009-05-03 Thread Marc Hohl

Neil Puttock schrieb:

2009/5/2 Marc Hohl :

  

Ok, so I inserted the following lines in my scm/parser-clef.scm:

;; a function to add new clefs at runtime
(define-public (add-new-clef clef-name clef-glyph clef-position octaviation
c0-position)
 "Append the entries for a clef symbol to supported clefs and
c0-pitch-alist"
 (set! supported-clefs
  (acons clef-name (list clef-glyph clef-position octaviation)
supported-clefs))
 (set! c0-pitch-alist
  (acons clef-glyph c0-position c0-pitch-alist)))

[ I don't know if everything is correct, see below, but when everything
works, I'll send patches.]



That looks fine.  I'd just suggest changing `octaviation' to `octavation'.
  
Ups, that's a "germanism". In Germay, we say "Oktavierung" and even 
"Tabulatur", so

I have to look more carefully in the future.
  

I tried to follow your suggestions, and after some trial and error, I have
rearranged my tablature.ly as follows (see attachment):

#(add-new-clef "moderntab" "markup.moderntab" 0 0 0)

% this function decides which clef to take
#(define (clef::print-modern-tab-if-set grob)
  (let* ((glyph (ly:grob-property grob 'glyph)))
(if (eq? glyph "markup.moderntab")



You can't compare strings using eq?; try equal? or (more idiomatic
since we know 'glyph is a string) string=?
  

Ok, I didn't know that.
  

(ly:modern-tab-clef::print grob)
(ly:clef::print grob


#(define (ly:modern-tab-clef::print grob)



I don't think it's necessary to split this out of the function above.

Also, `ly:' is reserved for Scheme functions which have been exported
from the C++ source.

  

 (ly:grob-property grob 'staff-space 1)
 (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
   (line-count   (ly:grob-property staff-symbol 'line-count))
   (staff-space  (ly:grob-property staff-symbol 'staff-space)))
   (grob-interpret-markup grob (make-customTabClef-markup line-count
staff-space



Two further points:

Just to be on the safe side, when retrieving 'staff-space, a default
value should be given, since it's not normally set:

(ly:grob-property grob 'staff-space 1)

  

Is this line placed properly? I don't understand this quite right, does this
line
define the default value if 'staff-space is not set at all and doesn't
override 'staff-space
if it s set before?



I mean add `1' to the the following line:

(staff-space (ly:grob-property staff-symbol 'staff-space 1)

If 'staff-space can't be found, i.e., it's not set, then
ly:grob-property will return the default value instead.
  

Ah, now this makes sense to me.
  

As I mentioned previously, unless you want to code a smaller clef for
changes, you'll want to set 'full-size-change = ##t.  This will shut
up any complaints about missing a glyph for "markup.moderntab_change".
 You can set it within the new stencil callback using
ly:grob-set-property!:

(ly:grob-set-property! grob 'full-size-change #t)

  

Where have I to put this? I surely want changes to be enabled for the
standard clefs,
so I have to put it after the comparison for "markup.moderntab". On the
other hand,
when it's put too late, then 'glyph has the value "markup.moderntab_change",
so the test for
"markup.moderntab" will fail.



Actually, you can forget this, since it seem to work fine without
overriding 'full-size-change.

  

And a final question:
I put the override for the TabStaff.Clef #'stencil into \tabNumbersOnly
resp.
\tabFullNotation, so if the user doesn't call one of these commands, the
clef
selection mechanism won't work. Is there a workaround, or - even better -
can \tabNumbersOnly be invoked automatically when tablature.ly is included?
This doesn't alter the defaults for older files but would give the desired
functionality
(i.e. numbers only) for tablature users.



You could place all the default overrides inside a \layout block, in
the same manner as the settings for TabVoice are done in
engraver-init.ly.

  

Anyway, when I put all the pieces together, lilypond still complains about
not finding
"markup.moderntab", so I have made some mistakes.



Only the string matching, so you've done really well all things considered.
  
Thank you for your help, I will write a new example file and send all 
patches and stuff to Carl when I'm ready for it.


Marc

Regards,
Neil

  




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


Re: tablature.ly

2009-05-02 Thread Neil Puttock
2009/5/2 Marc Hohl :

> Ok, so I inserted the following lines in my scm/parser-clef.scm:
>
> ;; a function to add new clefs at runtime
> (define-public (add-new-clef clef-name clef-glyph clef-position octaviation
> c0-position)
>  "Append the entries for a clef symbol to supported clefs and
> c0-pitch-alist"
>  (set! supported-clefs
>       (acons clef-name (list clef-glyph clef-position octaviation)
> supported-clefs))
>  (set! c0-pitch-alist
>       (acons clef-glyph c0-position c0-pitch-alist)))
>
> [ I don't know if everything is correct, see below, but when everything
> works, I'll send patches.]

That looks fine.  I'd just suggest changing `octaviation' to `octavation'.

> I tried to follow your suggestions, and after some trial and error, I have
> rearranged my tablature.ly as follows (see attachment):
>
> #(add-new-clef "moderntab" "markup.moderntab" 0 0 0)
>
> % this function decides which clef to take
> #(define (clef::print-modern-tab-if-set grob)
>   (let* ((glyph (ly:grob-property grob 'glyph)))
>         (if (eq? glyph "markup.moderntab")

You can't compare strings using eq?; try equal? or (more idiomatic
since we know 'glyph is a string) string=?

>             (ly:modern-tab-clef::print grob)
>             (ly:clef::print grob
>
>
> #(define (ly:modern-tab-clef::print grob)

I don't think it's necessary to split this out of the function above.

Also, `ly:' is reserved for Scheme functions which have been exported
from the C++ source.

>  (ly:grob-property grob 'staff-space 1)
>  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
>            (line-count   (ly:grob-property staff-symbol 'line-count))
>            (staff-space  (ly:grob-property staff-symbol 'staff-space)))
>            (grob-interpret-markup grob (make-customTabClef-markup line-count
> staff-space
>
>>
>> Two further points:
>>
>> Just to be on the safe side, when retrieving 'staff-space, a default
>> value should be given, since it's not normally set:
>>
>> (ly:grob-property grob 'staff-space 1)
>>
>
> Is this line placed properly? I don't understand this quite right, does this
> line
> define the default value if 'staff-space is not set at all and doesn't
> override 'staff-space
> if it s set before?

I mean add `1' to the the following line:

(staff-space (ly:grob-property staff-symbol 'staff-space 1)

If 'staff-space can't be found, i.e., it's not set, then
ly:grob-property will return the default value instead.

>> As I mentioned previously, unless you want to code a smaller clef for
>> changes, you'll want to set 'full-size-change = ##t.  This will shut
>> up any complaints about missing a glyph for "markup.moderntab_change".
>>  You can set it within the new stencil callback using
>> ly:grob-set-property!:
>>
>> (ly:grob-set-property! grob 'full-size-change #t)
>>
>
> Where have I to put this? I surely want changes to be enabled for the
> standard clefs,
> so I have to put it after the comparison for "markup.moderntab". On the
> other hand,
> when it's put too late, then 'glyph has the value "markup.moderntab_change",
> so the test for
> "markup.moderntab" will fail.

Actually, you can forget this, since it seem to work fine without
overriding 'full-size-change.

> And a final question:
> I put the override for the TabStaff.Clef #'stencil into \tabNumbersOnly
> resp.
> \tabFullNotation, so if the user doesn't call one of these commands, the
> clef
> selection mechanism won't work. Is there a workaround, or - even better -
> can \tabNumbersOnly be invoked automatically when tablature.ly is included?
> This doesn't alter the defaults for older files but would give the desired
> functionality
> (i.e. numbers only) for tablature users.

You could place all the default overrides inside a \layout block, in
the same manner as the settings for TabVoice are done in
engraver-init.ly.

> Anyway, when I put all the pieces together, lilypond still complains about
> not finding
> "markup.moderntab", so I have made some mistakes.

Only the string matching, so you've done really well all things considered.

Regards,
Neil


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


Re: tablature.ly

2009-05-02 Thread Marc Hohl

Thank you, Carl and Neil, for your answers.

Neil Puttock schrieb:

2009/4/30 Carl D. Sorensen :
  

On 4/30/09 1:36 AM, "Marc Hohl"  wrote:



I tried to cons these values, and I succeded (or at least it seemed to
me) for the
supported-clefs list, but not with the c0-pitch-alist
(see attached files and lilypond's error messages).
Is this list only locally defined, or am I missing something?
  

You are correct.  c0-pitch-alist is not public.  So it's currently not
possible to cons a value in with the tablature.ly file.



Oops. :)

Sorry Marc, I didn't notice that.  I ran a quick test by amending
parser-clef.scm, so I hadn't actually tried consing values.
  

Never mind. It is kind of reassuring to see that making mistakes is not
completely my domain ;-)
  

My recommendation is that you pursue option c.  The disadvantage of pursuing
option c is that it won't be available to others until a new release of
LilyPond is issued.



I agree, that seems the best option for the moment.

  

Ok, so I inserted the following lines in my scm/parser-clef.scm:

;; a function to add new clefs at runtime
(define-public (add-new-clef clef-name clef-glyph clef-position 
octaviation c0-position)
 "Append the entries for a clef symbol to supported clefs and 
c0-pitch-alist"

 (set! supported-clefs
   (acons clef-name (list clef-glyph clef-position octaviation) 
supported-clefs))

 (set! c0-pitch-alist
   (acons clef-glyph c0-position c0-pitch-alist)))

[ I don't know if everything is correct, see below, but when everything 
works, I'll send patches.]

At a later date, we might consider moving the clef callbacks in
clef.cc to scheme completely, so you'd be able to incorporate the
conditional code for modern tabs directly into the clef::print
callback.

  

Define a new Scheme function to be used as the Clef 'stencil property

(define (newClefPrint grob) )



I suggest something like `clef::print-modern-tab-if-set' to follow
LilyPond coding style.

  

It should check for the 'glyph property of the grob, and if it's
markup.moderntab, it will call the new tab markup function.  Otherwise, it
will call (ly:clef::print grob).


I tried to follow your suggestions, and after some trial and error, I have
rearranged my tablature.ly as follows (see attachment):

#(add-new-clef "moderntab" "markup.moderntab" 0 0 0)

% this function decides which clef to take
#(define (clef::print-modern-tab-if-set grob)
   (let* ((glyph (ly:grob-property grob 'glyph)))
 (if (eq? glyph "markup.moderntab")
 (ly:modern-tab-clef::print grob)
 (ly:clef::print grob


#(define (ly:modern-tab-clef::print grob)
  (ly:grob-property grob 'staff-space 1)
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
(line-count   (ly:grob-property staff-symbol 'line-count))
(staff-space  (ly:grob-property staff-symbol 'staff-space)))
(grob-interpret-markup grob (make-customTabClef-markup 
line-count staff-space




Two further points:

Just to be on the safe side, when retrieving 'staff-space, a default
value should be given, since it's not normally set:

(ly:grob-property grob 'staff-space 1)
  
Is this line placed properly? I don't understand this quite right, does 
this line
define the default value if 'staff-space is not set at all and doesn't 
override 'staff-space

if it s set before?

As I mentioned previously, unless you want to code a smaller clef for
changes, you'll want to set 'full-size-change = ##t.  This will shut
up any complaints about missing a glyph for "markup.moderntab_change".
 You can set it within the new stencil callback using
ly:grob-set-property!:

(ly:grob-set-property! grob 'full-size-change #t)
  
Where have I to put this? I surely want changes to be enabled for the 
standard clefs,
so I have to put it after the comparison for "markup.moderntab". On the 
other hand,
when it's put too late, then 'glyph has the value 
"markup.moderntab_change", so the test for

"markup.moderntab" will fail.

And a final question:
I put the override for the TabStaff.Clef #'stencil into \tabNumbersOnly 
resp.
\tabFullNotation, so if the user doesn't call one of these commands, the 
clef

selection mechanism won't work. Is there a workaround, or - even better -
can \tabNumbersOnly be invoked automatically when tablature.ly is included?
This doesn't alter the defaults for older files but would give the 
desired functionality

(i.e. numbers only) for tablature users.

Anyway, when I put all the pieces together, lilypond still complains 
about not finding

"markup.moderntab", so I have made some mistakes.
Sorry to occupy your time so much, it is hard for me to learn basic 
scheme and lilypon

Re: tablature.ly

2009-04-30 Thread Neil Puttock
2009/4/30 Carl D. Sorensen :
>
> On 4/30/09 1:36 AM, "Marc Hohl"  wrote:
>
>> I tried to cons these values, and I succeded (or at least it seemed to
>> me) for the
>> supported-clefs list, but not with the c0-pitch-alist
>> (see attached files and lilypond's error messages).
>> Is this list only locally defined, or am I missing something?
>
> You are correct.  c0-pitch-alist is not public.  So it's currently not
> possible to cons a value in with the tablature.ly file.

Oops. :)

Sorry Marc, I didn't notice that.  I ran a quick test by amending
parser-clef.scm, so I hadn't actually tried consing values.

> My recommendation is that you pursue option c.  The disadvantage of pursuing
> option c is that it won't be available to others until a new release of
> LilyPond is issued.

I agree, that seems the best option for the moment.

At a later date, we might consider moving the clef callbacks in
clef.cc to scheme completely, so you'd be able to incorporate the
conditional code for modern tabs directly into the clef::print
callback.

> Define a new Scheme function to be used as the Clef 'stencil property
>
> (define (newClefPrint grob) )

I suggest something like `clef::print-modern-tab-if-set' to follow
LilyPond coding style.

> It should check for the 'glyph property of the grob, and if it's
> markup.moderntab, it will call the new tab markup function.  Otherwise, it
> will call (ly:clef::print grob).

Two further points:

Just to be on the safe side, when retrieving 'staff-space, a default
value should be given, since it's not normally set:

(ly:grob-property grob 'staff-space 1)

As I mentioned previously, unless you want to code a smaller clef for
changes, you'll want to set 'full-size-change = ##t.  This will shut
up any complaints about missing a glyph for "markup.moderntab_change".
 You can set it within the new stencil callback using
ly:grob-set-property!:

(ly:grob-set-property! grob 'full-size-change #t)

Regards,
Neil


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


Re: tablature.ly

2009-04-30 Thread Carl D. Sorensen



On 4/30/09 1:36 AM, "Marc Hohl"  wrote:

> [snip]
> 
> I have reworked my tablature.ly according to all suggestions and
> improvements by Neil and Carl.
> 
> The modern tab clef seems to be scaling properly, I played a bit with
> some values for staff-space,
> and it looks now as it should be (at least in my opinion). I have
> managed (with excessive help)
> to get the staff-space and the line-count from the staff-symbol
> property, so there is no more
> need for explicitly using the tuning as an argument for the clef functions.
> (And again, I have gained some more insight  in scheme and lilypond,
> thank you both!)
> 
> As Neil proposed, it should be possible to code
> 
> \clef tab
> 
> for the current calligraphic clef, and to write
> 
> \clef moderntab
> 
> for the sans serif-style clef for compatibility's sake.
> 
> This issue is beyond my abilities, so I call desperately for help ;-)
>> 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)
>>  
> I tried to cons these values, and I succeded (or at least it seemed to
> me) for the
> supported-clefs list, but not with the c0-pitch-alist
> (see attached files and lilypond's error messages).
> Is this list only locally defined, or am I missing something?

You are correct.  c0-pitch-alist is not public.  So it's currently not
possible to cons a value in with the tablature.ly file.

Your choices at this point are to
a) change the scm/parser-clef.scm file to (define-public c0-pitch-alist 
and keep the additions to the clef list in tablature.ly

b) hardcode the changes to supported-clefs and c0-pitch-alist in
scm/parser-clef.scm

c) add a scheme function (define-public (add-new-clef clef-name) )
to scm/parser-clef.scm.  This function would cons the new clef values onto
both lists.  And because the function is defined in scm/parser-clef.scm, it
will have access to c0-pitch-alist.  Then you would revise tablature.ly to
call add-new-clef to take care of things.

My recommendation is that you pursue option c.  The disadvantage of pursuing
option c is that it won't be available to others until a new release of
LilyPond is issued.

However, the existing tablature.ly file that you posted to the list works
for 2.12, so that will meet the needs of those users.  And you will have
made the changes to scm/parser-clef.scm on your system, so you'll have it
available for your use.  And you can post a patch that those who are
interested can use to make changes to their own version of
scm/parser-clef.scm.

All in all, I'd say go ahead with the new function in scm/parser-clef.scm
and modify tablature.ly to work with the new function.


> 
> In my opinion, as tablature.ly is meant to be included by the user, not
> by default,
> the changings in these lists should be done within tablature.ly, if this
> is possible.

You can also think about splitting tablature.ly into tablature-init.ly which
will be always be run, and tablature.ly which will only be run if the user
includes it.  That's the way predefined-fretboards works.

>> 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.
>> 
>>  
> How can I achieve this?

Define a new Scheme function to be used as the Clef 'stencil property

(define (newClefPrint grob) )

It should check for the 'glyph property of the grob, and if it's
markup.moderntab, it will call the new tab markup function.  Otherwise, it
will call (ly:clef::print grob).


Hope this helps,

Carl



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


Re: tablature.ly

2009-04-30 Thread Marc Hohl

[snip]

I have reworked my tablature.ly according to all suggestions and 
improvements by Neil and Carl.


The modern tab clef seems to be scaling properly, I played a bit with 
some values for staff-space,
and it looks now as it should be (at least in my opinion). I have 
managed (with excessive help)
to get the staff-space and the line-count from the staff-symbol 
property, so there is no more

need for explicitly using the tuning as an argument for the clef functions.
(And again, I have gained some more insight  in scheme and lilypond, 
thank you both!)


As Neil proposed, it should be possible to code

\clef tab

for the current calligraphic clef, and to write

\clef moderntab

for the sans serif-style clef for compatibility's sake.

This issue is beyond my abilities, so I call desperately for help ;-)

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)
  
I tried to cons these values, and I succeded (or at least it seemed to 
me) for the

supported-clefs list, but not with the c0-pitch-alist
(see attached files and lilypond's error messages).
Is this list only locally defined, or am I missing something?

In my opinion, as tablature.ly is meant to be included by the user, not 
by default,
the changings in these lists should be done within tablature.ly, if this 
is possible.

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.

  

How can I achieve this?

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

  


Thanks for your help!

Marc
 tablature.ly

 source file of the GNU LilyPond music typesetter

 (c) 2009 Marc Hohl 


% some publications use the triangled note head 
% for palm mute, so here we go:
palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 do) }
palmMuteOff = { \unset shapeNoteStyles }
% for single notes (or groups of notes within { ...} :
palmMute =  #(define-music-function (parser location notes) (ly:music?)
  #{
 \palmMuteOn $notes \palmMuteOff
  #})

% x-tab-format uses a "x" instead of the fret number:
#(define (x-tab-format str context event)
(make-whiteout-markup
  (make-vcenter-markup
(markup #:musicglyph "noteheads.s2cross"

% dead notes are marked with a cross-shape note head,
% both in normal notation and in tablature:
deadNotesOn = {
   \override NoteHead #'style = #'cross
   \set tablatureFormat = #x-tab-format
}
deadNotesOff = {
   \unset tablatureFormat
   \revert NoteHead #'style
}
% for single notes or groups of notes within {...}:
deadNotes = #(define-music-function (parser location notes) (ly:music?)
   #{
  \deadNotesOn  $notes \deadNotesOff
   #})
%
%
% for testing purposes only
#(display "supported-clefs before:")
#(newline)
#(display supported-clefs)
#(newline)
#(display "c0-pitch-alist before:")
#(newline)
#(display c0-pitch-alist)
#(newline)
#(define-public supported-clefs (cons '("moderntab" . ("markup.moderntab" 0 0)) 
supported-clefs))
#(define c0-pitch-alist (cons '("markup.moderntab" . 0) c0-pitch-alist))
#(display "supported-clefs after:")
#(newline)
#(display supported-clefs)
#(newline)
#(display "c0-pitch-alist after:")
#(newline)
#(display c0-pitch-alist)
#(newline)
% define sans serif-style tab-Clefs as a markup:
#(define-markup-command (customTabClef layout props num-strings staff-space) 
(integer? number?)
(define (square x) (* x x))
(let* ((scale-factor (/ staff-space 1.5))
   (font-size (- (* num-strings 1.5 scale-factor) 7))
   (base-skip (* (square (+ (* num-strings 0.195) 0.4)) scale-factor)))
   ;;(display "font-size:")(display font-size)(newline)
   (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")

% Wrappers for the different clefs
% the argument is the string-tuning, which is automatically set.
sansSerifTabClef = #(define-music-function (parser location) ()
   #{
  \override TabStaff.Clef #'stencil = $(lambda (grob)
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
 (line-co

Re: tablature.ly

2009-04-29 Thread Carl D. Sorensen



On 4/29/09 3:12 AM, "Marc Hohl"  wrote:

> Neil Puttock schrieb:
>> 2009/4/27 Carl D. Sorensen :
>>  
>>> Neil,
>>> 
>>> Thanks for your input.  I think it's all really good.
>>> 
>>> 
>>> On 4/26/09 1:49 PM, "Neil Puttock"  wrote:
>>> 
>>>
 2009/4/25 Marc Hohl :
  
>>> 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!

See below for my comment.

>>> 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?
> 

This was meant to be applied along with Neil's earlier comment about
changing from using ly:text-interface::print for the 'stencil to using
grob-interpret-markup.  I've included his comments below:

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

When you define 'stencil to be a function of some object  (lambda(grob) is a
function with one parameter), LilyPond will call that function with the
parameter of the grob that is supposed to be printed -- in this case, the
clef.  So then, grob will exist and will have the capability of learning
about both 'line-count and 'staff-space.

If this doesn't point you in the right direction, please let me know.

Thanks again for doing this!

Carl



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


Re: tablature.ly

2009-04-29 Thread Marc Hohl

Marc Hohl schrieb:

Marc Hohl schrieb:

Neil Puttock schrieb:

2009/4/27 Carl D. Sorensen :
 

Neil,

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


On 4/26/09 1:49 PM, "Neil Puttock"  wrote:

  

2009/4/25 Marc Hohl :


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:

  


  

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


  
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


So finally, before starting cooking for my family :-),
I came up with this:

#(define-markup-command (customTabClef layout props num-strings 
staff-space)

Re: tablature.ly

2009-04-29 Thread Marc Hohl

Marc Hohl schrieb:

Neil Puttock schrieb:

2009/4/27 Carl D. Sorensen :
 

Neil,

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


On 4/26/09 1:49 PM, "Neil Puttock"  wrote:

   

2009/4/25 Marc Hohl :
 

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:

  


   

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


   
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 mean

Re: tablature.ly

2009-04-29 Thread Marc Hohl

Neil Puttock schrieb:

2009/4/27 Carl D. Sorensen :
  

Neil,

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


On 4/26/09 1:49 PM, "Neil Puttock"  wrote:



2009/4/25 Marc Hohl :
  

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:

  




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




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?

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
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: tablature.ly

2009-04-29 Thread Marc Hohl

Neil Puttock schrieb:

2009/4/27 Marc Hohl :

  

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.



Glad to help. :)

You're doing fine with Scheme so far.

  

Ok, #:column changed to #:center-column, I simply have overlooked this.



I've just remembered a quirk with this: you'll have to add
#:left-align before the #:center-column otherwise it causes a
misalignment with clefs in other staves.

  

Ok, I have added this.

Marc

Regards,
Neil

  




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


Re: tablature.ly

2009-04-28 Thread Neil Puttock
2009/4/27 Marc Hohl :

> 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?

Too many hashes:

#:override '(font-family . sans) or #:override (cons 'font-family 'sans)

#:override (cons 'baseline-skip base-skip) or #:override
`(baseline-skip . ,base-skip)


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

That works because changing the global staff size doesn't alter the
default staff-space. See what happens when you add the following
override:

\override TabStaff.StaffSymbol #'staff-space = #1.2

Regards,
Neil


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


Re: tablature.ly

2009-04-28 Thread Neil Puttock
2009/4/27 Marc Hohl :

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

Glad to help. :)

You're doing fine with Scheme so far.

> Ok, #:column changed to #:center-column, I simply have overlooked this.

I've just remembered a quirk with this: you'll have to add
#:left-align before the #:center-column otherwise it causes a
misalignment with clefs in other staves.

Regards,
Neil


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


Re: tablature.ly

2009-04-28 Thread Neil Puttock
2009/4/27 Carl D. Sorensen :
> Neil,
>
> Thanks for your input.  I think it's all really good.
>
>
> On 4/26/09 1:49 PM, "Neil Puttock"  wrote:
>
>> 2009/4/25 Marc Hohl :
>>> 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:
>>
> 
>>
>>>           (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.
>
> 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.
>
> 
>>
>>> 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)))

> 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
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: tablature.ly

2009-04-28 Thread Marc Hohl

Carl D. Sorensen schrieb:

[snip]
Try #'(cons 'font-family 'sans), and see if that will work.  It may be that
the way things are substituted by the macro expansion is causing it to work
differently than I would expect with straight Scheme.
  

Yes, it works. Great!
Thanks a lot, Carl.
  
 
  

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 )
and tried values from 10 to 100, and it worked as expected.
So the quadratic equation seems to be the right way.



OK, so the baseline skip is apparently sized in terms of staff spaces, which
means your equations are right.

Thanks,

Carl


  




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


Re: tablature.ly

2009-04-27 Thread Carl D. Sorensen



On 4/27/09 12:47 PM, "Marc Hohl"  wrote:

> Carl D. Sorensen schrieb:
>> 
>> On 4/27/09 3:38 AM, "Marc Hohl"  wrote:
>> 
>>  
> 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)

I thought that there should be no ' before (cons 'baseline-skip base-skip).
But apparently it works, so perhaps it's evaluated during the markup
interpretation.

The ' is a quote that prevents evaluation.  In this case, we want to
evaluate the expression, because we want to replace the symbol base-skip
with its value, which was assigned above.  But this apparently works with
the macro expansion.

>  #: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?

Try #'(cons 'font-family 'sans), and see if that will work.  It may be that
the way things are substituted by the macro expansion is causing it to work
differently than I would expect with straight Scheme.

> 
>>  
 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 )
> and tried values from 10 to 100, and it worked as expected.
> So the quadratic equation seems to be the right way.

OK, so the baseline skip is apparently sized in terms of staff spaces, which
means your equations are right.

Thanks,

Carl



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


Re: tablature.ly

2009-04-27 Thread Marc Hohl

Carl D. Sorensen schrieb:


On 4/27/09 3:38 AM, "Marc Hohl"  wrote:

  

Neil Puttock schrieb:


2009/4/25 Marc Hohl :
 
  


  

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


  




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


Re: tablature.ly

2009-04-27 Thread Carl D. Sorensen



On 4/27/09 3:38 AM, "Marc Hohl"  wrote:

> Neil Puttock schrieb:
>> 2009/4/25 Marc Hohl :
>>  

>>>   (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")


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

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



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


Re: tablature.ly

2009-04-27 Thread Marc Hohl

Neil Puttock schrieb:

2009/4/25 Marc Hohl :
  

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 

Re: tablature.ly

2009-04-26 Thread Carl D. Sorensen
Neil,

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


On 4/26/09 1:49 PM, "Neil Puttock"  wrote:

> 2009/4/25 Marc Hohl :
>> 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:
> 

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

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.


> 
>> 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?

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.

Thanks for your help and insight,

Carl


Marc,

Can you revise your code according to Neil's recommendations and make me a
new patch?

Thanks,

Carl



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


Re: tablature.ly

2009-04-26 Thread Neil Puttock
2009/4/25 Marc Hohl :
> 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))

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

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

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

>           (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)?

> % 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
>   #})

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.

Regards,
Neil


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


Re: tablature.ly

2009-04-25 Thread Carl D. Sorensen
Looks great, Marc!  *Very* nicely done.


On 4/25/09 4:06 AM, "Marc Hohl"  wrote:

> Hello tablature users*,
> 

> 
> 3) some more tunings are defined:
>guitar-seven-string-tuning
>guitar-drop-d-tuning
>bass-four-string-tuning
>bass-drop-d-tuning
>bass-five-string-tuning
>bass-six-string-tuning
>(yes I know, the already defined "bass-tuning" is the same as my
> "bass-four-string-tuning", but
> as I write music for various basses, this is easier to read at first
> glance.)

As your comment indicates, you will want to move these to
scm/output-lib.scm.  When you are up to speed on git, please do so.

Once you send me a patch, I'll check it and push to git, and it will become
part of LilyPond.

Oh, by the way, you will want to make a standard LilyPond comment block at
the top of the file -- see existing files for a pattern.

> 
> 4) commandos for palm mute playing and dead notes are supported (palm
> mute is not a tablature-specific
>issue, but as electric guitar players use tablature and often play
> palm mute, I think this is ok).
>At first I thought of using \x for dead notes, but in other threads
> \x is used for almost everything,
>so I leave it to the user to say x = \deadNotes and use \x for faster
> typing myriads of dead notes :-)

This is exactly the right thing to do.  LilyPond defined functions should
always be descriptive.  If users want the convenience of defining a
shortcut, it's quite easy to do so.

> 
> Yet again, I would like to thank Carl for his great help and patience,
> and as far as I can see now,
> making contributions to lilypond is easier than one might think, there
> are a lot of people outside
> willing to help you, if you are willing to bring lilypond further on, so
> give it a try!
> 

You're very welcome.  It's always a pleasure to help somebody who is
learning to contribute!

Thanks,

Carl



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


Re: tablature.ly

2009-04-25 Thread Marc Hohl

Jonathan Kulp schrieb:

Jonathan Kulp wrote:
octave.  I think there were only two examples in tablature.ly that 
didn't use the "treble_8" clef for guitar. All the other clefs 
(including the "bass_8" for bass guitar) were correct.


Sorry I meant to say in "tablature-test1.ly"

Jon
Yes, you are right. In the first two lines, I forgot the octaviation 
sign. But I think, this example will

never be played on a guitar ;-)

Marc



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


Re: tablature.ly

2009-04-25 Thread Jonathan Kulp

Jonathan Kulp wrote:
octave.  I think there were only two examples in tablature.ly that 
didn't use the "treble_8" clef for guitar. All the other clefs 
(including the "bass_8" for bass guitar) were correct.


Sorry I meant to say in "tablature-test1.ly"

Jon
--
Jonathan Kulp
http://www.jonathankulp.com


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


Re: tablature.ly

2009-04-25 Thread Jonathan Kulp

Grammostola Rosea wrote:

Marc Hohl wrote:

Hello tablature users*,

after some days of struggling with lilypond's internals, I have 
created a file tablature.ly



Wow, I am very happy about this! I'm gonna test it for sure.

Thanks Marc and Carl!

@David could you  make some progress with the bends and stuff?

Kind regards,

\r



Well done, Marc & Carl!  I don't use tab either, but I'm a guitarist and 
appreciate the new features from that standpoint.


My only comment would be that whenever traditional staff and tabstaff 
are presented together, it's best to use the "treble_8" clef for the 
regular staff so that the notes appear in the right place on the staff, 
the tab has the correct indications, and the midi output is in the right 
octave.  I think there were only two examples in tablature.ly that 
didn't use the "treble_8" clef for guitar. All the other clefs 
(including the "bass_8" for bass guitar) were correct.


Thanks for the great work, guys!

Jon
--
Jonathan Kulp
http://www.jonathankulp.com


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


Re: tablature.ly

2009-04-25 Thread Graham Percival
On Sat, Apr 25, 2009 at 12:06:07PM +0200, Marc Hohl wrote:
> after some days of struggling with lilypond's internals, I have created  
> a file tablature.ly

Fantastic work!  This is exactly the kind of thing I was hoping
would happen.  Not from a tab-specific viewpoint, but from a
general "getting more people involved in lilypond" standpoint.

I know Marc already knows this, but I want to add emphasis:

- this is a self-contained file; people who want test/use it just
  need to download it and add the \include.

- this requires ZERO compiling of lilypond.  Granted, some
  additions /will/ require C++ hacking... but a lot of things can
  be done in scheme only.

Cheers,
- Graham


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


Re: tablature.ly

2009-04-25 Thread Grammostola Rosea

Marc Hohl wrote:

Hello tablature users*,

after some days of struggling with lilypond's internals, I have 
created a file tablature.ly



Wow, I am very happy about this! I'm gonna test it for sure.

Thanks Marc and Carl!

@David could you  make some progress with the bends and stuff?

Kind regards,

\r



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


tablature.ly

2009-04-25 Thread Marc Hohl

Hello tablature users*,

after some days of struggling with lilypond's internals, I have created 
a file tablature.ly

which supports:

1) two commands to switch between the display style:
  \tabNumbersOnly shows only the mubers,
  \tabFullNotation shows up everything (as it is the default in 
\TabVoice upto now)


2) two commands for the possible clefs:
  \calligraphicTabClef #
  \sansSerifTabClef #
  (I didn't like "modern" or "old" clef, so I used commands which 
describe the apperance

  of the clefs).
  The sans serif clef is available for 4 to 7 strings. It internally sets
  \TabStaff.stringTunings to .

3) some more tunings are defined:
  guitar-seven-string-tuning
  guitar-drop-d-tuning  
  bass-four-string-tuning   
  bass-drop-d-tuning   
  bass-five-string-tuning   
  bass-six-string-tuning
  (yes I know, the already defined "bass-tuning" is the same as my 
"bass-four-string-tuning", but
   as I write music for various basses, this is easier to read at first 
glance.)


4) commandos for palm mute playing and dead notes are supported (palm 
mute is not a tablature-specific
  issue, but as electric guitar players use tablature and often play 
palm mute, I think this is ok).
  At first I thought of using \x for dead notes, but in other threads 
\x is used for almost everything,
  so I leave it to the user to say x = \deadNotes and use \x for faster 
typing myriads of dead notes :-)


I post this along with a test file, so you can check this out.

*Carl, which isn't really a tablature user, has given me a lot of 
support an insight to lilypond,
and he proposed to include tablature.ly in future releases of lilypond, 
so this would be the place to
go for further development (bendings, etc.). Establishing 
\tabNumbersOnly as a standard would mean to
break with older versions, but as it is a single command, this should 
not be considered as a serious

drawback.

As there are more people invoved in developing tablature extensions for 
lilypond, I send tablature.ly
to this list for testing purposes, so changes, corrections etc. could be 
discussed before establishing
the file in future versions. As I said before, it is just a starting 
point, any suggestions, improvements
etc. are welcome. Are there other tunings we should consider being 
defined internally?


Yet again, I would like to thank Carl for his great help and patience, 
and as far as I can see now,
making contributions to lilypond is easier than one might think, there 
are a lot of people outside
willing to help you, if you are willing to bring lilypond further on, so 
give it a try!


Greetings,

Marc
% tablature.ly

% these definitions will be moved to scm/output-lib.scm
#(define-public guitar-seven-string-tuning '(4 -1 -5 -10 -15 -20 -25))
#(define-public guitar-drop-d-tuning   '(4 -1 -5 -10 -15 -22))
#(define-public bass-four-string-tuning'(-17 -22 -27 -32))
#(define-public bass-drop-d-tuning '(-17 -22 -27 -34))
#(define-public bass-five-string-tuning'(-17 -22 -27 -32 -37))
#(define-public bass-six-string-tuning '(-12 -17 -22 -27 -32 -37))



% some publications use the triangled note head 
% for palm mute, so here we go:
palmMuteOn = { \set shapeNoteStyles = #'#(do do do do do do 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
  #})

% x-tab-format uses a "x" instead of the fret number:
#(define (x-tab-format str context event)
(make-whiteout-markup
  (make-vcenter-markup
(markup #:musicglyph "noteheads.s2cross"

% dead notes are marked with a cross-shape note head,
% both in normal notation and in tablature:
deadNotesOn = { 
   \override NoteHead #'style = #'cross
   \set tablatureFormat = #x-tab-format
}
deadNotesOff = {
   \unset tablatureFormat
   \revert NoteHead #'style
}
% 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
   #})

% define sans serif-style tab-Clefs according to
% http://lsr.dsi.unimi.it/LSR/Item?id=323
% for 4, 5, 6 and 7 strings

#(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)))
   (raise-value (- (* num-strings 0.4) 0.9))
   (font-size (- (* num-strings 1