cross-style note heads in tablature (was: Pitch_squash_engraver)

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

cross-style note heads in tablature (was: Pitch_squash_engraver)

Patrick Schmidt-3
Hi Marc,

first of all: thanks for all your brilliant work on tablature!
-------- Original-Nachricht --------
> Datum: Wed, 09 Sep 2009 17:26:52 +0200
> Von: Marc Hohl <[hidden email]>
> An: Patrick Schmidt <[hidden email]>
> CC: Christian Henning <[hidden email]>, [hidden email]
> Betreff: Re: Pitch_squash_engraver

> Patrick Schmidt schrieb:
> > Hi Christian,
> >
> >
> >
> > -------- Original-Nachricht --------
> >  
> >> Datum: Tue, 8 Sep 2009 23:10:51 -0400
> >> Von: Christian Henning <[hidden email]>
> >> An: [hidden email]
> >> Betreff: Pitch_squash_engraver
> >>    
> >
> >  
> >> Hi there, quick question since I cannot find anything in the
> >> documentation. Is there a way to have a note head struck out? Meaning
> >> the the chord is strum but only with muted strings.
> >>    
> >
> > I think you want to alter note heads in chords to "x". You can do the
> following (It won't work in tablature):
> >  
>
> x =
> #(define-music-function (parser location note) (ly:music?)
>   (if (eq? (ly:music-property note 'name) 'NoteEvent)
>       ;; yes -> add a tweak
>       (begin (set! (ly:music-property note 'tweaks)
>                     (acons 'style 'cross (ly:music-property note
> 'tweaks)))
>        note)
>        #{
>          \override TabNoteHead #'style = #'cross
>          \override NoteHead #'style = #'cross
>          $note
>          \revert TabNoteHead #'style
>          \revert NoteHead #'style
>        #}))
>
> works in tablature staves, too (and outside of < ... >, too).
I didn't manage to engrave cross-style note heads inside or outside chords in tablature staves with this code. Here's my example:

\version "2.13.3"

x =
#(define-music-function (parser location note) (ly:music?)
 (if (eq? (ly:music-property note 'name) 'NoteEvent)
     ;; yes -> add a tweak
     (begin (set! (ly:music-property note 'tweaks)
                   (acons 'style 'cross (ly:music-property note 'tweaks)))
      note)
      #{
        \override TabNoteHead #'style = #'cross
        \override NoteHead #'style = #'cross
        $note
        \revert TabNoteHead #'style
        \revert NoteHead #'style
      #}))

xhead = \relative c {
  \x< c  e  g>
}

\score {
  <<
   \new Staff = "guitar traditional" <<
        \clef "treble_8"
        \context Voice = "xhead"  \xhead
     >>
   \new TabStaff = "guitar tab" <<
        \context TabVoice = "xhead"  \xhead
     >>
  >>
}
In tablature there are still numbers instead of crosses (x). When I use \relative c' the g of my C-major chord is not displayed and the c and e are in first position instead of third position.

Thanks for any help!

patrick



--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


Reply | Threaded
Open this post in threaded view
|

Re: cross-style note heads in tablature

Marc Hohl
Patrick Schmidt schrieb:
> [...]
> I didn't manage to engrave cross-style note heads inside or outside chords in tablature staves with this code. Here's my example:
>
>  
[...]

sorry, I had tuned my 2.13.3 so it worked for me, but of course not
anywhere else.

Please add some callbacks like this:

\version "2.13.3"

#(define-public (tab-note-head::calc-glyph-name grob)
  (let ((style (ly:grob-property grob 'style)))
   (case style
      ((cross) "2cross"))))

#(define (tab-note-head::whiteout-if-style-set grob)
  (let ((style (ly:grob-property grob 'style)))
       (if (and (symbol? style)
                (eq? style 'cross))
           (stencil-whiteout (ly:note-head::print grob))
           (ly:text-interface::print grob))))
\layout {
  \context {
    \TabVoice
    \override TabNoteHead #'glyph-name = #tab-note-head::calc-glyph-name
    \override TabNoteHead #'stencil = #tab-note-head::whiteout-if-style-set
  }
}

x =
#(define-music-function (parser location note) (ly:music?)
 (if (eq? (ly:music-property note 'name) 'NoteEvent)
     ;; yes -> add a tweak
     (begin (set! (ly:music-property note 'tweaks)
                   (acons 'style 'cross (ly:music-property note 'tweaks)))
      note)
      #{
        \override TabNoteHead #'style = #'cross
        \override NoteHead #'style = #'cross
        $note
        \revert TabNoteHead #'style
        \revert NoteHead #'style
      #}))

xhead = \relative c {
  \x< c  e  g>4
  <c e \x g>
 
}

\score {
  <<
   \new Staff = "guitar traditional" <<
        \clef "treble_8"
        \context Voice = "xhead"  \xhead
     >>
   \new TabStaff = "guitar tab" <<
        \context TabVoice = "xhead"  \xhead
     >>
  >>
}

I installed a clean 2.13.3 and checked, it works as expected.

Marc


Reply | Threaded
Open this post in threaded view
|

Re: cross-style note heads in tablature

Patrick Schmidt-3

-------- Original-Nachricht --------
> Datum: Thu, 10 Sep 2009 09:43:08 +0200
> Von: Marc Hohl <[hidden email]>
> An: [hidden email]
> Betreff: Re: [tablatures] cross-style note heads in tablature

> Patrick Schmidt schrieb:
> > [...]
> > I didn't manage to engrave cross-style note heads inside or outside
> chords in tablature staves with this code. Here's my example:
> >
> >  
> [...]
>
> sorry, I had tuned my 2.13.3 so it worked for me, but of course not
> anywhere else.
>
> Please add some callbacks like this:
>
> \version "2.13.3"
>
> #(define-public (tab-note-head::calc-glyph-name grob)
>   (let ((style (ly:grob-property grob 'style)))
>    (case style
>       ((cross) "2cross"))))
>
> #(define (tab-note-head::whiteout-if-style-set grob)
>   (let ((style (ly:grob-property grob 'style)))
>        (if (and (symbol? style)
>                 (eq? style 'cross))
>            (stencil-whiteout (ly:note-head::print grob))
>            (ly:text-interface::print grob))))
> \layout {
>   \context {
>     \TabVoice
>     \override TabNoteHead #'glyph-name = #tab-note-head::calc-glyph-name
>     \override TabNoteHead #'stencil =
> #tab-note-head::whiteout-if-style-set
>   }
> }
>
> x =
> #(define-music-function (parser location note) (ly:music?)
>  (if (eq? (ly:music-property note 'name) 'NoteEvent)
>      ;; yes -> add a tweak
>      (begin (set! (ly:music-property note 'tweaks)
>                    (acons 'style 'cross (ly:music-property note 'tweaks)))
>       note)
>       #{
>         \override TabNoteHead #'style = #'cross
>         \override NoteHead #'style = #'cross
>         $note
>         \revert TabNoteHead #'style
>         \revert NoteHead #'style
>       #}))
>
> xhead = \relative c {
>   \x< c  e  g>4
>   <c e \x g>
>  
> }
>
> \score {
>   <<
>    \new Staff = "guitar traditional" <<
>         \clef "treble_8"
>         \context Voice = "xhead"  \xhead
>      >>
>    \new TabStaff = "guitar tab" <<
>         \context TabVoice = "xhead"  \xhead
>      >>
>   >>
> }
>
> I installed a clean 2.13.3 and checked, it works as expected.
>
> Marc
>

Thanks for your very quick help! With \relative c everything is fine but not with \relative c' (see last mail). In the tablature staff only two crosses appear and even though in the above example (<c e \x g>) there should be an x instead of the g LilyPond seems to engrave an x instead of the e. Did I oversee something??

thanks again,
patrick

--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser


Reply | Threaded
Open this post in threaded view
|

Re: cross-style note heads in tablature

Marc Hohl
Patrick Schmidt schrieb:
> -------- Original-Nachricht --------
>  
> [...]
> Thanks for your very quick help! With \relative c everything is fine but not with \relative c' (see last mail). In the tablature staff only two crosses appear and even though in the above example (<c e \x g>) there should be an x instead of the g LilyPond seems to engrave an x instead of the e. Did I oversee something??
>  
Lilypond doesn't care about setting different notes to different
strings, so it simply overrides previous
symbols. In this case, you'll have to use
< c\3 e\2 g\1 >
where you explicitely set the string number, or
\set TabStaff.minimumFret = #3
which should work with this triad.

Marc
> thanks again,
> patrick
>
>  



Reply | Threaded
Open this post in threaded view
|

Re: cross-style note heads in tablature

Patrick Schmidt-3
Many thanks!
-------- Original-Nachricht --------
> Datum: Thu, 10 Sep 2009 11:03:38 +0200
> Von: Marc Hohl <[hidden email]>
> An: [hidden email]
> Betreff: Re: [tablatures] cross-style note heads in tablature

> Patrick Schmidt schrieb:
> > -------- Original-Nachricht --------
> >  
> > [...]
> > Thanks for your very quick help! With \relative c everything is fine but
> not with \relative c' (see last mail). In the tablature staff only two
> crosses appear and even though in the above example (<c e \x g>) there should
> be an x instead of the g LilyPond seems to engrave an x instead of the e.
> Did I oversee something??
> >  
> Lilypond doesn't care about setting different notes to different
> strings, so it simply overrides previous
> symbols. In this case, you'll have to use
> < c\3 e\2 g\1 >
> where you explicitely set the string number, or
> \set TabStaff.minimumFret = #3
> which should work with this triad.
>
> Marc
> > thanks again,
> > patrick
> >
> >  
>
>

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01