Embedded Lilypond
I monitor the Dokuwiki* mailing list and today an interesting question came up. A user was trying to set a song with guitar chords over the relevant notes, but proportional text was destroying his formatting. A couple of solutions were proposed: override the proportional text (which needn't concern us here) or use an ABC plugin. The latter hasn't been maintained for years. This got me thinking! Wikipedia has the markup, would it be possible to do something similar for Dokuwiki? Is there an embeddable version of Lily? I see two possible strategies here: (1) Use DW's media manager to keep a .ly file and engrave from the file to generate output, or (2) use an inline source. In either case the output needs to be embeddable HTML (and if possible a MIDI track). Thoughts? *For the interested: Dokuwiki (https://www.dokuwiki.org/dokuwiki) is a wiki system based on plain text files and a php formatter. Like Lily it is designed to be extensible by the use of plugins, which users are encouraged to publish. signature.asc Description: OpenPGP digital signature ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Simon Albrecht writes: > On 20.06.2018 11:18, Urs Liska wrote: >> (let* >> ((elts (ly:music-property mus 'elements)) >> (cnt (length elts) > > OT: Is ‘cnt’ a common abbreviation in programming? Because it would > seem to me like it’s too close to offensive… "count" doesn't seem that much better. Nor does "gown". Let me quote from Shakespeare's "Henry V": KATHARINE Ainsi dis-je; de elbow, de nick, et de sin. Comment appelez-vous le pied et la robe? ALICE De foot, madame; et de coun. KATHARINE De foot et de coun! O Seigneur Dieu! ce sont mots de son mauvais, corruptible, gros, et impudique, et non pour les dames d'honneur d'user: je ne voudrais prononcer ces mots devant les seigneurs de France pour tout le monde. Foh! le foot et le coun! Neanmoins, je reciterai une autre fois ma lecon ensemble: de hand, de fingres, de nails, de arm, de elbow, de nick, de sin, de foot, de coun. ALICE Excellent, madame! At any rate, "cnt" does not seem all that bad considering that Scheme would also permit asterisks into identifiers like "c*nt". Which, taking common wildcard rules, could still stand in for "count" but I doubt people would interpret it that way. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
On 20.06.2018 11:18, Urs Liska wrote: (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts) OT: Is ‘cnt’ a common abbreviation in programming? Because it would seem to me like it’s too close to offensive… Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
On 6/20/18, 6:45 AM, "Urs Liska" wrote: PS: As to the *why* I have the vague recollection that beaming rules define where beams can be *ended*. This would explain why the beam before the break doesn't work but the one after does. Automatic beaming starts when a beamable note is encountered and ends when a non-beamable note is encountered or a beam *must* end. If the music ends (say by a \bar" " \break or by hitting the end of a voice) before the required end of a beam is met or a non-beamable note is encountered, no beam is created. At the present time, the autobeam code doesn't grab a whole measure's worth of notes and then decide about the beaming; instead it makes decisions on a note-by-note basis. It would be nice to have a better autobeaming algorithm, and Urs and I are both looking at it. For now, anytime the autobeamer doesn't work right, just manually beam, and that resolves all of the problems. Thanks, Carl ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Hi Phil, On Wed, Jun 20, 2018 at 2:26 PM Phil Holmes wrote: > > You could keep making odd examples of undefined beaming until the cows > come home, but surely it would be a lot quicker just to beam manually??? > I suppose, actually (and I'll talk to Urs about this) that since the sources I'm working from have their own idiosyncratic beaming (beaming over rests and grouped at the half-note, for example) that it might make sense at some point to define a stylesheet for each section, so that Lily knows in advance what the beaming scheme should be. Cheers, A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Am 20. Juni 2018 14:26:51 MESZ schrieb Phil Holmes : >Well, > >This example is almost identical to your first example. A beamed note >is broken by a bar and break and the beam is broken. Lily doesn't know >how to beam them. The 2 leftover notes are beamed in both examples - >again i don't know why, but it's quite consistent behaviour and >consistent with lily not knowing what you intend until you tell her. > >You could keep making odd examples of undefined beaming until the cows >come home, but surely it would be a lot quicker just to beam >manually??? The problem is that this break is conditional, so it's not clear before whether there will be a break within the measure. \time 3/4 c8 [ c c c c c ] Vs c8 [ c c c ] \bar "" \break c [ c ] That looks like a prime case for the \choice command I'll be doing shortly. Urs PS: As to the *why* I have the vague recollection that beaming rules define where beams can be *ended*. This would explain why the beam before the break doesn't work but the one after does. > >-- >Phil Holmes > > > - Original Message - > From: N. Andrew Walsh > To: Phil Holmes > Cc: lilypond-user > Sent: Wednesday, June 20, 2018 12:30 PM > Subject: Re: weird de-beaming behavior > > > Hi Phil, > >On Wed, Jun 20, 2018 at 1:18 PM Phil Holmes >wrote: > >I'm no expert on lily's beaming system. However, in your second >example you don't break an existing beam with a bar/line break, so it's >rather different from the first where the "correct" beaming was broken. > > >Not knowing anything about how Lily works, I'm inclined to agree. in >3/4 (at least here) a measure comprising only 8th-notes will be beamed >straight through, thus (pseudo code): > > > e8[ e c' c c c c] > > > Whereas a 4/4 bar is beamed in two groups of four. > > >So you're correct, that there's something going on with default beaming >being broken up. In fact, with the following MWE (also in 4/4): > > > \version "2.19.80" > > > \relative c'' { > > > c e, g8 a > \bar "" \break > g e g16 a b8 > } > > >the "g8 a" at the end of the first line is *also* broken into two >unbeamed 8th-notes, but the two that follow the break do not. Why would >this be? > > > Cheers, > > > A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
"N. Andrew Walsh" writes: > Hi Phil, > On Wed, Jun 20, 2018 at 1:18 PM Phil Holmes wrote: > >> I'm no expert on lily's beaming system. However, in your second example >> you don't break an existing beam with a bar/line break, so it's rather >> different from the first where the "correct" beaming was broken. >> >> > Not knowing anything about how Lily works, I'm inclined to agree. in 3/4 > (at least here) a measure comprising only 8th-notes will be beamed straight > through, thus (pseudo code): >From "Automatic beams" in the manual: _Beams across line breaks_ Line breaks are normally forbidden when beams cross bar lines. This behavior can be changed as shown: \relative c'' { \override Beam.breakable = ##t c8 c[ c] c[ c] c[ c] c[ \break c8] c[ c] c[ c] c[ c] c } [image src="lilypond/b3/lily-4c62e333.png" alt="[image of music]" text="image of music"] Can this be related? -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Well, This example is almost identical to your first example. A beamed note is broken by a bar and break and the beam is broken. Lily doesn't know how to beam them. The 2 leftover notes are beamed in both examples - again i don't know why, but it's quite consistent behaviour and consistent with lily not knowing what you intend until you tell her. You could keep making odd examples of undefined beaming until the cows come home, but surely it would be a lot quicker just to beam manually??? -- Phil Holmes - Original Message - From: N. Andrew Walsh To: Phil Holmes Cc: lilypond-user Sent: Wednesday, June 20, 2018 12:30 PM Subject: Re: weird de-beaming behavior Hi Phil, On Wed, Jun 20, 2018 at 1:18 PM Phil Holmes wrote: I'm no expert on lily's beaming system. However, in your second example you don't break an existing beam with a bar/line break, so it's rather different from the first where the "correct" beaming was broken. Not knowing anything about how Lily works, I'm inclined to agree. in 3/4 (at least here) a measure comprising only 8th-notes will be beamed straight through, thus (pseudo code): e8[ e c' c c c c] Whereas a 4/4 bar is beamed in two groups of four. So you're correct, that there's something going on with default beaming being broken up. In fact, with the following MWE (also in 4/4): \version "2.19.80" \relative c'' { c e, g8 a \bar "" \break g e g16 a b8 } the "g8 a" at the end of the first line is *also* broken into two unbeamed 8th-notes, but the two that follow the break do not. Why would this be? Cheers, A___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Hi Phil, On Wed, Jun 20, 2018 at 1:18 PM Phil Holmes wrote: > I'm no expert on lily's beaming system. However, in your second example > you don't break an existing beam with a bar/line break, so it's rather > different from the first where the "correct" beaming was broken. > > Not knowing anything about how Lily works, I'm inclined to agree. in 3/4 (at least here) a measure comprising only 8th-notes will be beamed straight through, thus (pseudo code): e8[ e c' c c c c] Whereas a 4/4 bar is beamed in two groups of four. So you're correct, that there's something going on with default beaming being broken up. In fact, with the following MWE (also in 4/4): \version "2.19.80" \relative c'' { c e, g8 a \bar "" \break g e g16 a b8 } the "g8 a" at the end of the first line is *also* broken into two unbeamed 8th-notes, but the two that follow the break do not. Why would this be? Cheers, A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
I'm no expert on lily's beaming system. However, in your second example you don't break an existing beam with a bar/line break, so it's rather different from the first where the "correct" beaming was broken. -- Phil Holmes - Original Message - From: N. Andrew Walsh To: Phil Holmes Cc: lilypond-user Sent: Wednesday, June 20, 2018 11:27 AM Subject: Re: weird de-beaming behavior Hi Phil, thanks for your message. The thing is, here's another example: \version "2.19.80" \relative c'' { c e, g16 a b8 \bar "" \break r e, g16 a b8 } The 'g16 a b8' in the first line is beamed correctly. Is this something peculiar to 3/4 time? Cheers, A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
"N. Andrew Walsh" writes: > Hi David > On Wed, Jun 20, 2018 at 12:33 PM David Kastrup wrote: > >> >> In this case you have 3 beats before the break. The bar is complete. >> In your first example you had only two. >> > > Both MWEs are complete in themselves, thus the latter, with no \time > statement, is in the default 4/4. Sorry, I should have made that more > explicit. Would have helped against casual reading. Of which, for better or worse, some can be expected in Usenet groups. There is some special property only for 3-based meters (?) for half-bar beaming. I have no idea whether its implementation might be involved with that. Apart from beaming exceptions for 4/4 that sort of is what I can think of right now which could be different. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Hi David On Wed, Jun 20, 2018 at 12:33 PM David Kastrup wrote: > > In this case you have 3 beats before the break. The bar is complete. > In your first example you had only two. > Both MWEs are complete in themselves, thus the latter, with no \time statement, is in the default 4/4. Sorry, I should have made that more explicit. Cheers, A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: avoid orphan
My apologies, my msg. was not clear. I wanted the score and the text on the same page. I tried with \noPageBreak and it works well. I will test also the header later. Thanks a lot Jan and Malte On Wed, 20 Jun 2018 at 10:43, Jan-Peter Voigt wrote: > Hi Gianmaria, > > like Malte already pointed out, you can use the header field piece. If > your intention is something else, I guess you are looking for \noPageBreak: > > \score { > {a b c' d'} > \layout {} > \header { piece = "Etude" } > } > > \markup "Etude" > \noPageBreak > {a b c' d'} > > > HTH > Jan-Peter > > Am 20.06.2018 um 10:15 schrieb Gianmaria Lari: > > I have a code similar to this > > > > \version "2.19.81" > > \markup "Etude" > > {a b c' d'} > > > > \markup "Etude" > > {a b c' d'} > > [.] > > > > Is there any way to keep the markup and score together? > > > > > > ___ > > lilypond-user mailing list > > lilypond-user@gnu.org > > https://lists.gnu.org/mailman/listinfo/lilypond-user > > > > > ___ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
"N. Andrew Walsh" writes: > Hi Phil, > > thanks for your message. The thing is, here's another example: > > \version "2.19.80" > > \relative c'' { > > c e, g16 a b8 > \bar "" \break > r e, g16 a b8 > } > > The 'g16 a b8' in the first line is beamed correctly. Is this something > peculiar to 3/4 time? In this case you have 3 beats before the break. The bar is complete. In your first example you had only two. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Urs Liska writes: > Am 20.06.2018 um 11:38 schrieb David Kastrup: > >> #(define-macro (define-my-custom-function . body) >>`(define-music-function (mus) (ly:music?) >> (let* >>((elts (ly:music-property mus 'elements)) >> (cnt (length elts))) >> ,@body >> mus))) >> >> That's what one would call a pretty unhygienic macro since it messes >> with a number of symbols/identifiers not specified by the user. > > Hm, valid point. But I think it is worth it given the use case (I will > experiment and keep your point in mind, though). By the way, you'll probably arrive at something like #(define-macro (define-my-custom-function maybe-doc . body) `(define-music-function (mus) (ly:music?) ,(if (string? maybe-doc) maybe-doc "define-my-custom-function was here") (let* ((elts ... ,@(if (string? maybe-doc) body (cons maybe-doc body))) in order to let the user potentially specify a doc string. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
Hi Phil, thanks for your message. The thing is, here's another example: \version "2.19.80" \relative c'' { c e, g16 a b8 \bar "" \break r e, g16 a b8 } The 'g16 a b8' in the first line is beamed correctly. Is this something peculiar to 3/4 time? Cheers, A > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: weird de-beaming behavior
It strikes me that, by forcing a line break in the middle of a beam and in the middle of a bar, you make it difficult for lily to work out what beaming you actually want. Simple workaround: [ ] - manual beaming for this unusual situation. -- Phil Holmes - Original Message - From: N. Andrew Walsh To: lilypond-user Sent: Wednesday, June 20, 2018 10:26 AM Subject: weird de-beaming behavior Hi List, I have the following MWE: \version "2.19.80" \relative c'' { \time 3/4 e8 d16 c d8 d \bar "" \break g, f'~ } Notice that the last two eighth-notes in that first line, in this case, are un-beamed. However, when I comment out the next line (starting with the \bar) the notes are beamed together. This seems … unintended, and also undesirable. Can you confirm that this breaks for you as well, and let me know if there's a workaround, if this is a bug, or what? Cheers, A -- ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Hi Urs, just one pointer on Davids message (thank you!): in my example the code has to be a singular expression, which is the case in most of my cases where I use let or begin. If you want to use more than one statement use the optional-argument-dot (define-my-custom-function . code) and unquote splice ,@code Jan-Peter Am 20.06.2018 um 11:42 schrieb Urs Liska: Hi Jan-Peter, thanks for the quick response! Am 20.06.2018 um 11:35 schrieb Jan-Peter Voigt: Hi Urs, define-macro is the method you are looking for: Indeed, that's what I need. I might have managed to look that up myself, but I think that with the quoting stuff in place it would have driven me crazy before I'd reached anything ;-) %%% \version "2.19.80" % define macro #(define-macro (define-my-custom-function code) ; all wrapping code is (semi)quoted `(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) ,code ; insert (unquoted) user generated code mus))) % use macro myFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) % use function { \myFunc { c' e' } } %%% HTH It does, and I think I can go from here myself. Thanks Urs Jan-Peter Am 20.06.2018 um 11:18 schrieb Urs Liska: I'm providing users with the option to configure some behaviour by providing custom styling functions. These functions must have a certain interface and will typically retrieve the same information from their arguments. I would like to simplify this task by providing a "function template". I think this may be achieved by macros or some other syntactic extension mechansim, but I have no idea about how to go forward with that. This is what currently a user would have to do: \version "2.19.80" myFunc = #(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) (ly:message "The music has ~a elements" cnt) mus)) { \myFunc { c' e' } } Create a music function with one ly:music? argument and extract some information from the music expression (of course this is just an example, in the real case it's a custom object attached to the music). What I would like to have is what define-music-function does here but with a pre-set argument list and essentially the let* bindings transparently done so that something like this is possible: userFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) where one ly:music? argument is implicitly expected and the bindings like 'cnt' have already been prepared. Is this possible? I would assume so, and I'd also would assume it's quite easy - once you know what to look for. Thanks Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Am 20.06.2018 um 11:38 schrieb David Kastrup: Urs Liska writes: \version "2.19.80" myFunc = #(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) (ly:message "The music has ~a elements" cnt) mus)) { \myFunc { c' e' } } Create a music function with one ly:music? argument and extract some information from the music expression (of course this is just an example, in the real case it's a custom object attached to the music). What I would like to have is what define-music-function does here but with a pre-set argument list and essentially the let* bindings transparently done so that something like this is possible: userFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) where one ly:music? argument is implicitly expected and the bindings like 'cnt' have already been prepared. #(define-macro (define-my-custom-function . body) `(define-music-function (mus) (ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) ,@body mus))) That's what one would call a pretty unhygienic macro since it messes with a number of symbols/identifiers not specified by the user. Hm, valid point. But I think it is worth it given the use case (I will experiment and keep your point in mind, though). Best Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Hi Jan-Peter, thanks for the quick response! Am 20.06.2018 um 11:35 schrieb Jan-Peter Voigt: Hi Urs, define-macro is the method you are looking for: Indeed, that's what I need. I might have managed to look that up myself, but I think that with the quoting stuff in place it would have driven me crazy before I'd reached anything ;-) %%% \version "2.19.80" % define macro #(define-macro (define-my-custom-function code) ; all wrapping code is (semi)quoted `(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) ,code ; insert (unquoted) user generated code mus))) % use macro myFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) % use function { \myFunc { c' e' } } %%% HTH It does, and I think I can go from here myself. Thanks Urs Jan-Peter Am 20.06.2018 um 11:18 schrieb Urs Liska: I'm providing users with the option to configure some behaviour by providing custom styling functions. These functions must have a certain interface and will typically retrieve the same information from their arguments. I would like to simplify this task by providing a "function template". I think this may be achieved by macros or some other syntactic extension mechansim, but I have no idea about how to go forward with that. This is what currently a user would have to do: \version "2.19.80" myFunc = #(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) (ly:message "The music has ~a elements" cnt) mus)) { \myFunc { c' e' } } Create a music function with one ly:music? argument and extract some information from the music expression (of course this is just an example, in the real case it's a custom object attached to the music). What I would like to have is what define-music-function does here but with a pre-set argument list and essentially the let* bindings transparently done so that something like this is possible: userFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) where one ly:music? argument is implicitly expected and the bindings like 'cnt' have already been prepared. Is this possible? I would assume so, and I'd also would assume it's quite easy - once you know what to look for. Thanks Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Urs Liska writes: > \version "2.19.80" > > myFunc = > #(define-music-function (mus)(ly:music?) >(let* > ((elts (ly:music-property mus 'elements)) > (cnt (length elts))) > (ly:message "The music has ~a elements" cnt) > mus)) > > { > \myFunc { c' e' } > } > > Create a music function with one ly:music? argument and extract some > information from the music expression (of course this is just an > example, in the real case it's a custom object attached to the music). > > What I would like to have is what define-music-function does here but > with a pre-set argument list and essentially the let* bindings > transparently done so that something like this is possible: > > userFunc = > #(define-my-custom-function >(ly:message "The music has ~a elements" cnt)) > > where one ly:music? argument is implicitly expected and the bindings > like 'cnt' have already been prepared. #(define-macro (define-my-custom-function . body) `(define-music-function (mus) (ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) ,@body mus))) That's what one would call a pretty unhygienic macro since it messes with a number of symbols/identifiers not specified by the user. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Function template (or whatever it's called)
Hi Urs, define-macro is the method you are looking for: %%% \version "2.19.80" % define macro #(define-macro (define-my-custom-function code) ; all wrapping code is (semi)quoted `(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) ,code ; insert (unquoted) user generated code mus))) % use macro myFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) % use function { \myFunc { c' e' } } %%% HTH Jan-Peter Am 20.06.2018 um 11:18 schrieb Urs Liska: I'm providing users with the option to configure some behaviour by providing custom styling functions. These functions must have a certain interface and will typically retrieve the same information from their arguments. I would like to simplify this task by providing a "function template". I think this may be achieved by macros or some other syntactic extension mechansim, but I have no idea about how to go forward with that. This is what currently a user would have to do: \version "2.19.80" myFunc = #(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) (ly:message "The music has ~a elements" cnt) mus)) { \myFunc { c' e' } } Create a music function with one ly:music? argument and extract some information from the music expression (of course this is just an example, in the real case it's a custom object attached to the music). What I would like to have is what define-music-function does here but with a pre-set argument list and essentially the let* bindings transparently done so that something like this is possible: userFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) where one ly:music? argument is implicitly expected and the bindings like 'cnt' have already been prepared. Is this possible? I would assume so, and I'd also would assume it's quite easy - once you know what to look for. Thanks Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: dynamics and line spanning
Reilly Farrell writes: > Hi All, > > Is there an easy way to configure dynamics and markup text so that they > occupy they share the same vertical alignment relative to the staff? My > hope is that I can align regular dynamic marks with special dynamic > instructions (\cresc won't cut it in this case) as seamlessly as possible. > Example below: > > c1\p c1 c1\markup{\italic { cresc. poco a poco } } c1 > > Any assistance is appreciated. Thank you! { c1\p c1 c1$(make-dynamic-script #{ \markup \normal-text \italic \line { cresc. poco a poco } #}) c1 } -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
weird de-beaming behavior
Hi List, I have the following MWE: \version "2.19.80" \relative c'' { \time 3/4 e8 d16 c d8 d \bar "" \break g, f'~ } Notice that the last two eighth-notes in that first line, in this case, are un-beamed. However, when I comment out the next line (starting with the \bar) the notes are beamed together. This seems … unintended, and also undesirable. Can you confirm that this breaks for you as well, and let me know if there's a workaround, if this is a bug, or what? Cheers, A ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Function template (or whatever it's called)
I'm providing users with the option to configure some behaviour by providing custom styling functions. These functions must have a certain interface and will typically retrieve the same information from their arguments. I would like to simplify this task by providing a "function template". I think this may be achieved by macros or some other syntactic extension mechansim, but I have no idea about how to go forward with that. This is what currently a user would have to do: \version "2.19.80" myFunc = #(define-music-function (mus)(ly:music?) (let* ((elts (ly:music-property mus 'elements)) (cnt (length elts))) (ly:message "The music has ~a elements" cnt) mus)) { \myFunc { c' e' } } Create a music function with one ly:music? argument and extract some information from the music expression (of course this is just an example, in the real case it's a custom object attached to the music). What I would like to have is what define-music-function does here but with a pre-set argument list and essentially the let* bindings transparently done so that something like this is possible: userFunc = #(define-my-custom-function (ly:message "The music has ~a elements" cnt)) where one ly:music? argument is implicitly expected and the bindings like 'cnt' have already been prepared. Is this possible? I would assume so, and I'd also would assume it's quite easy - once you know what to look for. Thanks Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: avoid orphan
Hi Gianmaria, like Malte already pointed out, you can use the header field piece. If your intention is something else, I guess you are looking for \noPageBreak: \score { {a b c' d'} \layout {} \header { piece = "Etude" } } \markup "Etude" \noPageBreak {a b c' d'} HTH Jan-Peter Am 20.06.2018 um 10:15 schrieb Gianmaria Lari: I have a code similar to this \version "2.19.81" \markup "Etude" {a b c' d'} \markup "Etude" {a b c' d'} [.] Is there any way to keep the markup and score together? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: avoid orphan
Am 20.06.2018 um 10:15 schrieb Gianmaria Lari: I have a code similar to this \version "2.19.81" \markup "Etude" {a b c' d'} \markup "Etude" {a b c' d'} [.] Is there any way to keep the markup and score together? What do you mean by “together”? And have you considered to use \header { piece = "Etude" } ? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
avoid orphan
I have a code similar to this \version "2.19.81" \markup "Etude" {a b c' d'} \markup "Etude" {a b c' d'} [.] Is there any way to keep the markup and score together? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user