Re: Parenthesized Hairpin
David Nalesnik-2 wrote > > > I'll be happy to update the snippet in the LSR, but I'd like to go > over it a little more first. (There's some code duplication.) > thanks! > One thing I wasn't sure of: should the height of the hairpin be scaled > too? > isn't the height being set in a simple \override Hairpin #'height = #.0 ? Eluze -- View this message in context: http://lilypond.1069038.n5.nabble.com/Parenthesized-Hairpin-tp131686p131802.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: Parenthesized Hairpin
- Original Message - From: "eluze" To: Sent: Friday, August 31, 2012 10:32 AM Subject: Re: Parenthesized Hairpin Phil Holmes-2 wrote Don't forget that the LSR runs 2.14, so changes that require 2.16 can't yet be implemented. it also works with 2.14.2 if you re-add the $ in 2 lines (15+17): (ly:stencil-aligned-to (grob-interpret-markup grob *$*leftText) Y CENTER)) (ly:stencil-aligned-to (grob-interpret-markup grob *$*rightText) Y CENTER)) Eluze If you can give me a finalised version, and remind me which snippet it is, I'll update the LSR. -- Phil Holmes ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
Hi, On Fri, Aug 31, 2012 at 4:32 AM, eluze wrote: > > Phil Holmes-2 wrote >> >> >> Don't forget that the LSR runs 2.14, so changes that require 2.16 can't >> yet >> be implemented. >> >> > > it also works with 2.14.2 if you re-add the $ in 2 lines (15+17): > > (ly:stencil-aligned-to (grob-interpret-markup grob *$*leftText) Y CENTER)) > (ly:stencil-aligned-to (grob-interpret-markup grob *$*rightText) Y > CENTER)) > > Eluze > I'll be happy to update the snippet in the LSR, but I'd like to go over it a little more first. (There's some code duplication.) One thing I wasn't sure of: should the height of the hairpin be scaled too? -David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
Phil Holmes-2 wrote > > > Don't forget that the LSR runs 2.14, so changes that require 2.16 can't > yet > be implemented. > > it also works with 2.14.2 if you re-add the $ in 2 lines (15+17): (ly:stencil-aligned-to (grob-interpret-markup grob *$*leftText) Y CENTER)) (ly:stencil-aligned-to (grob-interpret-markup grob *$*rightText) Y CENTER)) Eluze -- View this message in context: http://lilypond.1069038.n5.nabble.com/Parenthesized-Hairpin-tp131686p131794.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: Parenthesized Hairpin
- Original Message - From: "eluze" To: Sent: Friday, August 31, 2012 8:32 AM Subject: Re: Parenthesized Hairpin David Nalesnik-2 wrote I'm going to attach the last as a file so the comment lines aren't broken. perfect! (I've tested with 2.16.0 and 2.17.1) now will you - or somebody with the needed access rights - update the LSR. thanks Eluze Don't forget that the LSR runs 2.14, so changes that require 2.16 can't yet be implemented. -- Phil Holmes ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
Hi David, note the spelling correction:- to markups --- two markups. Cheers Bill % this snippet is useful to put a hairpin between to markups i.e. parentheses or slash % or any other text % this snippet is useful to put a hairpin between two markups i.e. parentheses or slash % or any other text ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
David Nalesnik-2 wrote > > > I'm going to attach the last as a file so the comment lines aren't broken. > > perfect! (I've tested with 2.16.0 and 2.17.1) now will you - or somebody with the needed access rights - update the LSR. thanks Eluze -- View this message in context: http://lilypond.1069038.n5.nabble.com/Parenthesized-Hairpin-tp131686p131779.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: Parenthesized Hairpin
Hi again, I'm going to attach the last as a file so the comment lines aren't broken. -David hairpin-test01.ly Description: Binary data ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
Hi eluze, On Thu, Aug 30, 2012 at 5:06 PM, eluze wrote: > > David Nalesnik-2 wrote >> >> >> Below I've rewritten the snippet to show you how this might be done: >> > thanks David > > now I see another problem (maybe I should open a new post or bug report for > it): > > this example moves the hairpin to the right (on the first line) and in the > second line the text is just appended to the hairpin and thus appears below > the following note(s) - is there a way to fit it to the line-width? > > to illustrate this, I use longer text on the left and right: > > /parenthesizedHairpin = \hairpinBetweenText \markup \small "slowly " \markup > \small "………!"/ > > http://lilypond.1069038.n5.nabble.com/file/n131765/hairpin%2Bbreak.png > One quick remedy for this is to scale the stencil to accommodate the added text. This has the potential for distortion, and a better way would be to adjust the bounds of the hairpin. I'm not sure how to do this. Anyway, hope this helps! -David %%% hairpinBetweenText = #(define-music-function (parser location leftText rightText) (markup? markup?) #{ \once \override Hairpin #'stencil = #(lambda (grob) (let* ((orig (ly:grob-original grob)) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '())) (hairpin-stencil (ly:stencil-aligned-to (ly:hairpin::print grob) Y CENTER)) (hairpin-stencil-extent (interval-length (ly:stencil-extent hairpin-stencil X))) (left-addition (ly:stencil-aligned-to (grob-interpret-markup grob leftText) Y CENTER)) (right-addition (ly:stencil-aligned-to (grob-interpret-markup grob rightText) Y CENTER)) (left-addition-extent (interval-length (ly:stencil-extent left-addition X))) (right-addition-extent (interval-length (ly:stencil-extent right-addition X (if (null? siblings) ; if hairpin is whole, add text to both ends ; scale to reflect both markups (begin (set! hairpin-stencil (ly:stencil-combine-at-edge (ly:stencil-scale hairpin-stencil (/ (- hairpin-stencil-extent left-addition-extent right-addition-extent) hairpin-stencil-extent) 1) X RIGHT right-addition 0.6)) (set! hairpin-stencil (ly:stencil-combine-at-edge left-addition X RIGHT hairpin-stencil 0))) (cond ((eq? grob (car siblings)) ; if first piece, add text to left (set! hairpin-stencil (ly:stencil-combine-at-edge left-addition X RIGHT (ly:stencil-scale hairpin-stencil (/ (- hairpin-stencil-extent left-addition-extent) hairpin-stencil-extent) 1) ; I didn't scale Y 0))) ((eq? grob (car (reverse siblings))) ; if last piece, add text to right (set! hairpin-stencil (ly:stencil-combine-at-edge (ly:stencil-scale hairpin-stencil (/ (- hairpin-stencil-extent right-addition-extent) hairpin-stencil-extent) 1) X RIGHT right-addition 0.6) hairpin-stencil)) #}) %cambiando el contenido de los \markup cambiamos el objeto de texto (elemento %de marcado y aceptara cualquier cosa que se pueda incluir en estos. %you can change de content of the \markup to show diferent texts %or any other thing you can put in a \markup parenthesizedHairpin = \hairpinBetweenText \markup "slowly" \markup \small "………!" % the music \score { \relative c' { \time 3/4 \parenthesizedHairpin c\< d e \break f g a %\break b c d %\break e f g a\! } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
David Nalesnik-2 wrote > > > Below I've rewritten the snippet to show you how this might be done: > thanks David now I see another problem (maybe I should open a new post or bug report for it): this example moves the hairpin to the right (on the first line) and in the second line the text is just appended to the hairpin and thus appears below the following note(s) - is there a way to fit it to the line-width? to illustrate this, I use longer text on the left and right: /parenthesizedHairpin = \hairpinBetweenText \markup \small "slowly " \markup \small "………!"/ http://lilypond.1069038.n5.nabble.com/file/n131765/hairpin%2Bbreak.png Eluze -- View this message in context: http://lilypond.1069038.n5.nabble.com/Parenthesized-Hairpin-tp131686p131765.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: Parenthesized Hairpin
Hi Daniel, > So far so good, but I've noticed that if you do a \break before ending the > hairpin (e.g. a hairpin through 4 bars), the hairpin parenthesis repeats. > Is that a normal behaviour? > This is the expected and documented behavior in LilyPond, but not convenient! The reason this happens is that when you break a spanner, the original object is cloned, and all pieces inherit any overrides. The section http://www.lilypond.org/doc/v2.16/Documentation/extending/difficult-tweaks describes this situation and what to do about it. Below I've rewritten the snippet to show you how this might be done: % this snippet is useful to put a hairpin between to markups i.e. parentheses or slash % or any other text % este fragmento sirve para poner un regulador de angulo entre dos markups, p.e. % parentesis, corchetes, barras o cualquier otro texto % leftText y rightText serán los textos a la izquierda y a la derecha respectivamente % leftText and rightText will be the markup texts on each side of the hairpin hairpinBetweenText = #(define-music-function (parser location leftText rightText) (markup? markup?) #{ \once \override Hairpin #'stencil = #(lambda (grob) (let* ((orig (ly:grob-original grob)) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '())) (hairpin-stencil (ly:stencil-aligned-to (ly:hairpin::print grob) Y CENTER)) (left-addition (ly:stencil-aligned-to (grob-interpret-markup grob leftText) Y CENTER)) (right-addition (ly:stencil-aligned-to (grob-interpret-markup grob rightText) Y CENTER))) (if (or (null? siblings) (eq? grob (car siblings))) (set! hairpin-stencil (ly:stencil-combine-at-edge left-addition X RIGHT hairpin-stencil 0))) (if (or (null? siblings) (eq? grob (car (reverse siblings (set! hairpin-stencil (ly:stencil-combine-at-edge hairpin-stencil X RIGHT right-addition 0.6))) hairpin-stencil)) #}) %cambiando el contenido de los \markup cambiamos el objeto de texto (elemento %de marcado y aceptara cualquier cosa que se pueda incluir en estos. %you can change de content of the \markup to show diferent texts %or any other thing you can put in a \markup parenthesizedHairpin = \hairpinBetweenText \markup "(" \markup ")" % the music \score { \relative c' { \time 3/4 \parenthesizedHairpin c\< d e \break f g a %\break b c d %\break e f g a\! } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
Hello David, By "hairpin parenthesis I mean "parenthesized hairpin" like the one shown on the snippet I provided. -- Daniel E. Moctezuma ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Parenthesized Hairpin
"Daniel E. Moctezuma" writes: > Using a snippet from LSR (http://lsr.dsi.unimi.it/LSR/Item?id=771) I've > found that I get an "Unbound variable" error on $leftText. > The way I've solved is to remove the $ sign from it as well as from > $rightText. Did you run convert-ly -ed on the file? That should have catered for the $. > So far so good, but I've noticed that if you do a \break before ending > the hairpin (e.g. a hairpin through 4 bars), the hairpin parenthesis > repeats. > Is that a normal behaviour? What is a "hairpin parenthesis"? -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Parenthesized Hairpin
Hello, Using a snippet from LSR (http://lsr.dsi.unimi.it/LSR/Item?id=771) I've found that I get an "*Unbound variable*" error on *$leftText*. The way I've solved is to remove the *$* sign from it as well as from * $rightText*. So far so good, but I've noticed that if you do a *\break* before ending the hairpin (e.g. a hairpin through 4 bars), the hairpin parenthesis repeats. Is that a normal behaviour? Thanks ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user