lilypond-user
[Top][All Lists]
Advanced

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

Re: Tone cluster


From: Pierre Perol-Schneider
Subject: Re: Tone cluster
Date: Wed, 20 May 2020 22:38:37 +0200

Humm, thank you Klaus, that looks pretty good!

Le mer. 20 mai 2020 à 22:29, Klaus Blum <address@hidden> a écrit :
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]