lilypond-user
[Top][All Lists]
Advanced

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

Re: Tone cluster


From: Klaus Blum
Subject: Re: Tone cluster
Date: Wed, 20 May 2020 22:27:34 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

Salut Pierre,

Am 20.05.2020 um 18:00 schrieb address@hidden:

> 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

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