Re: Harmonics in tablature

```Hi Valentin,

```
```This is a certain limitation in how the harmonicByFret-Function works. It will
calculate the pitch for the given note, thus the Noteheads are automatically
placed onto higher strings. Thus you eighter will have to manually specify the
string number, or you might do something like in the appended file, which is
modifying the harmonicByFret-function to automatically use the proper string.
This should work at least for open strings, for artificial harmonics this is
not really a problem, since harmonicByFret sucks for that anyway.
```
```
```
Thanks much! I think the problem is more complicated than that, or my lack of understanding more fundamental than that.
```
With your modification, the output now is:

```
which is _not_ correct since all the harmonics should be played on the third string. (At least on violin/cello its perfectly common to play harmonics in the "upper" half of the string, hence with "fret numbers".) On the cello, I get the sounding pitches from the lower staff by playing harmonics on the 12th, 7th, 5th fret all on the same string. (I hope it's clear that I speak of imaginary semitone frets on a cello.)
```

\set minimumFret = #(ly:pitch-semitones
(ly:prob-property
```
(calc-harmonic-pitch (fret->pitch (number->string 12))                                                (make-music 'NoteEvent 'pitch (ly:make-pitch 0 0)))
```                          'pitch))

is just a complicated way of writing \set minimumFret = 12:

```
(fret->pitch "12") looks up the partial that you get by touching the "12"th fret - which is 1st partial (hardcoded in #fret-partials) - and then translates this into a pitch-delta from c'; this yields #'(1 0 0) (hardcoded in #partial-pitch) which means c''. Hence, you basically call (calc-harmonic-pitch pitch-c'' pitch-c'). This yields c'', hence the call of pitch-semitones returns 12.
```
```
2) Now, calc-harmonic-pitch (which seems to have been written by Carl 10 years ago, so I'm very glad he chimed in already) seems to me to be basically a variant of \transpose, for instance:
```
\version "2.21.0"

chp =
#(define-music-function (p m) (ly:pitch? ly:music?)
(calc-harmonic-pitch p m))

mus = \relative c' {
c4 d e f g
}

\new Staff { \chp f' \mus }

```
(But, as I already remarked yesterday, I think that calc-harmonic-pitch does not work correctly for chords in \relative music:
```
\version "2.21.0"

chp =
#(define-music-function (p m) (ly:pitch? ly:music?)
(calc-harmonic-pitch p m))

mus = \relative c' {
c4 <d g'> e f g
}

\new Staff { \chp c'' \mus }

If this is expected behaviour, then at least I do not understand it.)

```
3) Ok, assuming that my diagnosis is correct and you actually just achieve \set minimumFret = 12 (at least it's obvious that your code does not depend on the parameters given to harmonicByFret): This shouldn't be what we need, I think, because we explicitly asked for frets no. 7 and 5, respectively. We shouldn't force a minimum fret, but a string number.
```
```
4) All of this makes so little sense to me that I'm sure I suffer from some fundamental misunderstanding of the way the harmonics implementation is supposed to work. I have no idea why LilyPond, when we minimumFret to 12, created a harmonic note on the string above with fret number smaller than 12. So I probably should ask: Is my understanding correct that printing <7> on a certain second string in a tablature diagram should mean that this string should be played with an open harmonic with finger on the 7th fret?
```
Lukas

```