\version "2.20.0" %%%%%%%%%% DEFINICIÓN DE CEJILLA "barre" sin indice%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 #}) %%%%%%%%%% DEFINICIÓN DE CEJILLA "hbarre" con indice %%%%%%% % %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 (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 {\fontsize #1. \concat { $fretnum \raise #1.2 \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.6)) } % 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 #}) \paper { #(set-paper-size "legal") } \layout { \context { \Voice \consists "Melody_engraver" \override Stem #'neutral-direction = #'() } } global = { \key c \major \time 4/4 \tempo 4=100 } classicalGuitar = \relative c' { \global \barre "1" #0 #UP #'(-0.5 . -1) #8 #1 a4\startTextSpan a a a| % 2 a a a a\stopTextSpan| % 3 a a a a| % 4 a a a a|\break % 5 a a a a| % 6 \hbarre "5" "3" #0 #UP #'(-0.5 . -1) #8 #1 a\startTextSpan a a a| % 7 a a a a\stopTextSpan| % 8 a a a a| } \score { \new Staff \with { midiInstrument = "acoustic guitar (nylon)" instrumentName = "G." } { \clef "treble_8" \classicalGuitar } \layout { } \midi { } }