Re: Two adjacent clefs
> Thank you for this. One question: is the second clef the size of a "change > clef" ? The reason I chose LSR 792 over 956 is the size of the second clef. Yes. See for example \relative c' { %% Start with a bass clef : \clef bass %% Use a hidden grace note: \once\hideNotes\grace c64 %% Adjust the clef spacing: \once\override Staff.Clef.X-extent = #'(1 . 2) %% Put in the treble clef: \clef treble c4 \clef bass c \clef treble c c | c1 } This one does in fact create an actual clef, which is then of course a change clef. But then it is fiddly (you need to adjust extent of the clef) and causes the infamous start-on-grace issues. So I do think integrating this properly is the way to go. signature.asc Description: This is a digitally signed message part.
Re: Two adjacent clefs
On Mon, Jun 10, 2024 at 3:25 AM Valentin Petzel wrote: > > and this is the rather hacky one using hidden grace notes - my > > searching skills are sadly lacking evidently :( > > > > Richard > > Trust me, the other one is even more hacky ... It essentially fakes the > appearance of the real clef and draws a new clef glyph into the > TimeSignature > grob. > > Did a draft for implementation in the actual Clef engraver: > > https://gitlab.com/lilypond/lilypond/-/merge_requests/2362 > > Still needs some polishing and design choices, but then this should > essentially boil down to setting > > initialClefChange = ##t > Thank you for this. One question: is the second clef the size of a "change clef" ? The reason I chose LSR 792 over 956 is the size of the second clef. -- Knute Snortum
Re: Two adjacent clefs
> and this is the rather hacky one using hidden grace notes - my > searching skills are sadly lacking evidently :( > > Richard Trust me, the other one is even more hacky ... It essentially fakes the appearance of the real clef and draws a new clef glyph into the TimeSignature grob. Did a draft for implementation in the actual Clef engraver: https://gitlab.com/lilypond/lilypond/-/merge_requests/2362 Still needs some polishing and design choices, but then this should essentially boil down to setting initialClefChange = ##t Cheers, Valentin signature.asc Description: This is a digitally signed message part.
Re: Two adjacent clefs
On Sun, 2024-06-09 at 18:08 +0200, Jean Abou Samra wrote: > > > I think it's not uncommon for two clefs to appear side by side at > > the > > start of a piece (e.g. when a piano piece starts with both staves > > in > > bass clef so as to alert the pianist that the upper staff is not in > > treble clef). > > How is this done in LilyPond? > > See > https://lsr.di.unimi.it/LSR/Item?id=792 ah, this is the solution Knute sent and which I've used > and > https://lsr.di.unimi.it/LSR/Item?id=956 and this is the rather hacky one using hidden grace notes - my searching skills are sadly lacking evidently :( Richard
Re: Two adjacent clefs
> I think it's not uncommon for two clefs to appear side by side at the > start of a piece (e.g. when a piano piece starts with both staves in > bass clef so as to alert the pianist that the upper staff is not in > treble clef). > How is this done in LilyPond? See https://lsr.di.unimi.it/LSR/Item?id=792 and https://lsr.di.unimi.it/LSR/Item?id=956 signature.asc Description: This is a digitally signed message part
Re: Two adjacent clefs
On Sun, 2024-06-09 at 06:56 -0700, Knute Snortum wrote: > > On Sun, Jun 9, 2024 at 6:39 AM Richard Shann > wrote: > > > I was imagining that this construct was more commonly used than I > > guess > > it actually is (the current case that I have been asked about is > > not > > even what I took to be the common case of pianists so used to > > having > > treble and bass that they don't notice it's two bass clefs), ... > > > > > The situation of having an initial clef, then changing it to another > clef, is not uncommon in piano music. Well, that was my impression before I started searching the LilyPond docs and snippets and mailing lists - it was my failure there that started me thinking it might not be so common - I'm used to finding that LilyPond has covered every common notation (and quite a bit beyond!) Richard
Re: Two adjacent clefs
On Sun, Jun 9, 2024 at 6:39 AM Richard Shann wrote: I was imagining that this construct was more commonly used than I guess > it actually is (the current case that I have been asked about is not > even what I took to be the common case of pianists so used to having > treble and bass that they don't notice it's two bass clefs), ... > The situation of having an initial clef, then changing it to another clef, is not uncommon in piano music. Recall Chopin's prelude in e flat minor, opus 28, number 14 (attached). -- Knute Snortum
Re: Two adjacent clefs
On Sun, 2024-06-09 at 10:33 +0200, Valentin Petzel wrote: > Hello Richard, > > usually for this I’d simply use grace notes to create a timestep > separation > between two clefs: > > { > \clef bass > \once\hideNotes\grace c64 > \once\override Staff.Clef.X-extent = #'(1.5 . 2) > \clef treble > 1 > } I cooked up something along those lines, but thought it too hacky ... > > But then it would actually be quite easy to have this done properly > by an > engraver (without any hacks). See the appended file for such an > engraver that > will enable showing an initial clef change. > > Also the change clef will use the cue-clef break alignment, so using > that you > can actually adjust order (such as placing the change clef before key > or time > sigs) simply by using the break-align-order. > > It would in fact be quite simple to extend the clef engraver to do > this > natively, simply by setting some context property. Maybe then using > an > initial-change-clef break alignment and a slightly adapted glyph name > calculation that takes this into account (currently the small clef > glyph needs > to be set in the engraver, as Lilypond does not use change clefs at > the begin > of the line). I was imagining that this construct was more commonly used than I guess it actually is (the current case that I have been asked about is not even what I took to be the common case of pianists so used to having treble and bass that they don't notice it's two bass clefs), so Knute's relatively simple suggestion will be fine. Omce again, a lot of useful insights in the code you provided - thank you. Best, Richard
Re: Two adjacent clefs
On Sat, 2024-06-08 at 14:46 -0400, William Rehwinkel wrote: > Dear Richard, > > I'm not sure what you mean, but I think I would do something like > this > for putting multiple clefs together. > > -William > > % -- > \version "2.25.16" > > \relative c' { > \override Staff.Clef.stencil = #ly:text-interface::print > \override Staff.Clef.text = \markup { \raise #-2 \musicglyph > "clefs.G" \raise #0 \musicglyph "clefs.F" \raise #-1 \musicglyph > "clefs.C" \raise #0 \musicglyph "clefs.C" } > \clef tenor > c4 > } > % -- Thank you - an interesting approach. Richard
Re: Two adjacent clefs
Hello Richard, usually for this I’d simply use grace notes to create a timestep separation between two clefs: { \clef bass \once\hideNotes\grace c64 \once\override Staff.Clef.X-extent = #'(1.5 . 2) \clef treble 1 } But then it would actually be quite easy to have this done properly by an engraver (without any hacks). See the appended file for such an engraver that will enable showing an initial clef change. Also the change clef will use the cue-clef break alignment, so using that you can actually adjust order (such as placing the change clef before key or time sigs) simply by using the break-align-order. It would in fact be quite simple to extend the clef engraver to do this natively, simply by setting some context property. Maybe then using an initial-change-clef break alignment and a slightly adapted glyph name calculation that takes this into account (currently the small clef glyph needs to be set in the engraver, as Lilypond does not use change clefs at the begin of the line). Cheers, Valentin Am Samstag, 8. Juni 2024, 19:05:26 MESZ schrieb Richard Shann: > On Sat, 2024-06-08 at 08:09 -0700, Knute Snortum wrote: > > On Sat, Jun 8, 2024 at 7:03 AM Richard Shann > > > > wrote: > > > I think it's not uncommon for two clefs to appear side by side at > > > the > > > start of a piece (e.g. when a piano piece starts with both staves > > > in > > > bass clef so as to alert the pianist that the upper staff is not in > > > treble clef). > > > How is this done in LilyPond? > > > > It can be done with some Scheme magic. I'm assuming you want both a > > treble and bass clef initial and then immediately change to another > > clef? Someone wrote this (attached) for me (I really need to put the > > author in the code so I can give credit where due.) All you do is > > include it in your LilyPond source and write \trebleToBass or > > \bassToTreble and you have what you want. > > Perfect! Thank you so much! > > Richard %%% This engraver records the initial clef properties (e.g. what is set by \with { \clef ... }) %%% If in the first timestep these changed, engrave the original clef, and change formatting and break %%% alignment of the actual clef to mimic a clef change clef. Duplicates some procedure from clef engraver %%% and could easily be integrated. #(define (initial-clef-change-engraver context) (let ((initial-clef-properties #f) (cclef #f)) ; macro for checking if any clef property has changed (define (clef-changed) (> (length initial-clef-properties) (length (filter (lambda (x) (equal? (cdr x) (ly:context-property context (car x initial-clef-properties (make-engraver ; Record initials propertis ((initialize engraver) (set! initial-clef-properties `((clefGlyph . ,(ly:context-property context 'clefGlyph)) (clefPosition . ,(ly:context-property context 'clefPosition)) (clefTransposition . ,(ly:context-property context 'clefTransposition) ; Record the actual clef to adjust. Use detals.muted to not acknowledge clef created by this engraver. (acknowledgers ((clef-interface engraver grob source-engraver) (if (not (assoc-get 'muted (ly:grob-property grob 'details) #f)) (set! cclef grob ; Create a clef if necessary ((process-music engraver) (if (and initial-clef-properties (clef-changed)) (let ((clef (ly:engraver-make-grob engraver 'Clef '( (ly:grob-set-property! clef 'staff-position (assoc-get 'clefPosition initial-clef-properties)) (ly:grob-set-property! clef 'glyph (assoc-get 'clefGlyph initial-clef-properties)) (ly:grob-set-nested-property! clef '(details muted) #t) (if ((lambda (x) (and (number? x) (not (= 0 x (assoc-get 'clefTransposition initial-clef-properties 0)) (let ((mod (ly:engraver-make-grob engraver 'ClefModifier '())) (formatter (ly:context-property context 'clefTranspositionFormatter)) (style (ly:context-property context 'clefTranspositionStyle)) (dir (sign (assoc-get 'clefTransposition initial-clef-properties 0))) (abs_trans (1+ (abs (assoc-get 'clefTransposition initial-clef-properties 0) (if (procedure? formatter) (ly:grob-set-property! mod 'text (formatter (number->string abs_trans) style))) (ly:grob-set-object! mod 'side-support-elements (ly:grob-list->grob-array (list clef))) (ly:grob-set-parent! mod X clef) (ly:grob-set-parent! mod Y clef) (ly:grob-set-property! mod 'direction dir)) ; Adjust the actual clef ((process-acknowledged engraver) (if (and cclef initial-clef-properties (clef-changed)) (begin
Re: Two adjacent clefs
Dear Richard, I'm not sure what you mean, but I think I would do something like this for putting multiple clefs together. -William % -- \version "2.25.16" \relative c' { \override Staff.Clef.stencil = #ly:text-interface::print \override Staff.Clef.text = \markup { \raise #-2 \musicglyph "clefs.G" \raise #0 \musicglyph "clefs.F" \raise #-1 \musicglyph "clefs.C" \raise #0 \musicglyph "clefs.C" } \clef tenor c4 } % -- On 6/8/24 10:03, Richard Shann wrote: I think it's not uncommon for two clefs to appear side by side at the start of a piece (e.g. when a piano piece starts with both staves in bass clef so as to alert the pianist that the upper staff is not in treble clef). How is this done in LilyPond? Richard Shann -- William Rehwinkel (any pronouns) Juilliard School '26 - Oberlin Conservatory '24 will...@williamrehwinkel.net - https://williamrehwinkel.net PGP Public Key: https://ftp.williamrehwinkel.net/pubkey.txt OpenPGP_signature.asc Description: OpenPGP digital signature
Re: Two adjacent clefs
On Sat, 2024-06-08 at 08:09 -0700, Knute Snortum wrote: > On Sat, Jun 8, 2024 at 7:03 AM Richard Shann > wrote: > > I think it's not uncommon for two clefs to appear side by side at > > the > > start of a piece (e.g. when a piano piece starts with both staves > > in > > bass clef so as to alert the pianist that the upper staff is not in > > treble clef). > > How is this done in LilyPond? > > > > > It can be done with some Scheme magic. I'm assuming you want both a > treble and bass clef initial and then immediately change to another > clef? Someone wrote this (attached) for me (I really need to put the > author in the code so I can give credit where due.) All you do is > include it in your LilyPond source and write \trebleToBass or > \bassToTreble and you have what you want. Perfect! Thank you so much! Richard
Re: Two adjacent clefs
On Sat, Jun 8, 2024 at 7:03 AM Richard Shann wrote: > I think it's not uncommon for two clefs to appear side by side at the > start of a piece (e.g. when a piano piece starts with both staves in > bass clef so as to alert the pianist that the upper staff is not in > treble clef). > How is this done in LilyPond? > It can be done with some Scheme magic. I'm assuming you want both a treble and bass clef initial and then immediately change to another clef? Someone wrote this (attached) for me (I really need to put the author in the code so I can give credit where due.) All you do is include it in your LilyPond source and write \trebleToBass or \bassToTreble and you have what you want. -- Knute Snortum force-initial-clef.ily Description: Binary data
Two adjacent clefs
I think it's not uncommon for two clefs to appear side by side at the start of a piece (e.g. when a piano piece starts with both staves in bass clef so as to alert the pianist that the upper staff is not in treble clef). How is this done in LilyPond? Richard Shann