Re: Scheme problem?

2015-02-16 Thread takumi ikeda
I wrote this finally. Thank you for suggestion.
T

\version 2.18.2

tremps = #
1.5 setlinewidth
0.08 0.08 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke


#(define (z-trem grob)
   (let* (
   (gstem (ly:grob-parent grob X))
   (gnotehead (ly:grob-property gstem 'cause))
   (dur (ly:grob-property gnotehead 'duration-log))
   (dir (ly:grob-property grob 'direction))

   ;;offset value
   (ofs (if (= 1 dir) -1 1))
   (ofs (if (= 0 dur) 0 ofs))
   )

 (display ofs)
 (newline)

 (grob-interpret-markup grob
   (markup (
 #:translate (cons 0 ofs)
 #:postscript tremps
 ))
   )
 ))

\score {
  \transpose c c' {
\override Flag #'stencil = #modern-straight-flag
\override Stem #'length = #10
\override StemTremolo #'stencil = #z-trem

c1:64 c8: c4: c16: c4: c8: c16: c8:
\transpose c c' {
  c1:64 c8: c4: c16: c4: c8: c16: c8:
  \transpose c c' {
c1:64 c8: c4: c16: c4: c8: c16: c8:
  }
}
  }
}

2015-02-13 6:58 GMT+09:00 Simon Albrecht simon.albre...@mail.de:
 Am 12.02.2015 um 17:00 schrieb takumi ikeda:

 Hi Kevin,
 Thank you for your reply. But the part of (if (= UP dir) -0.5 0.5)
 seems to not working...

 BTW, How can I learn the syntax like (ly:duration-log
 (ly:music-property music 'duration))? I found the documentation
 lilypond.org/doc/v2.19/Documentation/internals/scheme-functions but it
 says only Function: ly:duration-log dur. Is dur an data type?
 Where is the reference of dur?

 dur serves as a placeholder for an argument. You should find it again in
 the explanatory text on the function, which is sometimes very short. In
 fact, the argument referenced here as dur is of type ly:duration? - that's
 the data type. Durations may be created through the scheme function
 ly:make-duration.

 HTH, Simon


 2015-02-12 22:13 GMT+09:00 Kevin Barry barr...@gmail.com:

 Hi Takumi,

 Is this what you want?

 \version 2.18.2

 tremps = #
 2 setlinewidth
 0.07 0.07 scale
 -10 7 moveto
 -5 3 5 3 10 7 curveto
 -10 -7 lineto
 -5 -3 5 -3 10 -7 curveto
 stroke
 

 z-trem =
 #(define-music-function (parser location music) (ly:music?)
 #{
   \override StemTremolo.stencil =
   #(lambda (grob)
  (let* (
  (dur-log (ly:duration-log (ly:music-property music
 'duration)))
  (dir (ly:grob-property grob 'direction))
  )
(grob-interpret-markup grob
  (markup
   (
 #:translate (cons 0 (if (= 0 dur-log)
 0
 (if (= UP dir) -0.5 0.5)))
 #:postscript tremps
 )
   )
  )
)
  )
   $music
 #}
 )


 \new Staff {
\z-trem
c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
 }

 On Thu, Feb 12, 2015 at 12:44 PM, takumi ikeda i...@de-dicto.net wrote:

 Hello all,

 I am trying the following code but I got Wrong type: () error.
 I would like to avoid translating tremolos when the note is whole note.
 Writing Scheme is quite difficult for me. Any help would be appreciated.

 Takumi

 \version 2.18.2

 tremps = #
 2 setlinewidth
 0.07 0.07 scale
 -10 7 moveto
 -5 3 5 3 10 7 curveto
 -10 -7 lineto
 -5 -3 5 -3 10 -7 curveto
 stroke
 

 z-trem =
 #(define-music-function (parser location music) (ly:music?)
 #{
   \override StemTremolo.stencil =
   #(lambda (grob)
  (let* (
  (dur-log (ly:grob-property grob 'duration-log))
  (dir (ly:grob-property grob 'direction))
  )
(grob-interpret-markup grob
  (markup
   (
 #:translate (cons 0 (if (= 0 dur-log) 0
 (if (= UP dir) -0.5 0.5)))
 #:postscript tremps
 )
   )
  )
)
  )
   $music
 #}
 )


 \new Staff {
\z-trem
c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
 }

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


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



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


Re: Scheme problem?

2015-02-12 Thread Simon Albrecht

Am 12.02.2015 um 17:00 schrieb takumi ikeda:

Hi Kevin,
Thank you for your reply. But the part of (if (= UP dir) -0.5 0.5)
seems to not working...

BTW, How can I learn the syntax like (ly:duration-log
(ly:music-property music 'duration))? I found the documentation
lilypond.org/doc/v2.19/Documentation/internals/scheme-functions but it
says only Function: ly:duration-log dur. Is dur an data type?
Where is the reference of dur?
“dur” serves as a placeholder for an argument. You should find it again 
in the explanatory text on the function, which is sometimes very short. 
In fact, the argument referenced here as “dur” is of type ly:duration? – 
that’s the data type. Durations may be created through the scheme 
function ly:make-duration.


HTH, Simon


2015-02-12 22:13 GMT+09:00 Kevin Barry barr...@gmail.com:

Hi Takumi,

Is this what you want?

\version 2.18.2

tremps = #
2 setlinewidth
0.07 0.07 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke


z-trem =
#(define-music-function (parser location music) (ly:music?)
#{
  \override StemTremolo.stencil =
  #(lambda (grob)
 (let* (
 (dur-log (ly:duration-log (ly:music-property music
'duration)))
 (dir (ly:grob-property grob 'direction))
 )
   (grob-interpret-markup grob
 (markup
  (
#:translate (cons 0 (if (= 0 dur-log)
0
(if (= UP dir) -0.5 0.5)))
#:postscript tremps
)
  )
 )
   )
 )
  $music
#}
)


\new Staff {
   \z-trem
   c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
}

On Thu, Feb 12, 2015 at 12:44 PM, takumi ikeda i...@de-dicto.net wrote:

Hello all,

I am trying the following code but I got Wrong type: () error.
I would like to avoid translating tremolos when the note is whole note.
Writing Scheme is quite difficult for me. Any help would be appreciated.

Takumi

\version 2.18.2

tremps = #
2 setlinewidth
0.07 0.07 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke


z-trem =
#(define-music-function (parser location music) (ly:music?)
#{
  \override StemTremolo.stencil =
  #(lambda (grob)
 (let* (
 (dur-log (ly:grob-property grob 'duration-log))
 (dir (ly:grob-property grob 'direction))
 )
   (grob-interpret-markup grob
 (markup
  (
#:translate (cons 0 (if (= 0 dur-log) 0
(if (= UP dir) -0.5 0.5)))
#:postscript tremps
)
  )
 )
   )
 )
  $music
#}
)


\new Staff {
   \z-trem
   c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
}

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



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



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


Re: Scheme problem?

2015-02-12 Thread Kevin Barry
Hi Takumi,

Is this what you want?

\version 2.18.2

tremps = #
2 setlinewidth
0.07 0.07 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke


z-trem =
#(define-music-function (parser location music) (ly:music?)
   #{
 \override StemTremolo.stencil =
 #(lambda (grob)
(let* (
(dur-log (ly:duration-log (ly:music-property music
'duration)))
(dir (ly:grob-property grob 'direction))
)
  (grob-interpret-markup grob
(markup
 (
   #:translate (cons 0 (if (= 0 dur-log)
   0
   (if (= UP dir) -0.5 0.5)))
   #:postscript tremps
   )
 )
)
  )
)
 $music
   #}
   )


\new Staff {
  \z-trem
  c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
}

On Thu, Feb 12, 2015 at 12:44 PM, takumi ikeda i...@de-dicto.net wrote:

 Hello all,

 I am trying the following code but I got Wrong type: () error.
 I would like to avoid translating tremolos when the note is whole note.
 Writing Scheme is quite difficult for me. Any help would be appreciated.

 Takumi

 

 \version 2.18.2

 tremps = #
 2 setlinewidth
 0.07 0.07 scale
 -10 7 moveto
 -5 3 5 3 10 7 curveto
 -10 -7 lineto
 -5 -3 5 -3 10 -7 curveto
 stroke
 

 z-trem =
 #(define-music-function (parser location music) (ly:music?)
#{
  \override StemTremolo.stencil =
  #(lambda (grob)
 (let* (
 (dur-log (ly:grob-property grob 'duration-log))
 (dir (ly:grob-property grob 'direction))
 )
   (grob-interpret-markup grob
 (markup
  (
#:translate (cons 0 (if (= 0 dur-log) 0
(if (= UP dir) -0.5 0.5)))
#:postscript tremps
)
  )
 )
   )
 )
  $music
#}
)


 \new Staff {
   \z-trem
   c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
 }

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

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


Re: Scheme problem?

2015-02-12 Thread takumi ikeda
Hi Kevin,
Thank you for your reply. But the part of (if (= UP dir) -0.5 0.5)
seems to not working...

BTW, How can I learn the syntax like (ly:duration-log
(ly:music-property music 'duration))? I found the documentation
lilypond.org/doc/v2.19/Documentation/internals/scheme-functions but it
says only Function: ly:duration-log dur. Is dur an data type?
Where is the reference of dur?

2015-02-12 22:13 GMT+09:00 Kevin Barry barr...@gmail.com:
 Hi Takumi,

 Is this what you want?

 \version 2.18.2

 tremps = #
 2 setlinewidth
 0.07 0.07 scale
 -10 7 moveto
 -5 3 5 3 10 7 curveto
 -10 -7 lineto
 -5 -3 5 -3 10 -7 curveto
 stroke
 

 z-trem =
 #(define-music-function (parser location music) (ly:music?)
#{
  \override StemTremolo.stencil =
  #(lambda (grob)
 (let* (
 (dur-log (ly:duration-log (ly:music-property music
 'duration)))
 (dir (ly:grob-property grob 'direction))
 )
   (grob-interpret-markup grob
 (markup
  (
#:translate (cons 0 (if (= 0 dur-log)
0
(if (= UP dir) -0.5 0.5)))
#:postscript tremps
)
  )
 )
   )
 )
  $music
#}
)


 \new Staff {
   \z-trem
   c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
 }

 On Thu, Feb 12, 2015 at 12:44 PM, takumi ikeda i...@de-dicto.net wrote:

 Hello all,

 I am trying the following code but I got Wrong type: () error.
 I would like to avoid translating tremolos when the note is whole note.
 Writing Scheme is quite difficult for me. Any help would be appreciated.

 Takumi

 

 \version 2.18.2

 tremps = #
 2 setlinewidth
 0.07 0.07 scale
 -10 7 moveto
 -5 3 5 3 10 7 curveto
 -10 -7 lineto
 -5 -3 5 -3 10 -7 curveto
 stroke
 

 z-trem =
 #(define-music-function (parser location music) (ly:music?)
#{
  \override StemTremolo.stencil =
  #(lambda (grob)
 (let* (
 (dur-log (ly:grob-property grob 'duration-log))
 (dir (ly:grob-property grob 'direction))
 )
   (grob-interpret-markup grob
 (markup
  (
#:translate (cons 0 (if (= 0 dur-log) 0
(if (= UP dir) -0.5 0.5)))
#:postscript tremps
)
  )
 )
   )
 )
  $music
#}
)


 \new Staff {
   \z-trem
   c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
 }

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



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


Re: scheme problem: colored background, layers

2014-12-06 Thread Big Noise

Hi guys,

...always open for new challenges...
I've opened a new thread for this new subject:
http://lists.gnu.org/archive/html/lilypond-user/2014-12/msg00112.html
Thanks to Urs and Malte for your ideas.

Cheers,
Klaus


Am 04.12.2014 um 18:01 schrieb lilypond-user-requ...@gnu.org:

From: Malte Meyn To: lilypond-user@gnu.org Subject: Re: scheme problem: 
colored background, layers Am 04.12.2014 um 00:13 schrieb Urs Liska:



Am I seeing correctly that the arrows are coded with absolute
coordinates from their starting points (i.e. they wouldn't adapt to
layout changes)?
This is not at all diminishing your snippet, but it would be absolutely
awesome if someone could extend this to override the stencil of, say, a
slur, so the arrows would snap to two notes.


Probably a glissando or a voice follower (both engraved by the
Note_head_line_engraver) would be better/easier to reuse than a slur
since these arrws look like some sort of ?voice following? ;)


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


Re: scheme problem: colored background, layers

2014-12-04 Thread Malte Meyn



Am 04.12.2014 um 00:13 schrieb Urs Liska:


Am I seeing correctly that the arrows are coded with absolute
coordinates from their starting points (i.e. they wouldn't adapt to
layout changes)?
This is not at all diminishing your snippet, but it would be absolutely
awesome if someone could extend this to override the stencil of, say, a
slur, so the arrows would snap to two notes.

Probably a glissando or a voice follower (both engraved by the 
Note_head_line_engraver) would be better/easier to reuse than a slur 
since these arrws look like some sort of “voice following” ;)


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


Re: scheme problem: colored background, layers

2014-12-03 Thread Big Noise

Hi everybody,

now I could finish two scores that have been waiting for that colored 
background trick. Maybe they are somewhat extreme examples...

If anyone is interested:
http://jkg-musik.jimdo.com/lilypond

For the colored arrows from the second example, I've created a snippet 
as well:

http://lsr.di.unimi.it/LSR/Item?u=1id=961

Cheers,
Klaus

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


Re: scheme problem: colored background, layers

2014-12-03 Thread Urs Liska


Am 03.12.2014 22:31, schrieb Big Noise:

Hi everybody,

now I could finish two scores that have been waiting for that colored 
background trick. Maybe they are somewhat extreme examples...

If anyone is interested:
http://jkg-musik.jimdo.com/lilypond


This is absolutely great!
I think this would be a good item for http://lilypond.org/examples.html.

Otherwise it'd be cool if you could write something on Scores of Beauty 
about it.





For the colored arrows from the second example, I've created a snippet 
as well:

http://lsr.di.unimi.it/LSR/Item?u=1id=961


Am I seeing correctly that the arrows are coded with absolute 
coordinates from their starting points (i.e. they wouldn't adapt to 
layout changes)?
This is not at all diminishing your snippet, but it would be absolutely 
awesome if someone could extend this to override the stencil of, say, a 
slur, so the arrows would snap to two notes.


Best
Urs



Cheers,
Klaus

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



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


Re: scheme problem: colored background, layers

2014-12-02 Thread Pierre Perol-Schneider
Add to the LSR : http://lsr.di.unimi.it/LSR/Item?id=960
Waiting for your comments.
Cheers,
Pierre

2014-12-02 7:25 GMT+01:00 Pierre Perol-Schneider 
pierre.schneider.pa...@gmail.com:

 Hum, interesting Klaus!
 I'll take a closer look today.
 Cheers,
 Pierre

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


Re: scheme problem: colored background, layers

2014-12-02 Thread Ben Big Noise
Wow - that's amazing. Having contributed to the LSR feels good :)

Thanks for adding and code optimizing.

Cheers, 
Klaus


Am 02.12.2014 um 09:41 schrieb Pierre Perol-Schneider 
Add to the LSR : http://lsr.di.unimi.it/LSR/Item?id=960

Waiting for your comments.

Cheers,

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


Re: scheme problem: colored background, layers

2014-12-02 Thread Johan Vromans
On Tue, 2 Dec 2014 11:05:20 +0100
Ben Big Noise benbigno...@gmx.de wrote:

 Wow - that's amazing. Having contributed to the LSR feels good :)

This is *very* nice. Kudos to Klaus and Pierre!

-- Johan

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


Re: scheme problem: colored background, layers

2014-12-02 Thread Urs Liska


Am 02.12.2014 11:29, schrieb Johan Vromans:

On Tue, 2 Dec 2014 11:05:20 +0100
Ben Big Noise benbigno...@gmx.de wrote:


Wow - that's amazing. Having contributed to the LSR feels good :)

This is *very* nice. Kudos to Klaus and Pierre!

-- Johan



Yes, from me too. I have immediately tagged this as to be investigated 
for our editorial tools collection.


Urs

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


Re: scheme problem: colored background, layers

2014-12-02 Thread Johan Vromans
On Tue, 02 Dec 2014 11:43:41 +0100
Urs Liska u...@openlilylib.org wrote:

 Yes, from me too. I have immediately tagged this as to be investigated 
 for our editorial tools collection.

One of the first purposes that came to my mind was marking (colour coding)
changes in a score, automatically, directly from git.

(We all use version control on our scores, don't we?)

-- Johan

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


Re: scheme problem: colored background, layers

2014-12-02 Thread Urs Liska


Am 02.12.2014 13:01, schrieb Johan Vromans:

On Tue, 02 Dec 2014 11:43:41 +0100
Urs Liska u...@openlilylib.org wrote:


Yes, from me too. I have immediately tagged this as to be investigated
for our editorial tools collection.

One of the first purposes that came to my mind was marking (colour coding)
changes in a score, automatically, directly from git.

(We all use version control on our scores, don't we?)

No, should we?  ;-/


-- Johan



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


Re: scheme problem: colored background, layers

2014-12-01 Thread Big Noise

Hi Pierre,

thanks for taking the time to think about it.
Meanwhile, after some sleepless nights ;-)  I've found another way to 
get some results:


% ---
\version 2.18.0

colorSpan =

#(define-music-function (parser location y-lower y-upper color) (number? 
number? color?)


#{

\override Staff.HorizontalBracket #'stencil =

$(lambda (grob)

(let* (

(area (ly:horizontal-bracket::print grob))

(X-ext (ly:stencil-extent area X))

(Y-ext (ly:stencil-extent area Y))

)

(set! Y-ext (cons y-lower y-upper)

)

(ly:grob-set-property! grob 'layer -10)

(ly:make-stencil (list 'color color

(ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0))

X-ext Y-ext))

))

#})

{

 { R1

\colorSpan #-5 #5 #(rgb-color 1.0 0.9 0.5) c'2\startGroup g' c' \stopGroup

\colorSpan #0 #5 #(rgb-color 0.5 1.0 0.5)

r4\startGroup r \stopGroup

\colorSpan #-5 #0 #(rgb-color 0.9 1.0 0.5) r\startGroup r\stopGroup }

\\

{

\override Voice.ClusterSpanner.color = #(rgb-color 0.5 0.6 1)

\override Voice.ClusterSpanner.layer = #-1

\makeClusters { s1 c'2 g' c' s s1 }

}



}

\layout {

\context {

\Voice

\consists Horizontal_bracket_engraver

\override HorizontalBracket #'thickness = #0

\override HorizontalBracket #'bracket-flare = #'(0 . 0)

\override HorizontalBracket #'Y-extent = #'(0 . 0)

\override HorizontalBracket #'edge-height = #'(0 . 0)

\override HorizontalBracket #'Y-offset = #0

\override HorizontalBracket #'shorten-pair = #'(-1 . -0.75)

}

}

% ---

Result: 
http://4.bp.blogspot.com/-THmAQWfqDaw/VHztoaE6N2I/ACs/9Sqgl4ViMBc/s1600/ly-ex3.gif


This time, I abused the Horizontal_bracket_engraver that is used for 
\startGroup and \stopGroup and replaced it's stencil by a rectangle.
Because it's not attached to the StaffSymbol, it can be placed in a 
different layer, so the blue cluster and the staff lines both stay visible.
Anyway, LilyPond does the horizontal spacing without the need for manual 
work.


This might make life easier for doing crazy things like this:
http://4.bp.blogspot.com/-kEXoxAx6HG0/VHzvH9GW9KI/AC8/48vNguVdp2A/s1600/ly-ex4.gif
http://4.bp.blogspot.com/-ChtL4-lGKoE/VHzvHuNU76I/AC4/Do8L81Al19I/s1600/ly-ex5.gif


Cheers,
Klaus Blum




Am 29.11.2014 um 10:43 schrieb Pierre Perol-Schneider:

Hi Klaus,

2014-11-29 10:30 GMT+01:00 Big Noise benbigno...@gmx.de 
mailto:benbigno...@gmx.de:


thanks for your reply.
Unfortunately, changing the layer value from -10 to -2 doesn't
help. The problem is that the function places the staff lines and
the colored rectangle into the *same* layer, whereas I need to
leave the staff lines in layer 0 and put the rectangle into layer
-2 (or even less).
This would allow me to put other clusters *between* them like in
the first example.


Right ! Now I see the problem, 'seems that I've replied without 
thinking...


I have already found another interesting snippet:
http://lsr.di.unimi.it/LSR/Item?id=953
But in that case, I would have to find the dimensions for the
rectangle by trial-and-error, whereas overriding the StaffSymbol
seems to be a very easy way...


Actually I've made this one (which is more or less a draft). I'll try 
to see what I can do with it. No promise though :(


Cheers,
Pierre



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


Re: scheme problem: colored background, layers

2014-12-01 Thread Pierre Perol-Schneider
Hum, interesting Klaus!
I'll take a closer look today.
Cheers,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: scheme problem: colored background, layers

2014-11-29 Thread Pierre Perol-Schneider
Hi,

2014-11-29 1:15 GMT+01:00 Big Noise benbigno...@gmx.de:


 Here is my problem:
 Now the staff lines and the yellow rectangle are located in the same
 layer, so it's not possible to place the blue cluster between them.
 Is there a way to make the scheme function put the staff lines
 (StaffSymbol) and the yellow rectangle into different layers?



How about changing the layer value from -10 to -2 ?

bgColor =
#(define-music-function (parser location y-lower y-upper color) (number?
number? string?)
   #{
 \stopStaff
 \override Staff.StaffSymbol.stencil =
 $(lambda (grob)
(let* ((staff (ly:staff-symbol::print grob))
   (X-ext (ly:stencil-extent staff X))
   (Y-ext (ly:stencil-extent staff Y)))
  (set! Y-ext (cons
   (- (car Y-ext) y-lower)
   (+ (cdr Y-ext) y-upper)))
  ;; change layer's value to -2
  (ly:grob-set-property! grob 'layer -2)
  (ly:stencil-add
   (ly:make-stencil (list 'color (eval-string color)
  (ly:stencil-expr (ly:round-filled-box X-ext
Y-ext 0))
  X-ext Y-ext))
   staff)))
 \startStaff
   #})

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


Re: scheme problem: colored background, layers

2014-11-29 Thread Big Noise

Salut Pierre,

thanks for your reply.
Unfortunately, changing the layer value from -10 to -2 doesn't help. The 
problem is that the function places the staff lines and the colored 
rectangle into the *same* layer, whereas I need to leave the staff lines 
in layer 0 and put the rectangle into layer -2 (or even less).
This would allow me to put other clusters *between* them like in the 
first example.


I have already found another interesting snippet: 
http://lsr.di.unimi.it/LSR/Item?id=953
But in that case, I would have to find the dimensions for the rectangle 
by trial-and-error, whereas overriding the StaffSymbol seems to be a 
very easy way...


Cordialement,
Klaus Blum


Am 29.11.2014 um 10:05 schrieb Pierre Perol-Schneider:

Hi,

2014-11-29 1:15 GMT+01:00 Big Noise benbigno...@gmx.de 
mailto:benbigno...@gmx.de:


Here is my problem:
Now the staff lines and the yellow rectangle are located in the
same layer, so it's not possible to place the blue cluster between
them.
Is there a way to make the scheme function put the staff lines
(StaffSymbol) and the yellow rectangle into different layers?



How about changing the layer value from -10 to -2 ?

bgColor =
#(define-music-function (parser location y-lower y-upper color) 
(number? number? string?)

   #{
 \stopStaff
 \override Staff.StaffSymbol.stencil =
 $(lambda (grob)
(let* ((staff (ly:staff-symbol::print grob))
   (X-ext (ly:stencil-extent staff X))
   (Y-ext (ly:stencil-extent staff Y)))
  (set! Y-ext (cons
   (- (car Y-ext) y-lower)
   (+ (cdr Y-ext) y-upper)))
  ;; change layer's value to -2
  (ly:grob-set-property! grob 'layer -2)
  (ly:stencil-add
   (ly:make-stencil (list 'color (eval-string color)
  (ly:stencil-expr (ly:round-filled-box 
X-ext Y-ext 0))

  X-ext Y-ext))
   staff)))
 \startStaff
   #})

HTH
Pierre


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


Re: scheme problem: colored background, layers

2014-11-29 Thread Pierre Perol-Schneider
Hi Klaus,

2014-11-29 10:30 GMT+01:00 Big Noise benbigno...@gmx.de:


 thanks for your reply.
 Unfortunately, changing the layer value from -10 to -2 doesn't help. The
 problem is that the function places the staff lines and the colored
 rectangle into the *same* layer, whereas I need to leave the staff lines in
 layer 0 and put the rectangle into layer -2 (or even less).
 This would allow me to put other clusters *between* them like in the first
 example.


Right ! Now I see the problem, 'seems that I've replied without thinking...


 I have already found another interesting snippet:
 http://lsr.di.unimi.it/LSR/Item?id=953
 But in that case, I would have to find the dimensions for the rectangle by
 trial-and-error, whereas overriding the StaffSymbol seems to be a very easy
 way...


Actually I've made this one (which is more or less a draft). I'll try to
see what I can do with it. No promise though :(

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


Re: Scheme Problem

2007-01-01 Thread Mats Bengtsson

The reason that
#{
...
\repeat unfold $beats { r4 }
...
#}

doesn't work is the same that the following doesn't work in an
ordinary .ly file:

numberOfRepeats = 3

...
\repeat unfold \numberOfRepeats {...}
...


In other words, the argument of \repeat cannot be specified
using a variable in the current implementation of LilyPond.


  /Mats



ian_hulin wrote:


Hi Brett,
Just a thought - the normal syntax for \repeat is 


\repeat unfold 9 { music statements }

in your declaration you've put the keyword in quotes.  Does it help if you
remove them? E.g. 



compFor = #(define-music-function (parser location beats) (number?)
   #{
   \override Rest #'stencil = 
#ly:percent-repeat-item-interface::beat-slash

   \override Rest #'thickness = #'0.48
   \override Rest #'slope = #'1.7
  
   \repeat unfold $beats { r4 }
  
   \revert Rest #'stencil

   #})

I don't know any of the Lilypond or Scheme internals but there's a chance
that this could be confusing a parser or lexical analyzer somewhere along
the line.  Software diagnostic messages are sometimes just an opener for
negotiation...

Cheers,
Ian


Brett Duncan-2 wrote:
 

The following function is an attempt on my part to learn how to create 
such functions, based on what appears in the User Manual. The function 
itself is not really important, just a problem I set for myself. It's 
supposed to take a number as its argument and produce the equivalent 
number of slashes, the idea being to use the slash as a comping symbol, 
and substituting the slash for the normal appearance of a quarter rest.



compFor = #(define-music-function (parser location beats) (number?)
   #{
   \override Rest #'stencil = 
#ly:percent-repeat-item-interface::beat-slash

   \override Rest #'thickness = #'0.48
   \override Rest #'slope = #'1.7
  
   \repeat unfold $beats { r4 }
  
   \revert Rest #'stencil

   #})


But when I put

   \compFor #16

into my .ly file, the following error occurs:

syntax error, unexpected NUMBER_IDENTIFIER, expecting DIGIT or UNSIGNED
   \repeat unfold
\lilyvartmpb { r4 }


Can someone point out to me where I'm going wrong?

Thanks,

Brett

--
Brett Duncan
[EMAIL PROTECTED]

Always do right - this will gratify some and astonish the rest.

Mark Twain


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


   



 




--
=
Mats Bengtsson
Signal Processing
Signals, Sensors and Systems
Royal Institute of Technology
SE-100 44  STOCKHOLM
Sweden
Phone: (+46) 8 790 8463 
   Fax:   (+46) 8 790 7260
Email: [EMAIL PROTECTED]
WWW: http://www.s3.kth.se/~mabe
=



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


Re: Scheme Problem

2006-12-31 Thread Orm Finnendahl
Am 31. Dezember 2006, 15:23 Uhr (+1100) schrieb Brett Duncan:
 
 But when I put
 
\compFor #16
 
 into my .ly file, the following error occurs:
 
 syntax error, unexpected NUMBER_IDENTIFIER, expecting DIGIT or UNSIGNED
\repeat unfold
 \lilyvartmpb { r4 }
 
 
 Can someone point out to me where I'm going wrong?

I don't know the exact reason but somehow the expansion into a scheme
construct doesn't work for variables in the \repeat unfold construct
(the parser expects a number but obviously doesn't resolve the $beats
before seeing it).

You can get it done this way: Look at the expansion of your function
with \displayMusic after replacing the variable with a real number (to
avoid the error) and then use the output of lilypond for defining your
music-function:

compFor = #(define-music-function (parser location beats) (number?)
   #{  
   \override Rest #'stencil =
#ly:percent-repeat-item-interface::beat-slash
   \override Rest #'thickness = #'0.48
   \override Rest #'slope = #'1.7

   \repeat unfold 16 { r4 }

   \revert Rest #'stencil
   #})   

\displayMusic
\compFor #16

--- 

In the output of lilypond, you replace the 16 with the variable name
beats and copy that into the definition of your music function. It's
not really convenient and there's probably another way to get it done,
but at least it works.

---
The result is like this (and that works as expected):

\version 2.11.2

compFor = #(define-music-function (parser location beats) (number?)
(make-music
 'SequentialMusic
 'elements
 (list (make-music
'ContextSpeccedMusic
'context-type
'Bottom
'element
(make-music
 'OverrideProperty
 'pop-first
 #t
 'grob-property-path
 (list (quote stencil))
 'grob-value
 ly:percent-repeat-item-interface::beat-slash
 'symbol
 'Rest))
  (make-music
   'ContextSpeccedMusic
   'context-type
   'Bottom
   'element
   (make-music
'OverrideProperty
'pop-first
#t
'grob-property-path
(list (quote thickness))
'grob-value
0.48
'symbol
'Rest))
  (make-music
   'ContextSpeccedMusic
   'context-type
   'Bottom
   'element
   (make-music
'OverrideProperty
'pop-first
#t
'grob-property-path
(list (quote slope))
'grob-value
1.7
'symbol
'Rest))
  (make-music
   'UnfoldedRepeatedMusic
   'elements
   '()
   'repeat-count
   beats
   'element
   (make-music
'SequentialMusic
'elements
(list (make-music
   'EventChord
   'elements
   (list (make-music
  'RestEvent
  'duration
  (ly:make-duration 2 0 1 1)))
  (make-music
   'ContextSpeccedMusic
   'context-type
   'Bottom
   'element
   (make-music
'RevertProperty
'grob-property-path
(list (quote stencil))
'symbol
'Rest)


   \compFor #16


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


Re: Scheme Problem

2006-12-31 Thread Han-Wen Nienhuys

http://code.google.com/p/lilypond/issues/detail?id=208can=1q=fixed_2_10_7

Brett Duncan escreveu:
 The following function is an attempt on my part to learn how to create
 such functions, based on what appears in the User Manual. The function
 itself is not really important, just a problem I set for myself. It's
 supposed to take a number as its argument and produce the equivalent
 number of slashes, the idea being to use the slash as a comping symbol,
 and substituting the slash for the normal appearance of a quarter rest.


-- 

Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com



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


Re: Scheme Problem

2006-12-31 Thread ian_hulin

Hi Brett,
Just a thought - the normal syntax for \repeat is 

\repeat unfold 9 { music statements }

in your declaration you've put the keyword in quotes.  Does it help if you
remove them? E.g. 


compFor = #(define-music-function (parser location beats) (number?)
#{
\override Rest #'stencil = 
#ly:percent-repeat-item-interface::beat-slash
\override Rest #'thickness = #'0.48
\override Rest #'slope = #'1.7
   
\repeat unfold $beats { r4 }
   
\revert Rest #'stencil
#})

I don't know any of the Lilypond or Scheme internals but there's a chance
that this could be confusing a parser or lexical analyzer somewhere along
the line.  Software diagnostic messages are sometimes just an opener for
negotiation...

Cheers,
Ian


Brett Duncan-2 wrote:
 
 The following function is an attempt on my part to learn how to create 
 such functions, based on what appears in the User Manual. The function 
 itself is not really important, just a problem I set for myself. It's 
 supposed to take a number as its argument and produce the equivalent 
 number of slashes, the idea being to use the slash as a comping symbol, 
 and substituting the slash for the normal appearance of a quarter rest.
 
 
 compFor = #(define-music-function (parser location beats) (number?)
 #{
 \override Rest #'stencil = 
 #ly:percent-repeat-item-interface::beat-slash
 \override Rest #'thickness = #'0.48
 \override Rest #'slope = #'1.7

 \repeat unfold $beats { r4 }

 \revert Rest #'stencil
 #})
 
 
 But when I put
 
 \compFor #16
 
 into my .ly file, the following error occurs:
 
 syntax error, unexpected NUMBER_IDENTIFIER, expecting DIGIT or UNSIGNED
 \repeat unfold
  \lilyvartmpb { r4 }
 
 
 Can someone point out to me where I'm going wrong?
 
 Thanks,
 
 Brett
 
 -- 
 Brett Duncan
 [EMAIL PROTECTED]
 
 Always do right - this will gratify some and astonish the rest.
 
 Mark Twain
 
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 http://lists.gnu.org/mailman/listinfo/lilypond-user
 
 

-- 
View this message in context: 
http://www.nabble.com/Scheme-Problem-tf2900758.html#a8107195
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.



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