In Staceys example, I stumbled across the following strange thing where \relative behaves strangely:

mus = \relative c,, { \harmonicByRatio #1/4 <e\3 a\2>2. }

  \new TabStaff
    \set Staff.stringTunings = \stringTuning <a,,, e,, a,, e, a, cis>
  \new Staff \mus

Just to make this explicit: \harmonicByRatio and \harmonicByFret both fail if used for chords in \relative mode. The reason is the behaviour of calc-harmonic-pitch that can be seen in the attached file.

(calc-harmonic-pitch looks like a direct reimplementation of \transpose c' #pitch #mus, but it differs from \transpose in that in actually does something - and even "the right thing" - for music inside \relative if given only _one_ note.)

So I agree (if I understood your remark correctly) that \harmonicByFret and \harmonicByRatio should rather accept single pitches only.

But you're obviously also right in that the implementation of harmonics handling should be reconsidered because of the different ways they have to be handled in a) staves, b) tabstaves, c) midi. Maybe I can try something in that direction over the next few days, but I know this is going to be pushing my understanding of Lilypond and scheme programming to its boundaries :-).


\version "2.21.0"

\markup \wordwrap {
 \typewriter "(calc-harmonic-pitch pitch mus)"
 acts roughly like
 \typewriter "\\transpose c' $pitch #mus"
 but for \typewriter "\\relative" music, both fail in different ways if used for more than one note:

  \mark "\\transpose c' c'', absolute mode"
  \transpose c' c'' { c' d' e' c'' a' f' e' }

  \mark "calc-harmonic-pitch from c' to c'', absolute mode"
  #(calc-harmonic-pitch #{ c'' #} #{ c' d' e' c'' a' f' e' #})

\relative c' {
  \mark "\\transpose c' c'', relative mode"
  \transpose c' c'' { c d e c' a f e }

\relative c' {
  \mark "calc-harmonic-pitch from c' to c'', relative mode"
  #(calc-harmonic-pitch #{ c'' #} #{ c d e c' a f e #})

Reply via email to