Re: addFingering
David Wright wrote: > But your response here addresses a second point, the > interpretation of \repeat unfold. Looking at my attached > example, it seems to me that you want "\repeat unfold 2 { foo }" > to behave like "foo foo" (B and C). Yes, that's exact! > But, if that's what you want, > why not write "foo foo"? "foo foo" duplicates the notes in the > source, but it isn't a textual repeat in the LP sense (like > FR, A, D and E). > > And if you want to automate it for n≫2, find/write a function > to do it. > I used \repeat unfold because I though "\repeat unfold" was done exactly for that. > I think one source of confusion might be that it's easy to use > \repeat unfold as a shorthand for what you want here, and it does > work that way at one level. However, it's really something different. > Look at the parallels between FR, and D > > People get hoisted on a vaguely similar petard when they think > that R1 * 5 is five whole-note-rests when it's more accurate > to say it's one five-whole-note-duration-rest that usually gets > set as five whole-note-rests. > In my opinion what you say makes sense for \repeat percent and \repeat volta but I continue to consider strange how does it work \repeat unfold. But I think I understand your point. Anyway I tried to use the nCopy function Nalesnik and Thibault wrote me. They work perfectly. I will use them copiously :) Really thank you for your explication, I sincerely appreciated it. g. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
On Mon 16 Jan 2017 at 12:08:28 (+0100), Gianmaria Lari wrote: > I'm sorry, clearly there is a misunderstanding and it is probably from my > side, my apologies. > > Let's me try to explain what I mean. Try to have a look to this code and > the related output (it is attached). There seem to be two directions in which you want to change LP. The first, which my comment was directed at, was to force writing an unnecessary \relative { } inside another \relative { } construction, going from (in your example) \relative c' { somemusic. \repeat unfold 4 { c e g } somemusic. } to { \repeat unfold 2 \relative c' {c e g} } That's what I directed my "What side effect and exceptional behaviour? The orthogonality between what and what?" at. But your response here addresses a second point, the interpretation of \repeat unfold. Looking at my attached example, it seems to me that you want "\repeat unfold 2 { foo }" to behave like "foo foo" (B and C). But, if that's what you want, why not write "foo foo"? "foo foo" duplicates the notes in the source, but it isn't a textual repeat in the LP sense (like FR, A, D and E). And if you want to automate it for n≫2, find/write a function to do it. I think one source of confusion might be that it's easy to use \repeat unfold as a shorthand for what you want here, and it does work that way at one level. However, it's really something different. Look at the parallels between FR, and D People get hoisted on a vaguely similar petard when they think that R1 * 5 is five whole-note-rests when it's more accurate to say it's one five-whole-note-duration-rest that usually gets set as five whole-note-rests. Cheers, David. \include "addFingering.ly" fragment = {c' d' e' f'} %%\markup "Plain" {\fragment} %%\markup "Inversion" {\inversion c' c' \fragment} %%\markup "Transpose"{\transpose c c, \fragment} %%\markup "T(I())"{\transpose c c, {\inversion c' c' \fragment }} %%\markup "I(T())"{ \inversion c' c' {\transpose c c, \fragment }} %%\markup "repeat" {\repeat unfold 2 \fragment} \markup "addFingering" {\addFingering \fragment #"12"} \markup "R(F())" {\repeat unfold 2 {\addFingering \fragment #"12"}} \markup "F(R())" {\addFingering {\repeat unfold 2 \fragment} #"12"} \markup "A" {\addFingering {\repeat percent 2 \fragment} #"12"} \markup "B" {\addFingering {\fragment \fragment} #"12"} \markup "C" {\addFingering {\fragment \fragment} #"12345"} \markup "D" {\addFingering {\repeat unfold 2 \fragment} #"12345"} \markup "E" {\addFingering {\repeat percent 2 \fragment} #"12345"} unfold.pdf Description: Adobe PDF document ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
I'm sorry, clearly there is a misunderstanding and it is probably from my side, my apologies. Let's me try to explain what I mean. Try to have a look to this code and the related output (it is attached). \version "2.19.54" \include "addFingering.ly" fragment = {c' d' e' f'} \markup "Plain" {\fragment} \markup "Inversion" {\inversion c' c' \fragment} \markup "Transpose"{\transpose c c, \fragment} \markup "T(I())"{\transpose c c, {\inversion c' c' \fragment }} \markup "I(T())"{ \inversion c' c' {\transpose c c, \fragment }} \markup "repeat" {\repeat unfold 2 \fragment} \markup "addFingering" {\addFingering \fragment #"12"} \markup "R(F())" {\repeat unfold 2 {\addFingering \fragment #"12"}} \markup "F(R())" {\addFingering {\repeat unfold 2 \fragment} #"12"} Is it more clear now? My apologies if it seems I was shortchanging, I never had this intention. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
On Sat 14 Jan 2017 at 11:47:49 (+0100), Gianmaria Lari wrote: > > \repeat unfold is not evaluated at all. It stays a repeat expression > > until it gets interpreted. One reason it is implemented that way is in > > order to keep the repeats in > > > > \relative c' { \repeat unfold 4 { c e g } } > > > > in the same octave rather than get > > > > \relative c' { c e g c e g c e g c e g } > > > > which crosses four octaves. > > I understand this pragmatism. It is clear that in a piece when you write > something like > > \relative c' { > somemusic. > \repeat unfold 4 { c e g } > somemusic. > } > > > you expect to repeat {c e g} on the same octave. If you don't do it, > \relative became a command pretty unusable. > > But the side effect of this semantic choice looks very important to me. > We're introducing a strong exceptional behavior, don't we? > For me (this is my opinion, and of course I'm not a lilypond/musician etc. > expert) I would prefer force the user to write > > \version "2.19.54" > { > \repeat unfold 2 \relative c' {c e g} > } > > > rather than lost the orthogonality of the language. > Just my two cents. I'm feeling shortchanged. What side effect and exceptional behaviour? The orthogonality between what and what? Cheers, David. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
Gianmaria Lariwrites: >> \repeat { } >> >> generates a repeat expression. Whether that is "unfold" or not. >> And relativity works "linearly" across the expression even when >> alternatives are involved where having to write \relative each time >> would be a royal pita. >> -- >> David Kastrup > > Yes that's clear. > > But I see > > \addFingers \repeat {} > > > no different than > > > f(g()) > > It's one of my idiosyncrasy. And then I consider g() is evaluated before > f(). Which is what happens. I don't see your point. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
> \repeat { } > > generates a repeat expression. Whether that is "unfold" or not. > And relativity works "linearly" across the expression even when > alternatives are involved where having to write \relative each time > would be a royal pita. > -- > David Kastrup Yes that's clear. But I see \addFingers \repeat {} no different than f(g()) It's one of my idiosyncrasy. And then I consider g() is evaluated before f(). g. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
Gianmaria Lariwrites: >> \repeat unfold is not evaluated at all. It stays a repeat expression >> until it gets interpreted. One reason it is implemented that way is in >> order to keep the repeats in >> >> \relative c' { \repeat unfold 4 { c e g } } >> >> in the same octave rather than get >> >> \relative c' { c e g c e g c e g c e g } >> >> which crosses four octaves. > > I understand this pragmatism. It is clear that in a piece when you write > something like > > \relative c' { > somemusic. > \repeat unfold 4 { c e g } > somemusic. > } > > > you expect to repeat {c e g} on the same octave. If you don't do it, > \relative became a command pretty unusable. > > But the side effect of this semantic choice looks very important to me. > We're introducing a strong exceptional behavior, don't we? > For me (this is my opinion, and of course I'm not a lilypond/musician etc. > expert) I would prefer force the user to write > > \version "2.19.54" > { > \repeat unfold 2 \relative c' {c e g} > } > > > rather than lost the orthogonality of the language. > Just my two cents. \repeat { } generates a repeat expression. Whether that is "unfold" or not. And relativity works "linearly" across the expression even when alternatives are involved where having to write \relative each time would be a royal pita. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
> \repeat unfold is not evaluated at all. It stays a repeat expression > until it gets interpreted. One reason it is implemented that way is in > order to keep the repeats in > > \relative c' { \repeat unfold 4 { c e g } } > > in the same octave rather than get > > \relative c' { c e g c e g c e g c e g } > > which crosses four octaves. I understand this pragmatism. It is clear that in a piece when you write something like \relative c' { somemusic. \repeat unfold 4 { c e g } somemusic. } you expect to repeat {c e g} on the same octave. If you don't do it, \relative became a command pretty unusable. But the side effect of this semantic choice looks very important to me. We're introducing a strong exceptional behavior, don't we? For me (this is my opinion, and of course I'm not a lilypond/musician etc. expert) I would prefer force the user to write \version "2.19.54" { \repeat unfold 2 \relative c' {c e g} } rather than lost the orthogonality of the language. Just my two cents. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
Thank you David Kastrup and Nalesnik and Gilles for you answer your help and your explication! I don't like the idea to use a custom repeat instead of the standard. But I will make some test and see. Thank you again! ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
On Fri, Jan 13, 2017 at 7:21 PM, David Nalesnikwrote: > On Fri, Jan 13, 2017 at 11:50 AM, Gilles THIBAULT > wrote: >> Le vendredi 13 janvier 2017, 14:06:23 Gianmaria Lari a écrit : >>> I have a problem with (the fantastic) addFingering snippet. >>> >>> Here it is my simple code. >>> >>> \version "2.19.54" >>> \include "addFingering.ly" >>> >>> { >>> \addFingering {a b a b} #"12" >>> } >>> >>> { >>> \addFingering {\repeat unfold 2 {a b}} #"12" >>> } >> >> You can create your own repeat function : >> >> %%% >> >> nCopy = #(define-music-function (parser location n music)(integer? ly:music?) >> (cond >> ((> n 1)(ly:music-deep-copy (make-sequential-music (make-list n music >> ((= n 1) music) >> (else (make-music 'Music 'void #t >> >> >> \addFingering { \nCopy #2 {a b} } #"12" >> >> %%% >> > > You could also do this without \addFingering: > > nCopyNoFingerings = > #(define-music-function (parser location n music) (integer? ly:music?) >(cond > ((= n 1) > music) > ((> n 1) > (let ((stripped > (music-filter > (lambda (m) (not (music-is-of-type? m 'fingering-event))) > (ly:music-deep-copy music >(make-sequential-music > (cons music > (make-list (1- n) stripped) > (else (make-music 'Music 'void #t > > > { \nCopyNoFingerings #3 { a-1 b-2 } } And you could omit other things besides fingerings with this definition: nCopyWithout = #(define-music-function (parser location n types music) (integer? list? ly:music?) (cond ((= n 1) music) ((> n 1) (let* ((cpy (ly:music-deep-copy music)) (stripped (let loop ((t types) (result cpy)) (if (null? t) result (loop (cdr t) (music-filter (lambda (m) (not (music-is-of-type? m (car t cpy)) (make-sequential-music (cons music (make-list (1- n) stripped) (else (make-music 'Music 'void #t { \nCopyWithout #3 #'(fingering-event dynamic-event script-event) { a-1\f b-2-> } } -DN ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
On Fri, Jan 13, 2017 at 11:50 AM, Gilles THIBAULTwrote: > Le vendredi 13 janvier 2017, 14:06:23 Gianmaria Lari a écrit : >> I have a problem with (the fantastic) addFingering snippet. >> >> Here it is my simple code. >> >> \version "2.19.54" >> \include "addFingering.ly" >> >> { >> \addFingering {a b a b} #"12" >> } >> >> { >> \addFingering {\repeat unfold 2 {a b}} #"12" >> } > > You can create your own repeat function : > > %%% > > nCopy = #(define-music-function (parser location n music)(integer? ly:music?) > (cond > ((> n 1)(ly:music-deep-copy (make-sequential-music (make-list n music > ((= n 1) music) > (else (make-music 'Music 'void #t > > > \addFingering { \nCopy #2 {a b} } #"12" > > %%% > You could also do this without \addFingering: nCopyNoFingerings = #(define-music-function (parser location n music) (integer? ly:music?) (cond ((= n 1) music) ((> n 1) (let ((stripped (music-filter (lambda (m) (not (music-is-of-type? m 'fingering-event))) (ly:music-deep-copy music (make-sequential-music (cons music (make-list (1- n) stripped) (else (make-music 'Music 'void #t { \nCopyNoFingerings #3 { a-1 b-2 } } > David Kastrup explains how to make it work in \relative mode in this thread : > http://lists.gnu.org/archive/html/lilypond-user/2015-11/msg00361.html > Haven't tried adapting this to relative mode. HTH, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
Le vendredi 13 janvier 2017, 14:06:23 Gianmaria Lari a écrit : > I have a problem with (the fantastic) addFingering snippet. > > Here it is my simple code. > > \version "2.19.54" > \include "addFingering.ly" > > { > \addFingering {a b a b} #"12" > } > > { > \addFingering {\repeat unfold 2 {a b}} #"12" > } You can create your own repeat function : %%% nCopy = #(define-music-function (parser location n music)(integer? ly:music?) (cond ((> n 1)(ly:music-deep-copy (make-sequential-music (make-list n music ((= n 1) music) (else (make-music 'Music 'void #t \addFingering { \nCopy #2 {a b} } #"12" %%% David Kastrup explains how to make it work in \relative mode in this thread : http://lists.gnu.org/archive/html/lilypond-user/2015-11/msg00361.html -- Gilles ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
Gianmaria Lariwrites: > I probably figured out the reason of this behavior. The function > "addFingering" is evaluated before evaluating the repeat. So lilypond > evaluate this > > \addFingering {\repeat unfold 2 {a b}} #"12" > > > as > > \repeat unfold 2 {a-1 b-2} > > instead of > > \addFingering {a b a b} #"12" > > > But why? Is it possible to change it? \repeat unfold is not evaluated at all. It stays a repeat expression until it gets interpreted. One reason it is implemented that way is in order to keep the repeats in \relative c' { \repeat unfold 4 { c e g } } in the same octave rather than get \relative c' { c e g c e g c e g c e g } which crosses four octaves. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: addFingering
I probably figured out the reason of this behavior. The function "addFingering" is evaluated before evaluating the repeat. So lilypond evaluate this \addFingering {\repeat unfold 2 {a b}} #"12" as \repeat unfold 2 {a-1 b-2} instead of \addFingering {a b a b} #"12" But why? Is it possible to change it? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user