lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme function to return pitchnames as markup/text


From: Jacques Menu
Subject: Re: Scheme function to return pitchnames as markup/text
Date: Tue, 19 Nov 2019 09:43:18 +0100

Hello Steve,

Maybe starting this way:

\version "2.19.83"

{
  % initial shared music
  c'1 e |

  % the two alternatives
  \override Staff.StaffSymbol.line-count = 0
  \stopStaff \startStaff
  \hide Staff.BarLine
  <<
    \new Staff {
      \hide Staff.Clef
      \hide Staff.KeySignature
      \hide Staff.TimeSignature
      d' a' d'' |
    }
    \new Staff {
      \hide Staff.Clef
      \hide Staff.KeySignature
      \hide Staff.TimeSignature
      g' b' e'' |
    }
  >>
  \override Staff.StaffSymbol.line-count = 5
  \stopStaff \startStaff
  \undo\hide Staff.BarLine

  % next shared music
  ais' bes' |
}


and then force a barline at the end of measure 2, move the two alternative staves fragments higher, and remove the dangling lines at the left of the two alternatives?

JM

Le 19 nov. 2019 à 02:23, Steve Cummings <address@hidden> a écrit :

Though I remain baffled by Scheme and its use in LilyPond, my hope is to build one or more functions/procedures that would transpose input music and for each chord display the transposed chord's note names, with control over the way the names are represented (as in Cb or F# instead of ces and fis).

Here, I'm just asking for help with one part of the function-to-be: how to turn notes in LilyPond music into note names as text (schematic of the complete imagined function below).

Here's what I've tried so far, in LilyPond 2.19.8x, based closely on working procedures found on this list. Once this is running right for single notes I'll (hope to) get it to loop through all input music.

#(define-scheme-function
(pitchin)
(ly:music?)
(let* (
    (note-datum (car (ly:music-property pitchin 'elements)))
    (pitch-datum (ly:music-property note-datum 'pitch))
    (out-notename (ly:pitch-notename pitch-datum))) 
#{  \markup
    \bold
    $out-notename
#}  
))

I get "syntax error, unexpected NUMBER_IDENTIFIER" on the $out-notename line when calling notenamer with a note wrapped in braces, as in:

\notenamer {a}

Without the braces around the music,  the error is "In procedure car in _expression_ (car (ly:music-property pitchin #)): Wrong type (expecting pair): ()

Results are the same if I do "define-music-function" instead of "define-scheme-function."

Many thanks for your attention and help,
Steve

PS: I have a working NoteNames reformatter but it seems to require listing in a substitution table the specific notes of each and every chord in each transposition. A custom function would allow display of the chord note names in a columnar stack so if these markups were used as text scripts they wouldn't either take too much space or collide with the names of adjacent notes. Alternatively, chord note names could be placed beneath ChordNames.



reply via email to

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