Re: Pitch value of previous note
On Fri, 2021-04-30 at 16:41 +0200, David Kastrup wrote: > David Sumbler writes: > > On Fri, 2021-04-30 at 04:17 -0700, Aaron Hill wrote: > > > A duration without pitch is encoded as a NoteEvent with the > > > pitchproperty. expand-repeat-notes! is the internal procedure > > > thatcarries over the most recent pitch. So long as you insert > > > theseevents early enough, LilyPond should do the heavy lifting > > > for you. > > > > You are correct: I invented a problem where none exists. > > I confess that I had not realized that a duration without a > > precedingpitch or rest takes the pitch of the preceding note. I > > actuallythought that, following a rest, it would produce further > > rests. > > We've had a fairly recent discussion about this design choice > sometimein the last three months or so. My rationale was that it > could be usedfor writing rhythmic parts using only a single pitch or > drum type in amanner where you only had to write that pitch or drum > type once and thenkeep referencing it. That rationale also explains > a difference inbehavior with chord repeats (q) with respect to > retainedarticulations/fingerings. > > I must have seen this in action many times, otherwise I would > > havelots of pitches in my music where there should be rests. But > > somehowit doesn't seem to have lodged itself in my brain. > > Perhaps I'm getting too old for this! > > Still waiting for an actual _example_ of what you want to be able > towrite. As I indicated, I imagined a non-existent problem. With no problem to be solved, an example serves no purpose. David
Re: Pitch value of previous note
David Sumbler writes: > On Fri, 2021-04-30 at 04:17 -0700, Aaron Hill wrote: > >> A duration without pitch is encoded as a NoteEvent with the pitch >> property. expand-repeat-notes! is the internal procedure that >> carries over the most recent pitch. So long as you insert these >> events early enough, LilyPond should do the heavy lifting for you. > > You are correct: I invented a problem where none exists. > > I confess that I had not realized that a duration without a preceding > pitch or rest takes the pitch of the preceding note. I actually > thought that, following a rest, it would produce further rests. We've had a fairly recent discussion about this design choice sometime in the last three months or so. My rationale was that it could be used for writing rhythmic parts using only a single pitch or drum type in a manner where you only had to write that pitch or drum type once and then keep referencing it. That rationale also explains a difference in behavior with chord repeats (q) with respect to retained articulations/fingerings. > I must have seen this in action many times, otherwise I would have > lots of pitches in my music where there should be rests. But somehow > it doesn't seem to have lodged itself in my brain. > > Perhaps I'm getting too old for this! Still waiting for an actual _example_ of what you want to be able to write. -- David Kastrup
Re: Pitch value of previous note
On Fri, 2021-04-30 at 04:17 -0700, Aaron Hill wrote: > On 2021-04-30 3:39 am, David Sumbler wrote: > > I want to be able to insert a note of the same pitch as the preceding > > one. I don't mind what form the pitch information is in, so long as I > > can use it to create a new note. It could, for example, be in the form > > "b,,", or something similar to "(-2, 6)" as used by ly:make-pitch. > > There may be other possibilities. > > What about the existing pitch-repeating functionality in LilyPond? > > > \version "2.22.0" > > foo = { 4 4 } > { b'2 \foo g' \foo } > > > A duration without pitch is encoded as a NoteEvent with the pitch > property. expand-repeat-notes! is the internal procedure that carries > over the most recent pitch. So long as you insert these events early > enough, LilyPond should do the heavy lifting for you. You are correct: I invented a problem where none exists. I confess that I had not realized that a duration without a preceding pitch or rest takes the pitch of the preceding note. I actually thought that, following a rest, it would produce further rests. I must have seen this in action many times, otherwise I would have lots of pitches in my music where there should be rests. But somehow it doesn't seem to have lodged itself in my brain. Perhaps I'm getting too old for this! David
Re: Pitch value of previous note
Mark Knoop writes: > At 12:15 on 30 Apr 2021, David Kastrup wrote: >> David Sumbler writes: >>> How can I access the pitch value of this most recent note for use in a >>> Scheme function after some rests? >> >> Other value-propating mechanisms exist for default durations (attached >> by the parser upon reading expressions), pitch-less durations (added >> during the scorifying stage when a music expression is accepted into a >> \score block), chord repeats (also at scorification). >> >> "For use in a Scheme function" is too hand-waving to have an idea which >> phase of LilyPond's interpretation you would want to be interfering >> with, so it would probably make more sense to present the problem you >> are trying to solve rather than guess about the tools you think LilyPond >> must be using internally. > > I don't know what David (Sumbler)'s use-case is, but one could imagine > in an analysis situation something like: > > { c'1 g'1-\intervalFunction } > > where 'intervalFunction' created the markup string "Perfect 5th above > previous pitch". That's the kind of thing where the context available to \intervalFunction is just not sufficient for the task and it would have to leave a marker in place that is later on replaced by some more globally working score-wide function, similar to how repeat pitches and repeat chords work. -- David Kastrup
Re: Pitch value of previous note
At 12:15 on 30 Apr 2021, David Kastrup wrote: David Sumbler writes: How can I access the pitch value of this most recent note for use in a Scheme function after some rests? Other value-propating mechanisms exist for default durations (attached by the parser upon reading expressions), pitch-less durations (added during the scorifying stage when a music expression is accepted into a \score block), chord repeats (also at scorification). "For use in a Scheme function" is too hand-waving to have an idea which phase of LilyPond's interpretation you would want to be interfering with, so it would probably make more sense to present the problem you are trying to solve rather than guess about the tools you think LilyPond must be using internally. I don't know what David (Sumbler)'s use-case is, but one could imagine in an analysis situation something like: { c'1 g'1-\intervalFunction } where 'intervalFunction' created the markup string "Perfect 5th above previous pitch". -- Mark Knoop
Re: Pitch value of previous note
On 2021-04-30 4:17 am, Aaron Hill wrote: On 2021-04-30 3:39 am, David Sumbler wrote: I want to be able to insert a note of the same pitch as the preceding one. I don't mind what form the pitch information is in, so long as I can use it to create a new note. It could, for example, be in the form "b,,", or something similar to "(-2, 6)" as used by ly:make-pitch. There may be other possibilities. What about the existing pitch-repeating functionality in LilyPond? \version "2.22.0" foo = { 4 4 } { b'2 \foo g' \foo } A duration without pitch is encoded as a NoteEvent with the pitch property. expand-repeat-notes! is the internal procedure that carries over the most recent pitch. So long as you insert these events early enough, LilyPond should do the heavy lifting for you. Sorry, that was meant to say: "*without* the pitch property". -- Aaron Hill
Re: Pitch value of previous note
On 2021-04-30 3:39 am, David Sumbler wrote: I want to be able to insert a note of the same pitch as the preceding one. I don't mind what form the pitch information is in, so long as I can use it to create a new note. It could, for example, be in the form "b,,", or something similar to "(-2, 6)" as used by ly:make-pitch. There may be other possibilities. What about the existing pitch-repeating functionality in LilyPond? \version "2.22.0" foo = { 4 4 } { b'2 \foo g' \foo } A duration without pitch is encoded as a NoteEvent with the pitch property. expand-repeat-notes! is the internal procedure that carries over the most recent pitch. So long as you insert these events early enough, LilyPond should do the heavy lifting for you. -- Aaron Hill
Re: Pitch value of previous note
David Sumbler writes: > On Fri, 2021-04-30 at 12:15 +0200, David Kastrup wrote: >> David Sumbler writes: >> > In a \relative{ } passage, in order for Lilypond to work out >> > theabsolute pitch of a note, it must have a record of the absolute >> > pitchof the previous note, even if there have been some intervening >> > rests. It seems probable that it has this information in all cases, >> > whetherrelative pitch notation is being used or not. >> >> No. \relative is a purely transformative function that takes music >> asinput and produces music (with a wrapping container of >> typeRelativeOctaveMusic that prevents further applications of >> \relative fromhaving an effect). >> This happens immediately as a transform when \relative is >> beingexecuted. >> > How can I access the pitch value of this most recent note for use >> > in aScheme function after some rests? >> >> Other value-propating mechanisms exist for default durations >> (attachedby the parser upon reading expressions), pitch-less >> durations (addedduring the scorifying stage when a music expression >> is accepted into a\score block), chord repeats (also at >> scorification). >> "For use in a Scheme function" is too hand-waving to have an idea >> whichphase of LilyPond's interpretation you would want to be >> interferingwith, so it would probably make more sense to present the >> problem youare trying to solve rather than guess about the tools you >> think LilyPondmust be using internally. > > I want to be able to insert a note of the same pitch as the preceding > one. No, you want LilyPond to do that. But you fail to say when you want it to do that and why you want it to do that, and why the existing input methods don't cover it. > I don't mind what form the pitch information is in, so long as I can > use it to create a new note. It could, for example, be in the form > "b,,", or something similar to "(-2, 6)" as used by ly:make-pitch. > There may be other possibilities. How about you give an example of what you want to do? As long as you talk generics about LilyPond internals you assume must be there somewhere, it is completely impossible to figure out whether one can map what LilyPond has to what you want to achieve. -- David Kastrup
Re: Pitch value of previous note
On Fri, 2021-04-30 at 12:15 +0200, David Kastrup wrote: > David Sumbler writes: > > In a \relative{ } passage, in order for Lilypond to work out > > theabsolute pitch of a note, it must have a record of the absolute > > pitchof the previous note, even if there have been some intervening > > rests. It seems probable that it has this information in all cases, > > whetherrelative pitch notation is being used or not. > > No. \relative is a purely transformative function that takes music > asinput and produces music (with a wrapping container of > typeRelativeOctaveMusic that prevents further applications of > \relative fromhaving an effect). > This happens immediately as a transform when \relative is > beingexecuted. > > How can I access the pitch value of this most recent note for use > > in aScheme function after some rests? > > Other value-propating mechanisms exist for default durations > (attachedby the parser upon reading expressions), pitch-less > durations (addedduring the scorifying stage when a music expression > is accepted into a\score block), chord repeats (also at > scorification). > "For use in a Scheme function" is too hand-waving to have an idea > whichphase of LilyPond's interpretation you would want to be > interferingwith, so it would probably make more sense to present the > problem youare trying to solve rather than guess about the tools you > think LilyPondmust be using internally. I want to be able to insert a note of the same pitch as the preceding one. I don't mind what form the pitch information is in, so long as I can use it to create a new note. It could, for example, be in the form "b,,", or something similar to "(-2, 6)" as used by ly:make-pitch. There may be other possibilities. David
Re: Pitch value of previous note
David Sumbler writes: > In a \relative{ } passage, in order for Lilypond to work out the > absolute pitch of a note, it must have a record of the absolute pitch > of the previous note, even if there have been some intervening rests. > It seems probable that it has this information in all cases, whether > relative pitch notation is being used or not. No. \relative is a purely transformative function that takes music as input and produces music (with a wrapping container of type RelativeOctaveMusic that prevents further applications of \relative from having an effect). This happens immediately as a transform when \relative is being executed. > How can I access the pitch value of this most recent note for use in a > Scheme function after some rests? Other value-propating mechanisms exist for default durations (attached by the parser upon reading expressions), pitch-less durations (added during the scorifying stage when a music expression is accepted into a \score block), chord repeats (also at scorification). "For use in a Scheme function" is too hand-waving to have an idea which phase of LilyPond's interpretation you would want to be interfering with, so it would probably make more sense to present the problem you are trying to solve rather than guess about the tools you think LilyPond must be using internally. -- David Kastrup