Thank you for your valuable suggestions!
I took the music function by Pierre-Luc and modified as follows:

artificialHarmonicMod = #(define-music-function
                          (stopped touched result duration)
                          (ly:music? ly:music? ly:pitch? ly:duration?)
                          #{
                            <<
                              {
                                \voiceOne \stemDown
                                <$stopped $touched \harmonic>$duration
                              }
                              \new Voice
                              { \voiceTwo \once \omit Stem \once \omit Flag
\parenthesize $result 32 ^\flageolet }
                            >> \oneVoice \stemNeutral
                          #})

\new Staff {
  \relative c' {
    \artificialHarmonicMod cis_~ fis cis'' 4
    \artificialHarmonicMod cis,, gis' gis'' 4
  }
}

In this way it is possible to put ties between common notes, for example.
Is there a way to insert an optional argument in the music function? I
would have the possibility to express a post-event, like tremolo or
glissando.

Thank you

Rip_Mus

Il giorno lun 2 mag 2022 alle ore 18:33 Pierre-Luc Gauthier <
p.luc.gauth...@gmail.com> ha scritto:

> I used this extensively (in Stravinsky and whatnot).
>
> artificialHarmonic = #(define-music-function
>                        (stopped touched result duration)
>                        (ly:pitch? ly:pitch? ly:pitch? ly:duration?)
>                        #{
>                          \afterGrace
>                          <$stopped
>                          $touched \harmonic>$duration
>                          \tweak NoteHead.font-size -6
>                          \tweak Stem.stencil f
>                          \tweak Beam.stencil f
>                          \tweak Flag.stencil f
>                          \parenthesize
>                          $result \harmonic
>                        #})
>
> used as :
> \artificialHarmonic ds,, fs as''1.
>
> It works for me but is not quite perfect. For one, I would love for it
> to generate only the midi for the $resulting note and not the whole
> chord (which is musically totally irrelevant).
>
> Hope it helps
> --
> Pierre-Luc Gauthier
>

Reply via email to