lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get string number from TabStaff note


From: Thomas Morley
Subject: Re: Get string number from TabStaff note
Date: Fri, 23 Jan 2015 23:03:09 +0100

2015-01-21 15:54 GMT+01:00 address@hidden <address@hidden>:
> Is it possible to know which string a note is placed on in a TabStaff.
>
> E.g.
>
> %% Start
> \version "2.19.15"
>
> melody = { c'4 }
>
> \score {
>   <<
>     \new Staff { \melody }
>     \new TabStaff { \melody }
>   >>
> }
> %% End
>
> Here the note c'4 is placed on the second string of the TabStaff.
> Since I want to do different things (\transpose) depending on which string
> the note is on, I need to know the string number and I need to know it
> before it is "printed" on the TabStaff ( I want to transpose the note
> differently depending on which string it is on)
>
>
> Is this possible?


Hi,

is the following of some help?

\version "2.18.0"

\new TabStaff
\relative c, {
  \override TabNoteHead.before-line-breaking =
  #(lambda (grob)
    (format #t "\nI'm on string No. ~a"
      (truncate (abs (- (/ (ly:grob-property grob 'staff-position) 2) 4)))))
  e f g
  a b c
  d e f
  g\4 a
  b c d
  e f g
}



HTH,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]