Re: Barres and enclose-bounds
Paul-467 wrote: > > Hello, > > Sorry to be any trouble, but a long time ago I'd used the following to > define > barres for a guitar piece: > > barre = #(define-music-function (parser location str)(string?) > #{ >\once \override Voice . TextSpanner #'direction = #1 >\once \override Voice . TextSpanner #'dash-period = #'0.0 >\once \override Voice . TextSpanner #'dash-fraction = #'() >\once \override Voice . TextSpanner #'edge-height = #'(0.0 . 0.5) >\once \override Voice . TextSpanner #'enclose-bounds = #1 >\once \override Voice . TextSpanner #'edge-text = #(cons (format > "c~a" > $str) "") > #}) > > In the music itself the code was the following: > > << { 4 > > %||6|| > \barre #"IX" 8\startTextSpan > \stopTextSpan | } \\ >{ 8 \stopTextSpan 2 | } >> > > Unfortunately I don't remember which version of LilyPond this worked in as > I > may have manually changed the version number. Either way "enclose-bounds" > doesn't seem to be part of the LilyPond code any more and I wondered how > the > code should read in 2.12.3. > > convert-ly could be of help, see http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program-big-page Application Usage hth -- View this message in context: http://old.nabble.com/Barres-and-enclose-bounds-tp29129706p29129923.html 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
Re: Barres and enclose-bounds
Thanks. I changed the version number a few times until I got some meaningful output from convert-ly. It couldn't do the whole job, but it gave an indication as to what needed to be changed. I've ended up with the following, which may be of help to others: barre = #(define-music-function (parser location str)(string?) #{ \once \override Voice . TextSpanner #'direction = #1 \once \override Voice . TextSpanner #'style = #'line \once \override Voice . TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -0.5) } \once \override Voice . TextSpanner #'(bound-details left text) = #(markup (format "c~a" $str)) #}) This works. << { 4 | } \\ \override StringNumber #'extra-offset = #'(0.0 . -2.5) \once \override Voice.TextSpanner #'padding = #'5.5 { \barre #"IX" 8\startTextSpan e'\stopTextSpan \once \override Voice.TextSpanner #'padding = #'4.0 \barre #"VII" \startTextSpan \stopTextSpan | } >> http://old.nabble.com/file/p29131041/tostretch.png My next exercise will be to see if I can adjust the width of the barre, as I would like it to span to the outside edge of the note head, and not the centre line, but I'll try figure that out before asking the question here. Paul P.S. I seem to have a different username now. Oh well. Getting the hang of things. -Eluze wrote: > > convert-ly could be of help, see > http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program-big-page > Application Usage > > hth > -- View this message in context: http://old.nabble.com/Barres-and-enclose-bounds-tp29129706p29131041.html 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
Re: Barres and enclose-bounds
Hi Paul, Here's my barre function (takes care of breaks as well). Hope it can be of some help or at least give you some ideas... barre = #(define-music-function (parser location padding text) (number? string?) #{ \once \override TextSpanner #'font-size = #-0.5 \once \override TextSpanner #'padding = #$padding \once \override TextSpanner #'(bound-details left text) = #$text \once \override TextSpanner #'(bound-details left padding) = #-0.5 \once \override TextSpanner #'(bound-details left-broken text) = \markup { \null } \once \override TextSpanner #'(bound-details left-broken padding) = #0 \once \override TextSpanner #'font-shape = #'upright \once \override TextSpanner #'style = #'line %\once \override TextSpanner #'style = #'dashed-line %\once \override TextSpanner #'dash-period = #0.8 %\once \override TextSpanner #'dash-fraction = #0.2 \once \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER \once \override TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -0.4) } \once \override TextSpanner #'(bound-details right padding) = #-1.0 \once \override TextSpanner #'(bound-details right-broken text) = \markup { \null } \once \override TextSpanner #'(bound-details right-broken padding) = #0 #}) startBarre = \startTextSpan stopBarre = \stopTextSpan To use: \barre #4 "CV" (first argument = vertical padding, second argument = barre text) Example: \relative c' = { \stemDown \barre #4 "CV " a'\startBarre c e a\stopBarre } If you prefer dotted/dashed lines then you can uncomment the style, dash-period and dash-fraction lines. Hope it helps. Phil. - Original Message - From: "paulxiii" To: Sent: Sunday, July 11, 2010 12:41 PM Subject: Re: Barres and enclose-bounds Thanks. I changed the version number a few times until I got some meaningful output from convert-ly. It couldn't do the whole job, but it gave an indication as to what needed to be changed. I've ended up with the following, which may be of help to others: barre = #(define-music-function (parser location str)(string?) #{ \once \override Voice . TextSpanner #'direction = #1 \once \override Voice . TextSpanner #'style = #'line \once \override Voice . TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -0.5) } \once \override Voice . TextSpanner #'(bound-details left text) = #(markup (format "c~a" $str)) #}) This works. << { 4 | } \\ \override StringNumber #'extra-offset = #'(0.0 . -2.5) \once \override Voice.TextSpanner #'padding = #'5.5 { \barre #"IX" 8\startTextSpan e'\stopTextSpan \once \override Voice.TextSpanner #'padding = #'4.0 \barre #"VII" \startTextSpan \stopTextSpan | } >> http://old.nabble.com/file/p29131041/tostretch.png My next exercise will be to see if I can adjust the width of the barre, as I would like it to span to the outside edge of the note head, and not the centre line, but I'll try figure that out before asking the question here. Paul P.S. I seem to have a different username now. Oh well. Getting the hang of things. -Eluze wrote: convert-ly could be of help, see http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program-big-page Application Usage hth -- View this message in context: http://old.nabble.com/Barres-and-enclose-bounds-tp29129706p29131041.html 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 ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Barres and enclose-bounds
Here's another barre function: % % more attractive barring indication than the inbuilt one % Parameters % % ""% fret number (eg "5") % #osp% outside-staff-priority - normally set to #0 unless barre is colliding with other elements % #dirn% set to #UP for above the staff, #DOWN for below % #'(lpad . rpad)% left and right padding to apply to TextSpanner (shorten or lengthen) % #adjBreak% when barre wraps to following stave, set value to prevent TextSpanner on following stave starting above the clef symbol % #adjend% when barre wraps to following stave, set value to prevent TextSpanner going to the very end of the stave % % Example: %\barre "5" #0 #UP #'(-0.5 . -1) #8 #1 % \startTextSpan -> -> \stopTextSpan % barre = #(define-music-function (parser location fretnum osp dirn shorten adjBreak adjEnd) (string? number? number? pair? number? number?) #{ \once \override TextSpanner #'outside-staff-priority = #$osp \once \override TextSpanner #'bound-details #'left #'text = \markup { \small { \concat { "C" "." $fretnum " " } } } \once \override TextSpanner #'style = #'line \once \override TextSpanner #'font-shape = #'upright \once \override TextSpanner #'direction = #$dirn %draw a bracket edge on RHS \once \override TextSpanner #'bound-details #'right #'text = \markup { \draw-line #(cons 0 (/ $dirn -1)) } % set alignment of line with reference to left text \once \override TextSpanner #'bound-details #'left #'stencil-align-dir-y = #CENTER % change X pos of LH and RH end as desired \once \override TextSpanner #'bound-details #'left #'padding = #(car $shorten) \once \override TextSpanner #'bound-details #'right #'padding = #(cdr $shorten) % allow adjustment of line end when it wraps to following stave \once \override TextSpanner #'bound-details #'right-broken #'padding = #$adjEnd % adjust LH end of line when it wraps to following stave so that it doesn't % extend to the left of the notes on the stave \once \override TextSpanner #'bound-details #'left-broken #'X = #$adjBreak % optional override to remove text and bracket edge at line breaks \once \override TextSpanner #'bound-details #'left-broken #'text = ##f \once \override TextSpanner #'bound-details #'right-broken #'text = ##f #}) % and here's one for half barres that slashes the C and subscripts the number of strings covered: % % % postscript slash for half barres #(define slash "0.18 setlinewidth 0.76 1.53 moveto 0 -1.62 rlineto stroke") % % Half barre % Parameters % % ""% fret number (eg "5") % ""% number of strings to cover - subscripted to the fret number % #osp% outside-staff-priority - normally set to #0 unless barre is colliding with other elements % #dirn% set to #UP for above the staff, #DOWN for below % #'(lpad . rpad)% left and right padding to apply to TextSpanner (shorten or lengthen) % #adjBreak% when barre wraps to following stave, set value to prevent TextSpanner on following stave starting above the clef symbol % #adjend% when barre wraps to following stave, set value to prevent TextSpanner going to the very end of the stave % % Example: %\hbarre "5" "3" #0 #UP #'(-0.5 . -1) #8 #1 % \startTextSpan -> -> \stopTextSpan % hbarre = #(define-music-function (parser location fretnum partial osp dirn shorten adjBreak adjEnd) (string? string? number? number? pair? number? number?) #{ \once \override TextSpanner #'outside-staff-priority = #$osp \once \override TextSpanner #'bound-details #'left #'text = \markup { \small { \concat { \postscript #slash "C" "." $fretnum \raise #0.8 \sub $partial " " } } } \once \override TextSpanner #'style = #'line \once \override TextSpanner #'font-shape = #'upright \once \override TextSpanner #'direction = #$dirn %draw a bracket edge on RHS \once \override TextSpanner #'bound-details #'right #'text = \markup { \draw-line #(cons 0 (/ $dirn -1)) } % set alignment of line with reference to left text \once \override TextSpanner #'bound-details #'left #'stencil-align-dir-y = #CENTER % change X pos of LH and RH end as desired \once \override TextSpanner #'bound-details #'left #'padding = #(car $shorten) \once \override TextSpanner #'bound-details #'right #'padding = #(cdr $shorten) % allow adjustment of line end when it wraps to following stave \once \override TextSpanner #'bound-details #'right-broken #'padding = #$adjEnd % adjust LH end of line when it wraps to following stave so that it doesn't % extend to the left of the notes on the stave \once \override TextSpanner #'bound-details #'left-broken #'X = #$adjBreak % optional overrid
Re: Barres and enclose-bounds
Absolutely outstanding! Thanks to both Phil and Nick. I've tried both versions and the only thing I'd add to Phil's version is something I found amongst this forum (I think) and that is in the layout to sort out the bar number appearing above the textSpanner after a line break. It doesn't solve the textSpanner going right (left actually) to edge of the staff. \layout { \context { \Score \remove "Bar_number_engraver" } %stops the bar number appearing above the textSpanner \context { \Staff \consists "Bar_number_engraver" \override TextSpanner #'outside-staff-priority = #350 \override BarNumber #'outside-staff-priority = #50 } } I see Nick's version takes care of that problem in the definition. I hope both of these barre definitions are in some snippet library for others to use as well. Thanks again and regards, Paul Nick Payne-3 wrote: > > Here's another barre function: > -- View this message in context: http://old.nabble.com/Barres-and-enclose-bounds-tp29129706p29164038.html 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
Re: Barres and enclose-bounds
Hi Paul, I'm glad it was some use =) As to the spanner line starting at the staff left edge after a line break - thats not happening for me (version 2.13.17). The spanners always re-start on the first note of the following system and bar numbers remain in place. Odd :( However, I see from Nick's version that it seems this may be controlled by setting #'bound-details #'left-broken #'X = #number On another note...what I would like to discover (anyone?) is how to change the vertical padding AFTER a line break. TextSpanner #'padding = #$padding sets vertical padding for a TextSpanner before AND after line breaks. A few times I've wanted to reduce this padding after a line break but haven't found a way yet. Regards, Phil. - Original Message - From: "paulxiii" To: Sent: Wednesday, July 14, 2010 5:32 PM Subject: Re: Barres and enclose-bounds Absolutely outstanding! Thanks to both Phil and Nick. I've tried both versions and the only thing I'd add to Phil's version is something I found amongst this forum (I think) and that is in the layout to sort out the bar number appearing above the textSpanner after a line break. It doesn't solve the textSpanner going right (left actually) to edge of the staff. \layout { \context { \Score \remove "Bar_number_engraver" } %stops the bar number appearing above the textSpanner \context { \Staff \consists "Bar_number_engraver" \override TextSpanner #'outside-staff-priority = #350 \override BarNumber #'outside-staff-priority = #50 } } I see Nick's version takes care of that problem in the definition. I hope both of these barre definitions are in some snippet library for others to use as well. Thanks again and regards, Paul Nick Payne-3 wrote: Here's another barre function: -- View this message in context: http://old.nabble.com/Barres-and-enclose-bounds-tp29129706p29164038.html 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 ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user