new attempt to hammer on/pull off

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

new attempt to hammer on/pull off

Marc Hohl
Hello tablature users,

I decided to rework the hammer on/pull off stuff almost from scratch.

After playing with some internal variables I found out how to make the stems
so short that they don't influence the slurs anymore (before making them
invisible,
as it is now for tablature).

Attached is a file hp.ly which can be included in your own files for
testing purposes,
and a simple, quick hptest.ly as a starting point for your tests.

@Carl: I think the slur callback has to be reworked when the slur
#'details are (at least for me)
not a mysterious bunch of values that I don't understand, but this
depends on Patrick McCartys
efforts to make these more understandable. In the meantime, a patch
including the code from
hp.ly into tablature.scm would improve the overall behavior of slurs
(which for now are simply transparent)
in tablature - when the testers do not complain about situations where
hp.ly does not work :-)
What do you think? Or is my approach way too crude?

Thanks


Marc

% hp.ly

#(define-public (slur::draw-tab-slur grob)
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
         (staff-space (ly:grob-property staff-symbol 'staff-space))
         (control-points (ly:grob-property grob 'control-points))
         (new-control-points (map (lambda (p)
                                          (cons (car p) (- (cdr p)
                                                        (* staff-space
                                                           (ly:grob-property grob 'direction)
                                                           0.35))))
                                  control-points)))
        (ly:grob-set-property! grob 'control-points new-control-points)
        (ly:slur::print grob)))


\layout {
  \context {
     \TabVoice
     \override Stem #'length = #0
     \override Stem #'no-stem-extend = ##t
     \override Stem #'flag-style = #'no-flag
     \override Stem #'details = #'((lengths 0 0 0 0 0 0)
                                   (beamed-lengths 0 0 0)
                                   (beamed-minimum-free-lengths 0 0 0)
                                   (beamed-extreme-minimum-free-lengths 0 0)
                                   (stem-shorten 0 0))
     autoBeaming = ##f
     \override NoteColumn #'ignore-collision = ##t
     \override Slur #'stencil = #slur::draw-tab-slur
   }
}

\version "2.13.4"
\include "hp.ly"

test = \relative c' {
    c8^( d e f)
    g_( a b c)
    \stemUp
    c,^( d e f)
    g_( a b c)
    \stemDown
    c,^( d e f)
    g_( a[ b] c)
}

\score {
   \new TabVoice { \test }
}
Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Carl Sorensen



On 9/30/09 2:51 AM, "Marc Hohl" <[hidden email]> wrote:

> Hello tablature users,
>
> I decided to rework the hammer on/pull off stuff almost from scratch.
>
> After playing with some internal variables I found out how to make the stems
> so short that they don't influence the slurs anymore (before making them
> invisible,
> as it is now for tablature).

Seems like a creative thing to do.  This code can (eventually) be made part
of tabNumbersOnly, right?

>
> Attached is a file hp.ly which can be included in your own files for
> testing purposes,
> and a simple, quick hptest.ly as a starting point for your tests.
>
> @Carl: I think the slur callback has to be reworked when the slur
> #'details are (at least for me)
> not a mysterious bunch of values that I don't understand, but this
> depends on Patrick McCartys
> efforts to make these more understandable.

The current challenge with draw-tab-slur is that it shifts the slur after
the control points are already determined, which means that it may introduce
collisions.  It would be better if the slur *calculation* code could be used
to fix this up, instead of the slur *printing* code.
 
> In the meantime, a patch
> including the code from
> hp.ly into tablature.scm would improve the overall behavior of slurs
> (which for now are simply transparent)
> in tablature - when the testers do not complain about situations where
> hp.ly does not work :-)
> What do you think? Or is my approach way too crude?
>

I think working up a patch based on this is probably OK, but it should at
least have a TODO in it.

Thanks,

Carl



Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Marc Hohl
Carl Sorensen schrieb:

>
> On 9/30/09 2:51 AM, "Marc Hohl" <[hidden email]> wrote:
>
>  
>> Hello tablature users,
>>
>> I decided to rework the hammer on/pull off stuff almost from scratch.
>>
>> After playing with some internal variables I found out how to make the stems
>> so short that they don't influence the slurs anymore (before making them
>> invisible,
>> as it is now for tablature).
>>    
>
> Seems like a creative thing to do.  This code can (eventually) be made part
> of tabNumbersOnly, right?
>  
Yes, it is meant to, if nobody objects.

>  
>> Attached is a file hp.ly which can be included in your own files for
>> testing purposes,
>> and a simple, quick hptest.ly as a starting point for your tests.
>>
>> @Carl: I think the slur callback has to be reworked when the slur
>> #'details are (at least for me)
>> not a mysterious bunch of values that I don't understand, but this
>> depends on Patrick McCartys
>> efforts to make these more understandable.
>>    
>
> The current challenge with draw-tab-slur is that it shifts the slur after
> the control points are already determined, which means that it may introduce
> collisions.  It would be better if the slur *calculation* code could be used
> to fix this up, instead of the slur *printing* code.
>  
You are right, this "solution" is somewhat practicaal, but not very elegant.
I don't this that collision problems may occur, though, because the
slurs are
moved /towards/ the fret numbers, not further away.
Nevertheless, a genuine solution, i.e. a calculation routine for
tablature would
be really an improvement, but I fear that this could only be within the
c++ part
of lilypond and not with scheme. But if I remember correctly, there are some
c++ guys amongst the tablature list, perhaps one of them could dive into
the code
and develop a function similar to ly:slur::calc-control-points which is
better suited for
tablature?

>  
>  
>> In the meantime, a patch
>> including the code from
>> hp.ly into tablature.scm would improve the overall behavior of slurs
>> (which for now are simply transparent)
>> in tablature - when the testers do not complain about situations where
>> hp.ly does not work :-)
>> What do you think? Or is my approach way too crude?
>>
>>    
>
> I think working up a patch based on this is probably OK, but it should at
> least have a TODO in it.
>  
Yes, in a bigger font size and blinking red ;-)

Marc
> Thanks,
>
> Carl
>
>
>
>
>  



Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Federico Bruni
In reply to this post by Marc Hohl
Marc Hohl wrote:

> Hello tablature users,
>
> I decided to rework the hammer on/pull off stuff almost from scratch.
>
> After playing with some internal variables I found out how to make the
> stems
> so short that they don't influence the slurs anymore (before making them
> invisible,
> as it is now for tablature).
>
> Attached is a file hp.ly which can be included in your own files for
> testing purposes,
> and a simple, quick hptest.ly as a starting point for your tests.
>
Thanks Marc,

I did some tests and it seems very good.

It's much better than the draft code you sent some weeks ago..
For example, now the doubleSlurs work great (see attached file).
And there's no need to change the stem and slur direction.

The up/down arch option is very cool - I mean this:
  d4_( e )   d4^( e )

So if you decide to add it to the next version, I'll be very happy :-)

Just a question: why did you put \stemUp and \stemDown in your test
file? Just for testing purpose?


Cheers,
Federico


--
http://www.gnurag.net/blog/

\version "2.13.4"
\include "hp.ly"

test = \relative c' {
    c8^( d e f)
    g_( a b c)
    \stemUp
    c,^( d e f)
    g_( a b c)
    \stemDown
    c,^( d e f)
    g_( a[ b] c)
   
    <g c>2  \set doubleSlurs = ##t < d g >8 (  < dis  gis >8  < d g >4 )
    <g, c>2  \set doubleSlurs = ##t < d g >8 (  < dis  gis >8 ) < d g >4
}

\score {
   \new TabVoice { \test }
}
Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Marc Hohl
Federico Bruni schrieb:

> Marc Hohl wrote:
>> Hello tablature users,
>>
>> I decided to rework the hammer on/pull off stuff almost from scratch.
>>
>> After playing with some internal variables I found out how to make
>> the stems
>> so short that they don't influence the slurs anymore (before making
>> them invisible,
>> as it is now for tablature).
>>
>> Attached is a file hp.ly which can be included in your own files for
>> testing purposes,
>> and a simple, quick hptest.ly as a starting point for your tests.
>>
>
> Thanks Marc,
>
> I did some tests and it seems very good.
>
Great to hear that!

> It's much better than the draft code you sent some weeks ago..
> For example, now the doubleSlurs work great (see attached file).
> And there's no need to change the stem and slur direction.
>
> The up/down arch option is very cool - I mean this:
>  d4_( e )   d4^( e )
>
> So if you decide to add it to the next version, I'll be very happy :-)
>
> Just a question: why did you put \stemUp and \stemDown in your test
> file? Just for testing purpose?
>
Yes, I played a bit around with the stems, because reducing the length
to zero didn't work
in all cases, so I inserted the stemUp/stemDown commands to make sure
the tablature works properly
even if these commands are inserted in the guitar notation.

Thanks for your feedback!

Marc
>
> Cheers,
> Federico
>
>



Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Marc Hohl
In reply to this post by Carl Sorensen
Carl Sorensen schrieb:
>
>
> I think working up a patch based on this is probably OK, but it should at
> least have a TODO in it.
>
>  
Hello Carl,

here is a patch to be applied onto SHA1
ff9835ceffe37955e1786cd9782ef53f4a8bb6e8

@ all users: slurs are not invisible anymore in tablature, and they are
closer to the corresponding
fret numbers.

I don't think we need a new regression test for this, because the hammer
on/pull off option
with slurs is already in there...

Marc
> Thanks,
>
> Carl
>
>
>
>
>  


0002-tablature-enhancement-hammer-on-pull-off.patch.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Federico Bruni
Marc Hohl wrote:
>  
> @ all users: slurs are not invisible anymore in tablature, and they are
> closer to the corresponding
> fret numbers.
>

wow, that's wonderful
so it will be included in next dev version (2.13.6), right?

--
http://www.gnurag.net/blog/


Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Marc Hohl
Federico Bruni schrieb:

> Marc Hohl wrote:
>>  
>> @ all users: slurs are not invisible anymore in tablature, and they
>> are closer to the corresponding
>> fret numbers.
>>
>
> wow, that's wonderful
> so it will be included in next dev version (2.13.6), right?
>
I hope so.

Marc


Reply | Threaded
Open this post in threaded view
|

Re: new attempt to hammer on/pull off

Federico Bruni
Marc Hohl wrote:

> Federico Bruni schrieb:
>> Marc Hohl wrote:
>>>  
>>> @ all users: slurs are not invisible anymore in tablature, and they
>>> are closer to the corresponding
>>> fret numbers.
>>>
>>
>> wow, that's wonderful
>> so it will be included in next dev version (2.13.6), right?
>>
> I hope so.
>
> Marc
>
>

I can see it has been added in 2.13.6
No more need of hp.ly :-)
Cheers,
--
Federico Bruni  |  http://www.gnurag.net/blog/

LibrePlanet Italia
http://groups.fsf.org/wiki/LibrePlanetItalia