Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread tisimst
On 8/11/2015 1:12 PM, Dominic [via Lilypond] wrote:
> Thanks everyone!
>
> tisimst, I slightly modified your solution and it seems to work great 
> - thanks!
> For reasons I don't understand, it only changed the first StemTremolo 
> in my score, but when I changed 'after-line-breaking' to 
> 'before-line-breaking' it changed all of them.

Indeed, that is strange since it worked for me without fail, but I'm 
glad to hear you got something working for you!

- Abraham






--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/How-to-adjust-the-padding-between-a-StemTremolo-and-a-NoteHead-tp179448p179495.html
Sent from the User mailing list archive at Nabble.com.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Dominic
Thanks everyone!

tisimst, I slightly modified your solution and it seems to work great -
thanks!
For reasons I don't understand, it only changed the first StemTremolo in my
score, but when I changed 'after-line-breaking' to 'before-line-breaking' it
changed all of them.



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/How-to-adjust-the-padding-between-a-StemTremolo-and-a-NoteHead-tp179448p179494.html
Sent from the User mailing list archive at Nabble.com.

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Abraham Lee

On 8/11/2015 11:14 AM, tisimst wrote:

\layout {
  \override Voice.StemTremolo.after-line-breaking =
#(lambda (grob)
(let* ((*pad 1.0*) % <--- ADJUST THIS TO TASTE
   (cnt (ly:grob-property grob 'flag-count))
   (stem (ly:grob-object grob 'stem))
   (leng (ly:grob-property stem 'length)))
  (if (> cnt 2)
(ly:grob-set-property! stem 'length (+ leng pad)
}


Sorry, the % is going to cause an error because it isn't a scheme 
comment. Either change the "%" to a semicolon ";" or just remove my 
comment altogether.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread tisimst


On 8/11/2015 10:59 AM, Robin Bannister [via Lilypond] wrote:
> Malte Meyn wrote:
>
> > But unfortunately it doesn’t work properly in 2.19.24 (and 2.18.2)
>
> Yes, I think stems were reworked a lot around 2.16?
>
> Here is that override approach with a duration condition:
> ... (clipped) ...

Looking into the situation, I've found that there isn't a built-in 
collision avoidance value but rather a well-tuned set of spacing 
parameters (unless an actual beam exists, then collisions are taken care 
of). It's quite easy to have the tremolo flags of unbeamed stems cause 
collisions with the notehead:

\override Voice.StemTremolo.length-fraction = #1.5



Here's another option that works nicely by adjusting the value for "pad":

\layout {
   \override Voice.StemTremolo.after-line-breaking =
#(lambda (grob)
 (let* ((*pad 1.0*) % <--- ADJUST THIS TO TASTE
(cnt (ly:grob-property grob 'flag-count))
(stem (ly:grob-object grob 'stem))
(leng (ly:grob-property stem 'length)))
   (if (> cnt 2)
 (ly:grob-set-property! stem 'length (+ leng pad)
}



HTH,
Abraham


ajjgagfj.png (12K) 
<http://lilypond.1069038.n5.nabble.com/attachment/179490/0/ajjgagfj.png>
ahdacbjg.png (12K) 
<http://lilypond.1069038.n5.nabble.com/attachment/179490/1/ahdacbjg.png>




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/How-to-adjust-the-padding-between-a-StemTremolo-and-a-NoteHead-tp179448p179490.html
Sent from the User mailing list archive at Nabble.com.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Robin Bannister

Malte Meyn wrote:



But unfortunately it doesn’t work properly in 2.19.24 (and 2.18.2)



Yes, I think stems were reworked a lot around 2.16?

Here is that override approach with a duration condition:

%%

\version "2.18.0"

#(define (stem-stretch stem-tremolo-grob)
  (let ((flag-count (ly:grob-property stem-tremolo-grob 'flag-count)))
(if (> flag-count 2) 1 0)))

#(define (longer-for-tremolo stem-grob)
  (let* (
(stem-tremolo-grob (ly:grob-object stem-grob 'tremolo-flag))
(plain-stem? (< (ly:grob-property stem-grob 'duration-log) 8))
)
(+ (ly:stem::calc-length stem-grob)
  (if (and (ly:grob? stem-tremolo-grob) plain-stem?)
(stem-stretch stem-tremolo-grob) 0

music = \relative {
  b'1:32
  b2: b4: b8: b:
  b4:8 b:16 b:32 b:64
  b!2:32 b8:16 b: b: b:
  \tweak color #green b2:32 b
}

\markup "original LilyPond behaviour"
{ \music \stemUp \music }
\markup "longer-for-tremolo"
{ \override Stem.length = #longer-for-tremolo  \music \stemUp \music }

%%


Cheers,
Robin

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Malte Meyn

Am 11.08.2015 um 16:13 schrieb Robin Bannister:


This discussion of a similar (outdated?) attempt might be useful:

http://www.lilypondforum.de/index.php?topic=415.msg2425;topicseen#msg2425



This looks nice! I didn’t really like the idea of having to use a music 
function to do that … And of course it’s nice to modify the grobs 
instead of having to go through


But unfortunately it doesn’t work properly in 2.19.24 (and 2.18.2): The 
stem lengths/tremolo positions are corrected but the stems themselves 
disapper :o And it breaks when there are stems on beams. (My solution 
would do this too if used on eigths, but it stretches only half and 
quarter note stems; eigths with flags are no problem because of the 
different slant of the tremolo beams.)


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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Robin Bannister

  Malte Meyn wrote:


But I already have an idea how to improve this



This discussion of a similar (outdated?) attempt might be useful:

http://www.lilypondforum.de/index.php?topic=415.msg2425;topicseen#msg2425


Cheers,
Robin

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Malte Meyn

Am 11.08.2015 um 13:52 schrieb Malte Meyn:

might break soon; sorry for that, maybe it
could be improved.


For example, \unstrangleTremolos g'''2:32 extends the stem without need. 
But I already have an idea how to improve this: Don’t completely rely on 
ly:stem::calc-length but maybe do something like (pseudocode)


number-of-beams = log2(tremolo-type)
new_length = min(calc-length, some-constant-value + number-of-beams)

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Malte Meyn

Am 11.08.2015 um 10:00 schrieb Robin Bannister:

  Dominic wrote:

hoist = % for moving StemTremolo beams further from notehead
{
   \once \override Stem.length =
   #(lambda (grob) (+ 1 (ly:stem::calc-length grob)))
}



I made a scheme function from this that extends stems of quarter and 
half notes if they have a tremolo of 32nd or shorter notes (see 
attachment). Because I don’t know scheme well this looks like sort of 
spaghetti code to me and might break soon; sorry for that, maybe it 
could be improved.



Comment indicates I had reservations about 'unpure only'.
Someone else might be able to explain that.



I don’t know what this is so I don’t understand David’s answer. I read 
NR 5.5.5 but I don’t see how this has to do with our problem …
\version "2.19.24"

% ideas found at
% http://www.lilypondforum.de/index.php?topic=1734.msg9614#msg9614
% http://lsr.di.unimi.it/LSR/Item?id=884
unstrangleTremolos =
#(define-music-function (music) (ly:music?)
   (music-map
(lambda (m)
  (if (music-is-of-type? m 'note-event)
  (let*
   ((a (ly:music-property m 'articulations))
(d (ly:music-property m 'duration))
(r (filter
(lambda (v)
  (eq? (ly:music-property v 'name) 'TremoloEvent))
a))
(t (if (null? r) #f (car r
   (if (and (> (ly:duration-log d) 0) (< (ly:duration-log d) 3))
   (if (and t (> (ly:music-property t 'tremolo-type) 16))
   (begin
(ly:music-set-property! m 'tweaks
  (append
   (ly:music-property m 'tweaks)
   (list (cons (cons (quote Stem) (quote length))
   (lambda (grob) (+ 1 (ly:stem::calc-length grob)))
m)
   m)
   m))
  m))
music))

music = \relative {
  b'1:32
  b2: b4: b8: b:
  b4:8 b:16 b:32 b:64
  b!2:32 b8:16 b: b: b:
  \tweak color #green b2:32 b
}

\markup "original LilyPond behaviour"
{ \music \stemUp \music }
\markup "“unstrangled”"
% Does anyone know a better word? I used this because with original behaviour
% some notes look like they were strangled by the tremolo.
\unstrangleTremolos { \music \stemUp \music }

unstrangleTremolos.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread David Kastrup
Robin Bannister  writes:

>  Dominic wrote:
>
>> At the moment I have to laboriously override the Stem.length-fraction on an
>> individual basis, depending on how many slashes there are, which is not
>> ideal.
>>
>> Any ideas?
>
>
> I had this problem recently and worked around it with
>
> hoist = % for moving StemTremolo beams further from notehead
> {
>   \once \override Stem.length =
>   #(lambda (grob) (+ 1 (ly:stem::calc-length grob)))
> }
>
> Comment indicates I had reservations about 'unpure only'.
> Someone else might be able to explain that.

Well, most such reservations should be addressable by putting a
container around, in this case

hoist = % for moving StemTremolo beams further from notehead
{
  \once \override Stem.length =
  #(ly:make-unpure-pure-container
 (lambda (grob) (+ 1 (ly:stem::calc-length grob
}


-- 
David Kastrup

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-11 Thread Robin Bannister

 Dominic wrote:


At the moment I have to laboriously override the Stem.length-fraction on an
individual basis, depending on how many slashes there are, which is not
ideal.

Any ideas?



I had this problem recently and worked around it with

hoist = % for moving StemTremolo beams further from notehead
{
  \once \override Stem.length =
  #(lambda (grob) (+ 1 (ly:stem::calc-length grob)))
}

Comment indicates I had reservations about 'unpure only'.
Someone else might be able to explain that.


Cheers,
Robin

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


Re: How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-10 Thread Malte Meyn

Am 11.08.2015 um 01:06 schrieb Dominic:

With one slash or two slashes, everything looks fine, but with three or more
slashes, the gap between the top of the NoteHead and the bottom of the
StemTremolo (illustrated with red lines in my image) is too narrow for my
liking.


I agree on that but I haven’t found a solution yet. For beams there is 
the property alist 'details that seems to make similar things possible 
but this doesn’t exist for stem tremolos. (And apart from that, the 
meaning of the twelve details is not documented so I’ve no idea what one 
would have to change exactly.)


The gap is not only very small but sometimes definitely *too* small so 
that there are collisions. I posted to the bug-lilypond list:

https://lists.gnu.org/archive/html/bug-lilypond/2015-07/msg00067.html
but there was only one answer saying that this is similar to issue 3143 
which I don’t agree to (issue 3143 is about beam grobs, not stem tremlo 
grobs).


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


How to adjust the padding between a StemTremolo and a NoteHead?

2015-08-10 Thread Dominic
Hi all,

Consider the following tiny example:

/\version "2.19.23"
\relative c' { \time 6/4 4 q:8 q:16 q:32 q:64 q:128 }/

and its output:
<http://lilypond.1069038.n5.nabble.com/file/n179448/StemTremolo.png> 

With one slash or two slashes, everything looks fine, but with three or more
slashes, the gap between the top of the NoteHead and the bottom of the
StemTremolo (illustrated with red lines in my image) is too narrow for my
liking. There is clearly some kind of minimum distance that Lilypond is
obeying, but I can't figure out what it is or how to adjust it. I have
looked through the Internals reference and played around with several
properties but without finding a universal solution. Is it a property of the
NoteHead, the Stem, or the StemTremolo?

At the moment I have to laboriously override the Stem.length-fraction on an
individual basis, depending on how many slashes there are, which is not
ideal.

Any ideas?

Thanks,

Dominic



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/How-to-adjust-the-padding-between-a-StemTremolo-and-a-NoteHead-tp179448.html
Sent from the User mailing list archive at Nabble.com.

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