%#!lilypond temp.ly -*- coding: utf-8; -*-

\version "2.9.28"


barreNotes = #(define-music-function 
               (parser location printNote startNote stopNote)
		(ly:music? ly:music? ly:music?)
   (make-music 'SequentialMusic 'elements (list 

    #{ \set Staff.connectArpeggios = ##t
       \once \override Staff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket #}

    (make-music 'SimultaneousMusic
          'elements (list 
             (make-music 'ContextSpeccedMusic
	      'create-new #t
	      'property-operations '()
	      'context-type 'Voice
	      'element (make-music 'SequentialMusic 'elements (list

    #{ \hideNotes #}

    (make-music 'SequentialMusic 'elements (list
		(make-music (quote ArpeggioEvent)) startNote)))))
 
    #{ $printNote #}

    (make-music 'ContextSpeccedMusic
	      'create-new #t
	      'property-operations '()
	      'context-type 'Voice
	      'element (make-music 'SequentialMusic 'elements (list

   #{ \hideNotes #}

    (make-music 'SequentialMusic 'elements (list
		(make-music (quote ArpeggioEvent)) stopNote)))))

)))))

\score {

\new Staff \with {\consists Span_arpeggio_engraver}
 \relative c'' {
\set fingeringOrientations = #'(left)
\set Staff.connectArpeggios = ##t
\once \override Staff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket

<< \new Voice {\hideNotes <a>\arpeggio}
 { \set fingeringOrientations = #'(left) <c-1 > }
\new Voice {\hideNotes <e>\arpeggio }
>>

\once \override Staff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket

<< \new Voice {\hideNotes <a,>\arpeggio}
 { \set fingeringOrientations = #'(up) <c-1 > }
\new Voice {\hideNotes <e>\arpeggio }
>>

<< \new Voice {\hideNotes <a,>\arpeggio}
 { \set fingeringOrientations = #'(left) <c-1 > }
\new Voice {\hideNotes <e>\arpeggio }
>>

<< \new Voice {\hideNotes <a,>\arpeggio}
 { \set fingeringOrientations = #'(up) <c-1 > }
\new Voice {\hideNotes <e>\arpeggio }
>>

\barreNotes c a, c

}


   \layout { ragged-right= ##t }
}