lilypond-user
[Top][All Lists]
Advanced

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

Re: Cowell clusters


From: Klaus Blum
Subject: Re: Cowell clusters
Date: Fri, 18 Dec 2020 20:50:36 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1

Ooops,
sorry for that mess in my last post.
This time, I'll copy-past my code straight from Frescobaldi.
Hope it works now...

Cheers,
Klaus


% ------------------------------------------------------------------
\version "2.20.0"

toneClusterDown = #(define-music-function
                    (note1 note2) (ly:music? ly:music?)
                    (let*
                     (
                       (p1 (ly:music-property note1 'pitch))
                       (p2 (ly:music-property note2 'pitch))
                       (y1 (+ (* 7 (ly:pitch-octave p2))
(ly:pitch-notename p2)))
                       (y2 (+ (* 7 (ly:pitch-octave p1))
(ly:pitch-notename p1)))
                       (steps
                        (if (> y1 y2)
                            (- y1 y2)
                            (- y2 y1)
                            )
                        )
                       (note-a (if (> y1 y2) note1 note2 ))
                       (note-b (if (> y1 y2) note2 note1 ))
                       )
                     #{
                       {
                         \once \voiceTwo
                         <<
                           #note-a
                           \new Voice {
                             \voiceTwo
                             \tweak NoteHead.stem-attachment #'(0 . 0.7)
                             \tweak Stem.length #(- steps 1.4)
                             \tweak Stem.thickness #2
                             \tweak Flag.stencil ##f
                             #note-b
                           }
                         >>
                       }
                     #})
                    )

toneClusterUp = #(define-music-function
                  (note1 note2) (ly:music? ly:music?)
                  (let*
                   (
                     (p1 (ly:music-property note1 'pitch))
                     (p2 (ly:music-property note2 'pitch))
                     (y1 (+ (* 7 (ly:pitch-octave p2))
(ly:pitch-notename p2)))
                     (y2 (+ (* 7 (ly:pitch-octave p1))
(ly:pitch-notename p1)))
                     (steps
                      (if (> y1 y2)
                          (- y1 y2)
                          (- y2 y1)
                          )
                      )
                     (note-a (if (> y1 y2) note1 note2 ))
                     (note-b (if (> y1 y2) note2 note1 ))
                     )
                   #{
                     {
                       \once \voiceOne
                       <<
                         #note-b
                         \new Voice {
                           \voiceOne
                           \tweak NoteHead.stem-attachment #'(0 . 0.7)
                           \tweak Stem.length #(- steps 1.4)
                           \tweak Stem.thickness #2
                           \tweak Flag.stencil ##f
                           #note-a
                         }
                       >>
                     }
                   #})
                  )

%% Test:
{
  \toneClusterDown f'1 f''
  \toneClusterDown f'2 f''
  \toneClusterDown g'' g'
  \toneClusterDown a' a''
  \toneClusterDown b'' b'
  \toneClusterDown c''4. a''
  \toneClusterDown d''8 g''
  \toneClusterDown g'8 c''
  \toneClusterDown g'8 c''
  \toneClusterDown a cis'''
  \toneClusterDown a cis'''
  \bar "||"
  \toneClusterUp f'1 f''
  \toneClusterUp f'2 f''
  \toneClusterUp g'' g'
  \toneClusterUp a' a''
  \toneClusterUp b'' b'
  \toneClusterUp c''4. a''
  \toneClusterUp d''8 g''
  \toneClusterUp g'8 c''
  \toneClusterUp g'8 c''
  \toneClusterUp a cis'''
  \toneClusterUp a cis'''
}
% ------------------------------------------------------------------




reply via email to

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