Humm, thank you Klaus, that looks pretty good!

Le mer. 20 mai 2020 à 22:29, Klaus Blum <benbigno...@gmx.de> a écrit :

> Salut Pierre,
>
> Am 20.05.2020 um 18:00 schrieb lilypond-user-requ...@gnu.org:
>
>  > toneCluster = #(define-music-function
>  >                  (note1 note2) (ly:music? ly:music?)
>  >                    #{
>  >                       {
>  >                         \once\override NoteHead.stem-attachment =
> #'(0 . 0)
>  >                         \once \override Stem.length =
>  >                                   #(lambda (grob)
>  >                                        (- (ly:stem::calc-length grob)
> 4.5))
>  >                         \once\override Stem.thickness = #8
>  >                         < #note1 #note2 >
>  >                       }
>  >                    #})
>  >
>  > %% Test:
>  > {
>  >   a' \toneCluster a a'' a' \toneCluster a cis''''
>  > }
>  >
>  > Anything better?
>
>
> How about that:
> take the two pitches, calculate how many steps are between them and use
> that as stem length.
>
> % -----------------------------------------
> \version "2.19.83"
>
> toneCluster = #(define-music-function
>                  (note1 note2) (ly:music? ly:music?)
>                  (let*
>                   (
>                     (p1 (ly:music-property note1 'pitch))
>                     (p2 (ly:music-property note2 'pitch))
>                     (steps
>                      (-
>                       (+ (* 7 (ly:pitch-octave p2)) (ly:pitch-notename p2))
>                       (+ (* 7 (ly:pitch-octave p1)) (ly:pitch-notename p1))
>                       )
>                      )
>                     )
>                   #{
>                     {
>                       \once\override NoteHead.stem-attachment = #'(0 . 0)
>                       \once \override Stem.length = #steps
>                       \once\override Stem.thickness = #8
>                       < #note1 #note2 >
>                     }
>                   #})
>                  )
>
> %% Test:
> {
>    a' \toneCluster a' a''  a' \toneCluster a cis'''
> }
> % -----------------------------------------
>
> Cheers,
> Klaus
>
>

Reply via email to