Re: Enhancement: string bends (issue216051)

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Carl.D.Sorensen
Marc,

I'm sorry I was so slow on this.  My life has been crazy recently.

I think your work on this is headed down the right path.

Thanks,

Carl



http://codereview.appspot.com/216051/diff/1/2
File bend-implementation-roadmap.txt (right):

http://codereview.appspot.com/216051/diff/1/2#newcode43
bend-implementation-roadmap.txt:43: Step 1: Creating the basic
infrastructure
Excellent!

http://codereview.appspot.com/216051/diff/1/2#newcode47
bend-implementation-roadmap.txt:47: Step 2: Building the StringBend
engraver for normal staves
Yes.  The string bend engraver creates the string bend indication as a
spanner.

http://codereview.appspot.com/216051/diff/1/2#newcode56
bend-implementation-roadmap.txt:56: Step 4: Extending properties for
TabNoteHead
No, we don't need a 'style property.  We have the bend amount as an
articulation or from a string-bend-event.  What would the style do

http://codereview.appspot.com/216051/diff/1/2#newcode59
bend-implementation-roadmap.txt:59: read the bend-reference-pitch vector
(provided by the
The bend-reference-pitch vector should be stored as a private member of
the Tab_note_heads engraver, rather than in the String_bend_engraver.

All the String_bend_engraver has to do is draw a pointy slur between two
note-heads, and the Tab_string_bend_engraver draws a curved arrow
between two tab-note-heads.

http://codereview.appspot.com/216051/diff/1/2#newcode65
bend-implementation-roadmap.txt:65: - provides the bend-reference-pitch
vector (TabStringBend #'bend-reference-pitch)
I don't think this is the right way to go.  The easiest thing to do is
to store the reference pitches in the Tab_note_heads engraver, since
that engraver already has to listen to the pitches and change the notes
as necessary.

http://codereview.appspot.com/216051/diff/2001/2002#newcode95
bend-implementation-roadmap.txt:95:
This seems reasonable to me.  You may want to have
chord_bend_reference_pitches and note_bend_reference_pitch

http://codereview.appspot.com/216051/diff/2001/2002#newcode135
bend-implementation-roadmap.txt:135: and if *every* TabNoteHead in a
note column has the style 'parenthezied, the
Yes, I agree with this change.  The TabNoteHeads engraver should just
look for bend-events in order to change the note head.

http://codereview.appspot.com/216051/show

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
[hidden email] schrieb:
> Marc,
>
> I'm sorry I was so slow on this.  My life has been crazy recently.
No problem at all! I hope it's getting less crazy now ...

>
> I think your work on this is headed down the right path.
>
> Thanks,
>
> Carl
>
>
>
> http://codereview.appspot.com/216051/diff/1/2
> File bend-implementation-roadmap.txt (right):
>
> http://codereview.appspot.com/216051/diff/1/2#newcode43
> bend-implementation-roadmap.txt:43: Step 1: Creating the basic
> infrastructure
> Excellent!
>
> http://codereview.appspot.com/216051/diff/1/2#newcode47
> bend-implementation-roadmap.txt:47: Step 2: Building the StringBend
> engraver for normal staves
> Yes.  The string bend engraver creates the string bend indication as a
> spanner.
>
> http://codereview.appspot.com/216051/diff/1/2#newcode56
> bend-implementation-roadmap.txt:56: Step 4: Extending properties for
> TabNoteHead
> No, we don't need a 'style property.  We have the bend amount as an
> articulation or from a string-bend-event.  What would the style do
My annotation from feb 25 means the same - I think the 'style property
is superfluous.

>
> http://codereview.appspot.com/216051/diff/1/2#newcode59
> bend-implementation-roadmap.txt:59: read the bend-reference-pitch vector
> (provided by the
> The bend-reference-pitch vector should be stored as a private member of
> the Tab_note_heads engraver, rather than in the String_bend_engraver.
>
> All the String_bend_engraver has to do is draw a pointy slur between two
> note-heads, and the Tab_string_bend_engraver draws a curved arrow
> between two tab-note-heads.
Ok. I thought about situations like

 c d\bend ~ d\bend

where the pointed slur should not be drawn between the two d notes.
On the other hand, hold bend situations are done with consecutive
pre bends, so perhaps the string-bend-engraver has nothing to know
about pitches.
>
> http://codereview.appspot.com/216051/diff/1/2#newcode65
> bend-implementation-roadmap.txt:65: - provides the bend-reference-pitch
> vector (TabStringBend #'bend-reference-pitch)
> I don't think this is the right way to go.  The easiest thing to do is
> to store the reference pitches in the Tab_note_heads engraver, since
> that engraver already has to listen to the pitches and change the notes
> as necessary.
Hmmmm, I am not completely convinced. The direction of the bend arrows
depends on the pitches.

c d\bend is an arrow up,
c d\bend c\bend is an arrow up and an arrow down
etc.

What do you think?
>
> http://codereview.appspot.com/216051/diff/2001/2002#newcode95
> bend-implementation-roadmap.txt:95:
> This seems reasonable to me.  You may want to have
> chord_bend_reference_pitches and note_bend_reference_pitch
Ah, yes, good point!

>
> http://codereview.appspot.com/216051/diff/2001/2002#newcode135
> bend-implementation-roadmap.txt:135: and if *every* TabNoteHead in a
> note column has the style 'parenthezied, the
> Yes, I agree with this change.  The TabNoteHeads engraver should just
> look for bend-events in order to change the note head.
>
> http://codereview.appspot.com/216051/show
>
> ---
> ----
> Join the Frogs!
>
>


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Carl Sorensen



On 3/7/10 2:13 AM, "Marc Hohl" <[hidden email]> wrote:

> Ok. I thought about situations like
>
>  c d\bend ~ d\bend
>
> where the pointed slur should not be drawn between the two d notes.
> On the other hand, hold bend situations are done with consecutive
> pre bends, so perhaps the string-bend-engraver has nothing to know
> about pitches.


But isn't the reason we don't draw the pointed slur between the two d's is
because they're tied?  To me, that just means that we watch for ties, and
don't draw bend symbols.

>>
>> http://codereview.appspot.com/216051/diff/1/2#newcode65
>> bend-implementation-roadmap.txt:65: - provides the bend-reference-pitch
>> vector (TabStringBend #'bend-reference-pitch)
>> I don't think this is the right way to go.  The easiest thing to do is
>> to store the reference pitches in the Tab_note_heads engraver, since
>> that engraver already has to listen to the pitches and change the notes
>> as necessary.
> Hmmmm, I am not completely convinced. The direction of the bend arrows
> depends on the pitches.
>
> c d\bend is an arrow up,
> c d\bend c\bend is an arrow up and an arrow down
> etc.
>
> What do you think?

I think that the information needed to draw the arrows is present in the
tabNoteHeads that are properly placed on the TabStaff.  Once the
TabNoteHeads are placed, it's pretty easy to tell the arrow direction,
because the arrow goes in the direction of the staff interval.  And the
grobs have a staff position, so we know what we need to do from the grobs,
without knowing the pitches.

HTH,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
Carl Sorensen schrieb:

>
> On 3/7/10 2:13 AM, "Marc Hohl" <[hidden email]> wrote:
>
>  
>> Ok. I thought about situations like
>>
>>  c d\bend ~ d\bend
>>
>> where the pointed slur should not be drawn between the two d notes.
>> On the other hand, hold bend situations are done with consecutive
>> pre bends, so perhaps the string-bend-engraver has nothing to know
>> about pitches.
>>    
>
>
> But isn't the reason we don't draw the pointed slur between the two d's is
> because they're tied?  To me, that just means that we watch for ties, and
> don't draw bend symbols.
>  
I think you are right - as always ;-)

And if the user gives a non-musical input, then it is not necessarily
lilipond's task to get everything right.

>  
>>> http://codereview.appspot.com/216051/diff/1/2#newcode65
>>> bend-implementation-roadmap.txt:65: - provides the bend-reference-pitch
>>> vector (TabStringBend #'bend-reference-pitch)
>>> I don't think this is the right way to go.  The easiest thing to do is
>>> to store the reference pitches in the Tab_note_heads engraver, since
>>> that engraver already has to listen to the pitches and change the notes
>>> as necessary.
>>>      
>> Hmmmm, I am not completely convinced. The direction of the bend arrows
>> depends on the pitches.
>>
>> c d\bend is an arrow up,
>> c d\bend c\bend is an arrow up and an arrow down
>> etc.
>>
>> What do you think?
>>    
>
> I think that the information needed to draw the arrows is present in the
> tabNoteHeads that are properly placed on the TabStaff.  Once the
> TabNoteHeads are placed, it's pretty easy to tell the arrow direction,
> because the arrow goes in the direction of the staff interval.  And the
> grobs have a staff position, so we know what we need to do from the grobs,
> without knowing the pitches.
>  
Yes, of course! Stupid me ...

Thanks again for your comments. WIthin the next days, I will rewrite the
roadmap
according to the informations I got from you and continue working on the
engraver.

Greetings,

Marc
> HTH,
>
> Carl
>
>
>  


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
Marc Hohl schrieb:
> [...]
>
> Thanks again for your comments. WIthin the next days, I will rewrite
> the roadmap
> according to the informations I got from you and continue working on
> the engraver.
I uploaded the changes in the roadmap to rietveld.

At the moment, I am short of time, so things go very slowly ...


http://codereview.appspot.com/216051/show


Marc


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
I uploaded my latest version of string-bend-engraver.cc.

I think I am on the right track now, but I am not sure how to get
the bend-event stuff right. I have stored all bend-events
in bend_events_, but I have no clue how to assign these events
to the appropriate note_events.

I can check for bend_events_.size () > 0, but in case of chord
constructs, it is essential to get from e.g. < c\5 e\4\bend g\3 >4
the bend-event assigned to string-event 4. How can this be done?
I have tried to use a code similar to the articulation filtering
mechanism a couple of lines above, but this failed (or, more
obviously, I did some mistakes).

Thanks in advance for any hint,

Marc

http://codereview.appspot.com/216051/show


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Carl.D.Sorensen
In reply to this post by Carl.D.Sorensen
Inside a chord, the string numbers don't come as events, they come as
articulations on the note events.

I assume that the same will be true of \bend, once it's added to the
parser.  It will create a bendEvent if it's outside a chord construct,
and an articulation to the noteEvent if it's inside the chord construct.
  That way, it's easy to tell which note the bend applies to.

HTH,

Carl


http://codereview.appspot.com/216051/show

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
[hidden email] schrieb:
> Inside a chord, the string numbers don't come as events, they come as
> articulations on the note events.
>
> I assume that the same will be true of \bend, once it's added to the
> parser.  It will create a bendEvent if it's outside a chord construct,
> and an articulation to the noteEvent if it's inside the chord construct.
>  That way, it's easy to tell which note the bend applies to.
Ah, I see. So I have to tell the parser how to handle \bend?

I thought this was already done by defining bend in ly/declarations-init.ly,
so lilypond does the right thing ...

Ok, so I'll try to find out how the parser works.

Thanks,

Marc




---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Carl Sorensen



On 3/17/10 1:12 PM, "Marc Hohl" <[hidden email]> wrote:

> [hidden email] schrieb:
>> Inside a chord, the string numbers don't come as events, they come as
>> articulations on the note events.
>>
>> I assume that the same will be true of \bend, once it's added to the
>> parser.  It will create a bendEvent if it's outside a chord construct,
>> and an articulation to the noteEvent if it's inside the chord construct.
>>  That way, it's easy to tell which note the bend applies to.
> Ah, I see. So I have to tell the parser how to handle \bend?
>
> I thought this was already done by defining bend in ly/declarations-init.ly,
> so lilypond does the right thing ...

It may do so.  I have not traced down this particular feature.  I'm
certainly not a parser expert.  I just assumed that you'd need to modify the
parser.

Maybe your understanding is correct.

Thanks,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
Carl Sorensen schrieb:

>
> On 3/17/10 1:12 PM, "Marc Hohl" <[hidden email]> wrote:
>
>  
>> [hidden email] schrieb:
>>    
>>> Inside a chord, the string numbers don't come as events, they come as
>>> articulations on the note events.
>>>
>>> I assume that the same will be true of \bend, once it's added to the
>>> parser.  It will create a bendEvent if it's outside a chord construct,
>>> and an articulation to the noteEvent if it's inside the chord construct.
>>>  That way, it's easy to tell which note the bend applies to.
>>>      
>> Ah, I see. So I have to tell the parser how to handle \bend?
>>
>> I thought this was already done by defining bend in ly/declarations-init.ly,
>> so lilypond does the right thing ...
>>    
>
> It may do so.  I have not traced down this particular feature.  I'm
> certainly not a parser expert.  I just assumed that you'd need to modify the
> parser.
>
> Maybe your understanding is correct.
>  
Hello Carl,

please review the current changes. IIUC, articulations can be
established by make-articulation, so perhaps I do not need
to change the parser.

By the way, if I uncomment the \displayMusic line in bend-test.ly,
lilypond aborts. I think I have to add bend to the music output routines,
but for the moment, everything looks very promising :-)

Marc

 http://codereview.appspot.com/216051

> Thanks,
>
> Carl
>
>
>  


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
Marc Hohl schrieb:

> Carl Sorensen schrieb:
>>
>> On 3/17/10 1:12 PM, "Marc Hohl" <[hidden email]> wrote:
>>
>>  
>>> [hidden email] schrieb:
>>>    
>>>> Inside a chord, the string numbers don't come as events, they come as
>>>> articulations on the note events.
>>>>
>>>> I assume that the same will be true of \bend, once it's added to the
>>>> parser.  It will create a bendEvent if it's outside a chord construct,
>>>> and an articulation to the noteEvent if it's inside the chord
>>>> construct.
>>>>  That way, it's easy to tell which note the bend applies to.
>>>>      
>>> Ah, I see. So I have to tell the parser how to handle \bend?
>>>
>>> I thought this was already done by defining bend in
>>> ly/declarations-init.ly,
>>> so lilypond does the right thing ...
>>>    
>>
>> It may do so.  I have not traced down this particular feature.  I'm
>> certainly not a parser expert.  I just assumed that you'd need to
>> modify the
>> parser.
>>
>> Maybe your understanding is correct.
>>  
> Hello Carl,
>
> please review the current changes. IIUC, articulations can be
> established by make-articulation, so perhaps I do not need
> to change the parser.
>
> By the way, if I uncomment the \displayMusic line in bend-test.ly,
> lilypond aborts. I think I have to add bend to the music output routines,
> but for the moment, everything looks very promising :-)
I had time to work a little bit more on this issue. I included a number of
"cout << ..." lines which seem to indicate that everything is fine.

Now (given that the engraver structure is ok) I have to include the actual
drawing routine. How do I tell the routine which note-events it should
use?
If I look at glissando-engraver.cc, I see a function called make_spanner,
but it is still mysterious to me how the function gets its starting
and ending points/events.
Any hints are more than welcome.

Thanks,

Marc

>
> Marc
>
> http://codereview.appspot.com/216051
>
>> Thanks,
>>
>> Carl
>>
>>
>>  
>
>
> ---
> ----
> Join the Frogs!
>
>


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Neil Puttock
In reply to this post by Carl.D.Sorensen
On 2010/03/21 13:28:12, marc wrote:

> please review the current changes. IIUC, articulations can be
> established by make-articulation, so perhaps I do not need
> to change the parser.

No.  While there's no need to change the parser, you'd only use
make-articulation if you were adding a new Script grob, with its
properties set in default-script-alist.

You're confusing an articulation (a Script) with the 'articulations
music property.  The parser adds an event to 'articulations whenever it
finds a music object following a note inside a chord.  Since this
happens automatically, all you have to do is define your \bend command
using make-music: the parser will decide whether to add the
string-bend-event to 'articulations (inside < >) or the 'elements
property of the EventChord (outside a chord).

Regards,
Neil

http://codereview.appspot.com/216051/show

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
[hidden email] schrieb:

> On 2010/03/21 13:28:12, marc wrote:
>
>> please review the current changes. IIUC, articulations can be
>> established by make-articulation, so perhaps I do not need
>> to change the parser.
>
> No.  While there's no need to change the parser, you'd only use
> make-articulation if you were adding a new Script grob, with its
> properties set in default-script-alist.
>
I understand.
> You're confusing an articulation (a Script) with the 'articulations
> music property.  The parser adds an event to 'articulations whenever it
> finds a music object following a note inside a chord.  Since this
> happens automatically, all you have to do is define your \bend command
> using make-music: the parser will decide whether to add the
> string-bend-event to 'articulations (inside < >) or the 'elements
> property of the EventChord (outside a chord).
Even better! SO the parser does all the work, and I don't have to bother
- great.

Thanks,

Marc

>
> Regards,
> Neil
>
> http://codereview.appspot.com/216051/show
>
> ---
> ----
> Join the Frogs!
>
>


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Marc Hohl
In reply to this post by Marc Hohl
Marc Hohl schrieb:
> [...]
> Now (given that the engraver structure is ok) I have to include the
> actual
> drawing routine. How do I tell the routine which note-events it should
> use?
> If I look at glissando-engraver.cc, I see a function called make_spanner,
> but it is still mysterious to me how the function gets its starting
> and ending points/events.
It is still not clear to me how to proceed.
Assume I have a note-event in

bend_reference_events_[string_nr]

and a corresponding note-event in

note_events_[string_nr]

How do I call make_spanner? It should draw a spanner between
bend_reference_events_[string_nr] and note_events_[string_nr].

Any hints are welcome.

Thanks,

Marc

http://codereview.appspot.com/216051



---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Enhancement: string bends (issue216051)

Carl Sorensen



On 4/3/10 8:12 AM, "Marc Hohl" <[hidden email]> wrote:

> Marc Hohl schrieb:
>> [...]
>> Now (given that the engraver structure is ok) I have to include the
>> actual
>> drawing routine. How do I tell the routine which note-events it should
>> use?
>> If I look at glissando-engraver.cc, I see a function called make_spanner,
>> but it is still mysterious to me how the function gets its starting
>> and ending points/events.
> It is still not clear to me how to proceed.
> Assume I have a note-event in
>
> bend_reference_events_[string_nr]
>
> and a corresponding note-event in
>
> note_events_[string_nr]
>
> How do I call make_spanner? It should draw a spanner between
> bend_reference_events_[string_nr] and note_events_[string_nr].
>
> Any hints are welcome.

I've been really busy, and not had time to look this up at all, so I was
hoping somebody else would answer.  But since nobody has, I thought I'd tell
you what I've been able to find out.

I've been looking at lily/slur-engraver.cc.

In Slur_engraver::process_music(), line 187, a slur grob is created by
calling make_spanner.

In line 192, the slur is added to a vector of slurs.

In line 172-179, slurs are ended.

In Slur_engraver::stop_translation_timestep()

events are added to the encompass list for the active slurs.  I think this
gives the slur grob the info it needs to do the calculations.

I think this is the code that sets up the grob with all of its information.

lily/slur.cc is the c++ code (that is also exported to scheme) that does the
actual layout work.  You can see in that code that the encompassed columns
are available.

I think that what you need to do is at the time you create a bend_spanner,
you will pass in the start_note and the end_note.  Then at the time you want
to print the spanner, you will set the ends relative to the properties of
the start_note and the end_note.

I'm sorry I don't have a better answer for you than this.  I've never done
what you're doing.

HTH,

Carl


---
----
Join the Frogs!

Loading...