Menu

#5302 Let \tweak on event chords manipulate its elements

Fixed
Enhancement
2018-04-15
2018-04-08
No

Let \tweak on event chords manipulate its elements

This makes \tweak on event chords actually get heeded and creates
reasonably predictable behavior by tweaking the rhythmic elements (but
not chord-wide articulations). It also passes tweaks transparently
through music wrapper expressions (like transpositions, context
changes and other).

To achieve this, it creates and uses a get-tweakable-music function
that will deliver a list of primary music expressions tweaks should be
applied to.

This function is also used in the definition of \once to decide when a
warning for misapplication of \once might be called for.

Also contains commits:

Refactor \once

Separates the warning action of \once and its effect on overrides in
order to reduce the number of surprises.

Let \single use \tweak internally

This is less efficient than directly manipulating the @samp{tweaks}
property but closer follows the semantics of @code{\tweak},
facilitating extensions to it.

http://codereview.appspot.com/344770043

Discussion

  • Thomas Morley

    Thomas Morley - 2018-04-09

    Hi David,

    could you provide a code-example which now works, as opposed to before? From description and reading the code it's not clear to me.

     
    • David Kastrup

      David Kastrup - 2018-04-09

      "Thomas Morley" thomas-morley@users.sourceforge.net writes:

      Hi David,

      could you provide a code-example which now works, as opposed to
      before? From description and reading the code it's not clear to me.

      { \tweak color #red <c' g'=""> }</c'>

      maybe? That's the gist of the feature. Most of the rest is just making
      sure that everything continues behaving consistently.

      --
      David Kastrup

       
      • Thomas Morley

        Thomas Morley - 2018-04-12

        Sure about the example's syntax?
        Even after applying your patch I get:

        lilypond-git atest-74.ly
        GNU LilyPond 2.21.0
        Processing `atest-74.ly'
        Parsing...
        atest-74.ly:1245:29: error: syntax error, unexpected STRING
        { \tweak color #red <c' g'=" "> }
        atest-74.ly:1245:29: error: string outside of text script or \lyricmode
        { \tweak color #red <c' g'=" "> }
        atest-74.ly:1245:1: error: errors found, ignoring music expression</c'></c'>

        { \tweak color #red <c' g'=""> }
        fatal error: failed files: "atest-74.ly"</c'>

         
        • David Kastrup

          David Kastrup - 2018-04-12

          I checked the mail I sent and it's correct. I don't have an inkling why Sourceforge would nilly-willy add a nonsensical ="" to the example. In the mail I sent, there just was

          { \tweak color #red <c' g'> }
          

          Try writing the same without this kind of indentation in a reply (you don't need to actually send it, just use the eye symbol for previewing it) and you'll likely get the same nonsensical ="" inserted. Sorry for the confusion.

           
          • Thomas Morley

            Thomas Morley - 2018-04-12

            Can confirm Sourceforge adds ="". Strange.

            I now tried:

            #(display-scheme-music 
              (extract-named-music 
                #{ \tweak color #red <c' g'> #} 
                'NoteEvent))
            

            and (as opposed to before your patch) I got:

            (list (make-music
            'NoteEvent
            'duration
            (ly:make-duration 0)
            'pitch
            (ly:make-pitch 0 0))
            (make-music
            'NoteEvent
            'duration
            (ly:make-duration 0)
            'pitch
            (ly:make-pitch 0 4)))

            Very nice.

            Edit:
            Code formating

             

            Last edit: Thomas Morley 2018-04-12
            • Thomas Morley

              Thomas Morley - 2018-04-12

              Aargh, now I confused things while formating grrrr
              The terminal output with your patch is ofcourse:

              (list (make-music
                      'NoteEvent
                      'tweaks
                      (list (list (quote color) 1.0 0.0 0.0))
                      'duration
                      (ly:make-duration 0)
                      'pitch
                      (ly:make-pitch 0 0))
                    (make-music
                      'NoteEvent
                      'tweaks
                      (list (list (quote color) 1.0 0.0 0.0))
                      'duration
                      (ly:make-duration 0)
                      'pitch
                      (ly:make-pitch 0 4)))
              
               
  • Anonymous

    Anonymous - 2018-04-10
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2018-04-10

    Passes make, make check and a full make doc

     
  • Anonymous

    Anonymous - 2018-04-12
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2018-04-12

    Patch on countdown for April 15th

     
  • Anonymous

    Anonymous - 2018-04-15
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2018-04-15

    Patch counted down - please push.

     
  • David Kastrup

    David Kastrup - 2018-04-15
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • David Kastrup

    David Kastrup - 2018-04-15

    Pushed to staging as
    commit e09dc5acc4c80ba2c39f2ba3a9b7732f3e5a101d
    Author: David Kastrup dak@gnu.org
    Date: Sat Apr 7 22:47:53 2018 +0200

    Issue 5302/3: Let \tweak on event chords manipulate its elements
    
    This makes \tweak on event chords actually get heeded and creates
    reasonably predictable behavior by tweaking the rhythmic elements (but
    not chord-wide articulations).  It also passes tweaks transparently
    through music wrapper expressions (like transpositions, context
    changes and other).
    
    To achieve this, it creates and uses a get-tweakable-music function
    that will deliver a list of primary music expressions tweaks should be
    applied to.
    
    This function is also used in the definition of \once to decide when a
    warning for misapplication of \once might be called for.
    

    commit 2827a6353a11414b139d93c4fdbd8fce62fb067f
    Author: David Kastrup dak@gnu.org
    Date: Sun Apr 8 19:16:39 2018 +0200

    Issue 5302/2: Refactor \once
    
    Separates the warning action of \once and its effect on overrides in
    order to reduce the number of surprises.
    

    commit a8ecda697866c8e22b3c11a1728918929db26777
    Author: David Kastrup dak@gnu.org
    Date: Sat Mar 31 20:49:07 2018 +0200

    Issue 5302/1: Let \single use \tweak internally
    
    This is less efficient than directly manipulating the @samp{tweaks}
    property but closer follows the semantics of @code{\tweak},
    facilitating extensions to it.
    
     
MongoDB Logo MongoDB