Re: polyphonic shorthand; line-spanner-interface in Hairpin
Thanks, Joe. I think this may be what Kieren needs. I'm pretty sure he wants to just adjust the length of the hairpin without adjusting the spacing. Carl On 3/17/09 6:40 PM, "Joe Neeman" wrote: > On Tue, 2009-03-17 at 16:47 -0600, Carl D. Sorensen wrote: >> >> >> On 3/17/09 3:48 PM, "Kieren MacMillan" >> wrote: >> >>> Hi Carl, >>> One issue that comes up in your proposal is that a 1/16 note column does not take up 1/16 of a whole note column. So exactly what space are you thinking you want? >>> >>> In the perfect scenario, I suppose Lilypond would "Do The Right Thing": >>> 1. If there were another music event at the moment the Hairpin >>> was set to begin (delayed) or end (trimmed), it would line up as >>> expected. >> >> So how about this as an explanation of DTRT? >> >> Let's assume that the hairpin is a spanner (this much is correct, I think) >> and that we know the musical length of the span (This is known because we >> have the musical moment of the start and the musical moment of the end of >> the hairpin.) >> >> Then we define the delayed start moment as the start moment of the hairpin >> plus the specified delay. >> >> We define the trimmed end moment as the end moment of the hairpin minus the >> specified trim amount. >> >> Now I'm getting very iffy. If there's a musical paper column at the >> delayed start moment and the trimmed end moment, then we would want to shift >> the spanner to those musical paper columns. >> >> If not, then we have to adjust the size of the hairpin some other way, and >> that's where things break down for me. It may be a question of adjusting >> springs and rods, but springs and rods are deep in the computational alchemy >> of LilyPond, as far as I can see. > > If you only care about adjusting the length of a hairpin without > affecting the spacing, things are fairly simple (at least conceptually; > actually writing the code might be a bit more challenging). You can get > a list of (ordered by moment) paper columns from Paper_score. If you > wait until after the page breaking is done, you can rely on the x-offset > of these columns (which you get by > paper_column->relative_coordinate(system,X_AXIS)) to be accurate. You > could do a binary search for the moment you want and then do an > interpolation if you don't find it. All of this is in the C++ code. > > If you want to allow this length to affect the spacing, it's a bit more > complicated because the spacing engine only allows you to mandate > minimum space between two columns, so you somehow have to work backwards > from the interpolation that you want to figure our how much space you > need to reserve... but if you ignore this part, the only thing it will > affect is the behaviour of 'minimum-distance, which probably isn't > crucial. > > Joe > ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
On Tue, 2009-03-17 at 16:47 -0600, Carl D. Sorensen wrote: > > > On 3/17/09 3:48 PM, "Kieren MacMillan" > wrote: > > > Hi Carl, > > > >> One issue that comes up in your proposal is that a 1/16 note column > >> does not > >> take up 1/16 of a whole note column. So exactly what space are you > >> thinking > >> you want? > > > > In the perfect scenario, I suppose Lilypond would "Do The Right Thing": > > 1. If there were another music event at the moment the Hairpin > > was set to begin (delayed) or end (trimmed), it would line up as > > expected. > > So how about this as an explanation of DTRT? > > Let's assume that the hairpin is a spanner (this much is correct, I think) > and that we know the musical length of the span (This is known because we > have the musical moment of the start and the musical moment of the end of > the hairpin.) > > Then we define the delayed start moment as the start moment of the hairpin > plus the specified delay. > > We define the trimmed end moment as the end moment of the hairpin minus the > specified trim amount. > > Now I'm getting very iffy. If there's a musical paper column at the > delayed start moment and the trimmed end moment, then we would want to shift > the spanner to those musical paper columns. > > If not, then we have to adjust the size of the hairpin some other way, and > that's where things break down for me. It may be a question of adjusting > springs and rods, but springs and rods are deep in the computational alchemy > of LilyPond, as far as I can see. If you only care about adjusting the length of a hairpin without affecting the spacing, things are fairly simple (at least conceptually; actually writing the code might be a bit more challenging). You can get a list of (ordered by moment) paper columns from Paper_score. If you wait until after the page breaking is done, you can rely on the x-offset of these columns (which you get by paper_column->relative_coordinate(system,X_AXIS)) to be accurate. You could do a binary search for the moment you want and then do an interpolation if you don't find it. All of this is in the C++ code. If you want to allow this length to affect the spacing, it's a bit more complicated because the spacing engine only allows you to mandate minimum space between two columns, so you somehow have to work backwards from the interpolation that you want to figure our how much space you need to reserve... but if you ignore this part, the only thing it will affect is the behaviour of 'minimum-distance, which probably isn't crucial. Joe ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
On 3/17/09 3:48 PM, "Kieren MacMillan" wrote: > Hi Carl, > >> One issue that comes up in your proposal is that a 1/16 note column >> does not >> take up 1/16 of a whole note column. So exactly what space are you >> thinking >> you want? > > In the perfect scenario, I suppose Lilypond would "Do The Right Thing": > 1. If there were another music event at the moment the Hairpin > was set to begin (delayed) or end (trimmed), it would line up as > expected. So how about this as an explanation of DTRT? Let's assume that the hairpin is a spanner (this much is correct, I think) and that we know the musical length of the span (This is known because we have the musical moment of the start and the musical moment of the end of the hairpin.) Then we define the delayed start moment as the start moment of the hairpin plus the specified delay. We define the trimmed end moment as the end moment of the hairpin minus the specified trim amount. Now I'm getting very iffy. If there's a musical paper column at the delayed start moment and the trimmed end moment, then we would want to shift the spanner to those musical paper columns. If not, then we have to adjust the size of the hairpin some other way, and that's where things break down for me. It may be a question of adjusting springs and rods, but springs and rods are deep in the computational alchemy of LilyPond, as far as I can see. > 2. If there were no simultaneous music event, the Hairpin would > begin/end proportionally between the immediately adjacent music events. > >> Presently, dynamic markings are tied to paper columns. Paper >> columns are >> created by layout objects, including notes. It seems to me that >> somehow you >> want to change the way dynamic markings interact with paper columns >> in order >> to get the behavior you desire. > > Probably... =( > > I just think that dynamics are currently more difficult to manipulate > than would be ideal, and I'm trying to come up with a solution. Sure, and I'm trying to help you. The problem is that padding operates by adding horizontal space, rather than reducing horizontal extent. What you want to do is to reduce the horizontal extent of the hairpin, not add extra space, I think. I don't know how to handle this problem. Perhaps Joe Neeman (the spacing guru of LilyPond) can give you a pointer or two. Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
Hi Carl, One issue that comes up in your proposal is that a 1/16 note column does not take up 1/16 of a whole note column. So exactly what space are you thinking you want? In the perfect scenario, I suppose Lilypond would "Do The Right Thing": 1. If there were another music event at the moment the Hairpin was set to begin (delayed) or end (trimmed), it would line up as expected. 2. If there were no simultaneous music event, the Hairpin would begin/end proportionally between the immediately adjacent music events. Presently, dynamic markings are tied to paper columns. Paper columns are created by layout objects, including notes. It seems to me that somehow you want to change the way dynamic markings interact with paper columns in order to get the behavior you desire. Probably... =( I just think that dynamics are currently more difficult to manipulate than would be ideal, and I'm trying to come up with a solution. Cheers, Kieren. ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
On Tue, 2009-03-17 at 06:55 -0400, Kieren MacMillan wrote: > Hello, > > Thanks to Carl's patient help, I've successfully submitted my first > patch as a Frog! > > > 1. For my next task, I was thinking of fixing the polyphonic > shorthand. Unfortunately, searching the tree for ><< > gives a couple of thousand hits... ;-) > Any hints on where that shorthand is defined would be greatly > appreciated. In parser.yy, on line 990. It might be more useful, though, to leave the parser alone and work with the scheme representation (the one you get with \displayMusic). The parser generates this by calling scheme functions from scm/ly-syntax-constructors.scm. > 2. Can Hairpin inherit line-spanner-interface? If so, can this be > done in Scheme, or does it require C++? You can "add" the line-spanner-interface by modifying scm/define-grobs.scm. This doesn't really achieve anything except to tell lilypond that it should expect users to do \override Hairpin #'some-property-in-line-spanner-interface = #foo In order to get the functionality of the properties in line-spanner-interface, every one of them needs to be implemented in the callbacks that Hairpin uses. For example, the default value of Hairpin's 'stencil is ly:hairpin::print (defined in hairpin.cc), which doesn't honor left-bound-info. So yes, some C++ hacking would be required. HTH, Joe ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
On 3/17/09 7:24 AM, "Kieren MacMillan" wrote: > Hi Mats, > >> Implementing such a feature by first trying to translate the >> duration into a numerical value and then set the padding doesn't >> seem like the best solution to me. For example, how do you handle >> the situation where there's a line break inbetween? I'd rather go >> for a solution that internally is equivalent to spacer notes in a >> parallel line of music (within the same Voice context, though), but >> where the user doesn't have to see this internal representation. > > The solution should be on in which you can specify the duration > before the dynamic starts and the duration of the dynamic itself, e.g. > > c1\< #8 #4. d2 > > would mean "put a whole note 'c', then wait an eighth note, then put > a quarter-note-length crescendo, then terminate it, then wait a half, > and put a half-note 'd'". > > Is that possible in the situation you're imagining? > If so, where/how are you thinking the implementation would go? A > Scheme function/macro/shorthand? > I imagined that perhaps the result could be accomplished by automagically creating a spacer voice with crescendos built in, so I tried it. But with crescendos attached to spacer rests, the durations were off. So then I tried it with notes: \new Voice { \relative c'{ << {c1 d2 d2} {a8 a8\< a2 a8\! a8 a2 a2} >> %\break {c1\< d2\! d2} }} This sort of gives what I imagine to be the intended results, but at the expense of a greatly stretched bar. One issue that comes up in your proposal is that a 1/16 note column does not take up 1/16 of a whole note column. So exactly what space are you thinking you want? Presently, dynamic markings are tied to paper columns. Paper columns are created by layout objects, including notes. It seems to me that somehow you want to change the way dynamic markings interact with paper columns in order to get the behavior you desire. Carl > Cheers, > Kieren. > > > ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
Hi Mats, Implementing such a feature by first trying to translate the duration into a numerical value and then set the padding doesn't seem like the best solution to me. For example, how do you handle the situation where there's a line break inbetween? I'd rather go for a solution that internally is equivalent to spacer notes in a parallel line of music (within the same Voice context, though), but where the user doesn't have to see this internal representation. The solution should be on in which you can specify the duration before the dynamic starts and the duration of the dynamic itself, e.g. c1\< #8 #4. d2 would mean "put a whole note 'c', then wait an eighth note, then put a quarter-note-length crescendo, then terminate it, then wait a half, and put a half-note 'd'". Is that possible in the situation you're imagining? If so, where/how are you thinking the implementation would go? A Scheme function/macro/shorthand? Cheers, Kieren. ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
Kieren MacMillan wrote: 2. Can Hairpin inherit line-spanner-interface? If so, can this be done in Scheme, or does it require C++? It already has the line-interface and the spanner-interface as well as 3 other interfaces. Exactly what are you missing in the Hairpin? I'd like to be able to set #'bound-details, in particular the padding: \version "2.12.2" \paper { ragged-right = ##f } hairpinBoundTest = \relative { c'4\< c\! \override Hairpin #'(bound-details right padding) = #5.0 c\< c\! } \score { \hairpinBoundTest } Eventually, I'd like to have a callback function that gives me the padding in terms of beats in the current measure (as opposed to staff spaces), so that I could "trim" a Hairpin by (e.g.) a half note. This ability would completely eliminate the need for spacer skips, extra voices, etc. Does that make sense? Implementing such a feature by first trying to translate the duration into a numerical value and then set the padding doesn't seem like the best solution to me. For example, how do you handle the situation where there's a line break inbetween? I'd rather go for a solution that internally is equivalent to spacer notes in a parallel line of music (within the same Voice context, though), but where the user doesn't have to see this internal representation. /Mats ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
Hi Mats, the bottom line is that the actual job is done in voicify-chord and voicify-list in scm/music-functions.scm. Thanks for the hint *and* the search lesson! =) 2. Can Hairpin inherit line-spanner-interface? If so, can this be done in Scheme, or does it require C++? It already has the line-interface and the spanner-interface as well as 3 other interfaces. Exactly what are you missing in the Hairpin? I'd like to be able to set #'bound-details, in particular the padding: \version "2.12.2" \paper { ragged-right = ##f } hairpinBoundTest = \relative { c'4\< c\! \override Hairpin #'(bound- details right padding) = #5.0 c\< c\! } \score { \hairpinBoundTest } Eventually, I'd like to have a callback function that gives me the padding in terms of beats in the current measure (as opposed to staff spaces), so that I could "trim" a Hairpin by (e.g.) a half note. This ability would completely eliminate the need for spacer skips, extra voices, etc. Does that make sense? Thanks, Kieren. ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: polyphonic shorthand; line-spanner-interface in Hairpin
Kieren MacMillan wrote: Hello, Thanks to Carl's patient help, I've successfully submitted my first patch as a Frog! 1. For my next task, I was thinking of fixing the polyphonic shorthand. Unfortunately, searching the tree for << gives a couple of thousand hits... ;-) Any hints on where that shorthand is defined would be greatly appreciated. If you look in lily/parser.yy, you will find that a "\\" corresponds to E_BACKSLASH, which results in a voice-separator. Grepping further in scm/* tells you that this results in a VoiceSeparator which in turn sets the music-property types to include "separator". After a thorough search in scm/*, you will finally find that this is used in the functions voicify-* in scm/music-functions.scm, which in turn are invoked by toplevel-music-functions in scorify-music ... Anyway, the bottom line is that the actual job is done in voicify-chord and voicify-list in scm/music-functions.scm. 2. Can Hairpin inherit line-spanner-interface? If so, can this be done in Scheme, or does it require C++? It already has the line-interface and the spanner-interface as well as 3 other interfaces. Exactly what are you missing in the Hairpin? /Mats ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel