Tone cluster

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Tone cluster

Schneidy
Hi All,

I have this function to make a tone cluster:

%%%%
\version "2.20.0"

toneCluster = #(define-music-function
                 (note1 note2) (ly:music? ly:music?)
                   #{
                      <<
                        { #note1 }
                        {
                          \once\override NoteHead.stem-attachment = #'(0 . 0)
                          \once\override Stem.length = #14 % <= Manually set.
                          \once\override Stem.thickness = #7
                          #note2
                        }
                      >>
                   #})

% Test:
{
  a' \toneCluster a a'' a' \toneCluster a cis''''
}
%%%%

How could I set the stem length automagically according to the pitch difference?

Cheers,
Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Schneidy
Here's another try:

\version "2.20.0"

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?

Cheers,
Pierre

Le mer. 20 mai 2020 à 13:38, Pierre Perol-Schneider <[hidden email]> a écrit :
Hi All,

I have this function to make a tone cluster:

%%%%
\version "2.20.0"

toneCluster = #(define-music-function
                 (note1 note2) (ly:music? ly:music?)
                   #{
                      <<
                        { #note1 }
                        {
                          \once\override NoteHead.stem-attachment = #'(0 . 0)
                          \once\override Stem.length = #14 % <= Manually set.
                          \once\override Stem.thickness = #7
                          #note2
                        }
                      >>
                   #})

% Test:
{
  a' \toneCluster a a'' a' \toneCluster a cis''''
}
%%%%

How could I set the stem length automagically according to the pitch difference?

Cheers,
Pierre
Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Valentin Villenave-3
On 5/20/20, Pierre Perol-Schneider <[hidden email]> wrote:
> Anything better?

Nothing better. I was about to suggest using a modifier Arpeggio
stencil, but your solution is simpler and better.

I’m not really sure why you’d need a music function at all, though:

%%%%

toneCluster ={
  \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
}

%% Test:
{
  a' \toneCluster <a a''> a' \toneCluster <a cis''''>
}

%%%%

Now, there must be a way of doing that with \tweak, but I couldn’t find it.

Cheers,
-- V.

Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Klaus Blum
In reply to this post by Schneidy
Salut Pierre,

Am 20.05.2020 um 18:00 schrieb [hidden email]:

 > 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 | Threaded
Open this post in threaded view
|

Re: Tone cluster

David Kastrup
In reply to this post by Valentin Villenave-3
Valentin Villenave <[hidden email]> writes:

> On 5/20/20, Pierre Perol-Schneider <[hidden email]> wrote:
>> Anything better?
>
> Nothing better. I was about to suggest using a modifier Arpeggio
> stencil, but your solution is simpler and better.
>
> I’m not really sure why you’d need a music function at all, though:
>
> %%%%
>
> toneCluster ={
>   \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
> }
>
> %% Test:
> {
>   a' \toneCluster <a a''> a' \toneCluster <a cis''''>
> }
>
> %%%%
>
> Now, there must be a way of doing that with \tweak, but I couldn’t find it.

If nothing else, \single \toneCluster of course.

--
David Kastrup

Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Schneidy
In reply to this post by Klaus Blum
Humm, thank you Klaus, that looks pretty good!

Le mer. 20 mai 2020 à 22:29, Klaus Blum <[hidden email]> a écrit :
Salut Pierre,

Am 20.05.2020 um 18:00 schrieb [hidden email]:

 > 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 | Threaded
Open this post in threaded view
|

Re: Tone cluster

Gianmaria Lari
Hello Klaus and Pierre,

I tried to use your \toneCluster and it works perfectly for me. Now I tried to use \toneCluster with tie like this:

 \toneCluster f'  f'' ~ \toneCluster f' f'' 

... and it works well except it only add a single tie at the top. Is there any way to add a lower and upper tie like in the attached picture?

Thanks, gianmaria


Annotation 2020-05-22 164608.jpg (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Schneidy
Hi Gianmaria,

 \toneCluster f' ~ f'' ~ \toneCluster f' f''

should work.
Cheers,
Pierre

Le ven. 22 mai 2020 à 16:52, Gianmaria Lari <[hidden email]> a écrit :
Hello Klaus and Pierre,

I tried to use your \toneCluster and it works perfectly for me. Now I tried to use \toneCluster with tie like this:

 \toneCluster f'  f'' ~ \toneCluster f' f'' 

... and it works well except it only add a single tie at the top. Is there any way to add a lower and upper tie like in the attached picture?

Thanks, gianmaria

Reply | Threaded
Open this post in threaded view
|

Re: Tone cluster

Gianmaria Lari
 \toneCluster f' ~ f'' ~ \toneCluster f' f'' 

should work.

Yes, it works :)

Thanks Pierre!
g.