Re: Separating pitch and rhythm

2012-03-26 Thread Janek Warchoł
On Sun, Mar 25, 2012 at 11:52 PM, David Kastrup d...@gnu.org wrote:
 Janek Warchoł janek.lilyp...@gmail.com writes:

 Thanks for this!  I'll keep it bookmarked.

 You can remove the definition of for-some-music: that's defined in
 LilyPond properly by now.

Yeah, i remember an issue about it.
thanks,
Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-25 Thread Janek Warchoł
David,

On Wed, Mar 21, 2012 at 7:54 PM, David Kastrup d...@gnu.org wrote:

 Possibly this mail got lost, so I rewrite it (code is somewhat different).

 Siska Ádám sa...@sadam.hu writes:

 Dear List,


 is there an effective way to separate the pitches and the rhythms in a
 voice? I'm thinking about something like defining a variable
 consisting only of rhythms:

 Rhythm = {
       \time 4/4
       4 4 4. 8
       8 8 4 4 8 8
       2 4 8 8 ...
 }

 and then apply this to different sequences of pitches:

 Seq1 = {
       \clef treble
       c d e f
       g a g f e d
       c e g c ...
 }

 Seq2 = {
       \clef bass
       c b a g
       f e f g a b
       c g e c ...
 }

 #(define-public (for-some-music stop? music)
  Walk through @var{music}, process all elements calling @var{stop?}
 and only recurse if this returns @code{#f}.
  (let loop ((music music))
    (if (not (stop? music))
       (let ((elt (ly:music-property music 'element)))
         (if (ly:music? elt)
             (loop elt))
         (for-each loop (ly:music-property music 'elements))
         (for-each loop (ly:music-property music 'articulations))

 #(define (extract-all-durations music)
   (map! (lambda (m) (ly:music-property m 'duration))
         (extract-music music
                        (lambda (m) (ly:duration?
                                      (ly:music-property m 'duration))

 applyRhythm =
 #(define-music-function (parser location p r)
  (ly:music? ly:music?)
    (let ((l (extract-all-durations r)))
      (for-some-music
        (lambda (m)
          (or (null? l)
              (and (ly:duration? (ly:music-property m 'duration))
                   (begin
                     (set! (ly:music-property m 'duration) (car l))
                     (set! l (cdr l))
                     #t
        p))
  p)

 Rhythm = {
        s4 s4 s4. s8
        s8 s8 s4 s4 s8 s8
        s2 s4 s8 s8
 }

 SeqI = {
        \clef treble
        c d e f
        g a g f e d
        c e g c
 }

 SeqII = {
        \clef bass
        c b a g
        f e f g a b
        c g e c
 }

 \new PianoStaff
  \new Staff \applyRhythm \SeqI \Rhythm
   \new Staff \applyRhythm \SeqII \Rhythm


Thanks for this!  I'll keep it bookmarked.

Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-25 Thread David Kastrup
Janek Warchoł janek.lilyp...@gmail.com writes:

 Thanks for this!  I'll keep it bookmarked.

You can remove the definition of for-some-music: that's defined in
LilyPond properly by now.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-22 Thread David Kastrup
Siska Ádám sa...@sadam.hu writes:

 Dear List,


 is there an effective way to separate the pitches and the rhythms in a
 voice? I'm thinking about something like defining a variable
 consisting only of rhythms:

 Rhythm = {
   \time 4/4
   4 4 4. 8
   8 8 4 4 8 8
   2 4 8 8 ...
 }

 and then apply this to different sequences of pitches:

 Seq1 = {
   \clef treble
   c d e f
   g a g f e d
   c e g c ...
 }

 Seq2 = {
   \clef bass
   c b a g
   f e f g a b
   c g e c ...
 }

#(define-public (for-some-music recurse? music)
  Walk through @var{music}, process all elements calling @var{recurse?}
and only recurse if this returns true.
  (let loop ((music music))
(if (recurse? music)
   (let ((elt (ly:music-property music 'element)))
 (if (ly:music? elt)
 (loop elt))
 (for-each loop (ly:music-property music 'elements))
 (for-each loop (ly:music-property music 'articulations))

#(define (extract-all-durations music)
   (map! (lambda (m) (ly:music-property m 'duration))
 (extract-music music
(lambda (m) (ly:duration?
  (ly:music-property m 'duration))

applyRhythm =
#(define-music-function (parser location p r)
  (ly:music? ly:music?)
(let ((l (extract-all-durations r)))
  (for-some-music
(lambda (m)
  (and (pair? l)
   (if (ly:duration? (ly:music-property m 'duration))
   (begin
 (set! (ly:music-property m 'duration) (car l))
 (set! l (cdr l))
 #f)
   #t)))
  p))
  p)

Rhythm = {
s4 s4 s4. s8
s8 s8 s4 s4 s8 s8
s2 s4 s8 s8
}
 
SeqI = {
\clef treble
c d e f
g a g f e d
c e g c
}

SeqII = {
\clef bass
c b a g
f e f g a b
c g e c
}

\new PianoStaff
 \new Staff \applyRhythm \SeqI \Rhythm
   \new Staff \applyRhythm \SeqII \Rhythm



I have written the for-some-music function previously but not
committed it since I could not immediately think of an application.  But
it fits the bill here reasonably nicely.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Separating pitch and rhythm

2012-03-21 Thread Siska Ádám
Dear List,


is there an effective way to separate the pitches and the rhythms in a voice? 
I'm thinking about something like defining a variable consisting only of 
rhythms:

Rhythm = {
\time 4/4
4 4 4. 8
8 8 4 4 8 8
2 4 8 8 ...
}

and then apply this to different sequences of pitches:

Seq1 = {
\clef treble
c d e f
g a g f e d
c e g c ...
}

Seq2 = {
\clef bass
c b a g
f e f g a b
c g e c ...
}

(etc.)

The purpose is: I'm engraving a long, homophonic section in an orchestral 
piece, where cca. 30 instruments play the same rhythms, but with different 
pitches.


Thanks for any ideas,
Ádám


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread Xavier Scheuer
2012/3/21 Siska Ádám sa...@sadam.hu:
 Dear List,


 is there an effective way to separate the pitches and the rhythms in a voice?
 I'm thinking about something like defining a variable consisting only of
 rhythms:

 (snip)

 The purpose is: I'm engraving a long, homophonic section in an orchestral
 piece, where cca. 30 instruments play the same rhythms, but with different
 pitches.

Hi,

LSR #390 and #654 might help here.
http://lsr.dsi.unimi.it/LSR/Item?id=390
http://lsr.dsi.unimi.it/LSR/Item?id=654

Cheers,
Xavier

-- 
Xavier Scheuer x.sche...@gmail.com

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm AND structure

2012-03-21 Thread D'Arcy Cain

On 12-03-21 11:05 AM, Siska Ádám wrote:

is there an effective way to separate the pitches and the rhythms in a voice? 
I'm thinking about something like defining a variable consisting only of 
rhythms:

Rhythm = {
\time 4/4
4 4 4. 8
8 8 4 4 8 8
2 4 8 8 ...
}

and then apply this to different sequences of pitches:


Sounds like it would be a cool feature if it existed.  Not sure how
universally useful it would be but it made me think of a similar
feature that I would like.  Similar to above but for structure;

Structure = {
  \key c \major
  \tempo 4 = 110
  \time 4/4
  \partial 4

  % intro
  4 |
  1 1 |

  \repeat volta 2 {
1 1 1 1 1 1 1 1 1 1 1 1
  }

  1\fermata \bar |.
}

And then everything else would be forced into that structure.  Perhaps
it can be combined.  Specify the rhythm as you suggest and add a flag
(strict?) to specific parts to apply the rhythm as you suggest.  That
way you don't have to have all or nothing.  Some parts can follow the
strict rhythm and other parts can deviate as long as it fits.

Not sure if key and tempo belong in structure.

--
D'Arcy J.M. Cain da...@druid.net |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
IM: da...@vex.net

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread Siska Ádám
Dear Xavier,
On 2012.03.21., at 16:44, Xavier Scheuer wrote:
 2012/3/21 Siska Ádám sa...@sadam.hu:
 Dear List,
 
 
 is there an effective way to separate the pitches and the rhythms in a voice?
 I'm thinking about something like defining a variable consisting only of
 rhythms:
 
 (snip)
 
 The purpose is: I'm engraving a long, homophonic section in an orchestral
 piece, where cca. 30 instruments play the same rhythms, but with different
 pitches.
 
 Hi,
 
 LSR #390 and #654 might help here.
 http://lsr.dsi.unimi.it/LSR/Item?id=390
 http://lsr.dsi.unimi.it/LSR/Item?id=654
 
 Cheers,
 Xavier

thank you a lot for this!


Best,
Ádám


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread Janek Warchoł
On Wed, Mar 21, 2012 at 4:05 PM, Siska Ádám sa...@sadam.hu wrote:
 is there an effective way to separate the pitches and the rhythms in a voice? 
 I'm thinking about something like defining a variable consisting only of 
 rhythms:
 The purpose is: I'm engraving a long, homophonic section
 in an orchestral piece, where cca. 30 instruments play
 the same rhythms, but with different pitches.

Use Frescobaldi's copy/paste durations function.  (unless you want to
have this carved into your source files).

cheers,
Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm AND structure

2012-03-21 Thread Janek Warchoł
On Wed, Mar 21, 2012 at 4:47 PM, D'Arcy Cain da...@druid.net wrote:
 On 12-03-21 11:05 AM, Siska Ádám wrote:
 I'm thinking about something like defining a variable
 consisting only of rhythms:
 and then apply this to different sequences of pitches:

 Sounds like it would be a cool feature if it existed.

As i wrote, Frescobaldi has this function.

 Not sure how
 universally useful it would be but it made me think of a similar
 feature that I would like.  Similar to above but for structure;

Funny that you ask about it, because i'll be discussing this feature
in the next LilyPond Report (it will be announced shortly) - i invite
you to participate in the discussion when it's published.

cheers,
Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread Siska Ádám
Hi,

On 2012.03.21., at 19:18, Janek Warchoł wrote:

 On Wed, Mar 21, 2012 at 4:05 PM, Siska Ádám sa...@sadam.hu wrote:
 is there an effective way to separate the pitches and the rhythms in a 
 voice? I'm thinking about something like defining a variable consisting only 
 of rhythms:
 The purpose is: I'm engraving a long, homophonic section
 in an orchestral piece, where cca. 30 instruments play
 the same rhythms, but with different pitches.
 
 Use Frescobaldi's copy/paste durations function.  (unless you want to
 have this carved into your source files).
 
 cheers,
 Janek

The last time when I checked, there was no available Mac installer for 
Frescobaldi, so it's not an option for me. :-(

Best,
Ádám


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm AND structure

2012-03-21 Thread bobr...@centrum.is

- Original Message -
From: D'Arcy Cain da...@druid.net
To: lilypond-user@gnu.org
Sent: Wed, 21 Mar 2012 15:47:14 - (GMT)
Subject: Re: Separating pitch and rhythm AND structure

On 12-03-21 11:05 AM, Siska Ádám wrote:
 is there an effective way to separate the pitches and the rhythms in a voice? 
 I'm thinking about something like defining a variable consisting only of 
 rhythms:

 Rhythm = {
   \time 4/4
   4 4 4. 8
   8 8 4 4 8 8
   2 4 8 8 ...
 }

 and then apply this to different sequences of pitches:

Sounds like it would be a cool feature if it existed.  Not sure how
universally useful it would be but it made me think of a similar
feature that I would like.  Similar to above but for structure;

Structure = {
   \key c \major
   \tempo 4 = 110
   \time 4/4
   \partial 4

   % intro
   4 |
   1 1 |

   \repeat volta 2 {
 1 1 1 1 1 1 1 1 1 1 1 1
   }

   1\fermata \bar |.
}

And then everything else would be forced into that structure.  Perhaps
it can be combined.  Specify the rhythm as you suggest and add a flag
(strict?) to specific parts to apply the rhythm as you suggest.  That
way you don't have to have all or nothing.  Some parts can follow the
strict rhythm and other parts can deviate as long as it fits.

Not sure if key and tempo belong in structure.

Well the second one is possible now.  You can do linebreaks, repeats and, I 
believe articulations as well by simply putting them in a separate definition 
block like this:

structure = {
  s1*4 \break
  \repeat volta 2 { s1*2}
  \alternative {
{ s1 }
  }
  s1
  \bar |.
}

...and then combining them later with the musical layer with something like:


\score{
  \context Staff 
\music
\structure
  
}

-David




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread Janek Warchoł
On Wed, Mar 21, 2012 at 7:44 PM, Siska Ádám sa...@sadam.hu wrote:
 Hi,

 On 2012.03.21., at 19:18, Janek Warchoł wrote:

 On Wed, Mar 21, 2012 at 4:05 PM, Siska Ádám sa...@sadam.hu wrote:
 is there an effective way to separate the pitches and the rhythms in a 
 voice? I'm thinking about something like defining a variable consisting 
 only of rhythms:
 The purpose is: I'm engraving a long, homophonic section
 in an orchestral piece, where cca. 30 instruments play
 the same rhythms, but with different pitches.

 Use Frescobaldi's copy/paste durations function.  (unless you want to
 have this carved into your source files).

 The last time when I checked, there was no available Mac installer for 
 Frescobaldi, so it's not an option for me. :-(

Ah.
Well, if i were you, i'd install Linux as a virtual machine and use
Frescobaldi there (unless your machine is very slow).  You can use our
instructions for installing Lilydev:
http://lilypond.org/doc/v2.15/Documentation/contributor-big-page#lilydev

hth,
Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm AND structure

2012-03-21 Thread Janek Warchoł
On Wed, Mar 21, 2012 at 8:15 PM, bobr...@centrum.is bobr...@centrum.is wrote:
 Well [..]  You can do linebreaks, repeats and I believe articulations as well,
 by simply putting them in a separate voice
 and then combining them later with the musical voice

That's true, but this solution has it's drawbacks.  Stay tuned for
next LilyPond Report!

Janek

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Separating pitch and rhythm

2012-03-21 Thread David Kastrup

Possibly this mail got lost, so I rewrite it (code is somewhat different).

Siska Ádám sa...@sadam.hu writes:

 Dear List,


 is there an effective way to separate the pitches and the rhythms in a
 voice? I'm thinking about something like defining a variable
 consisting only of rhythms:

 Rhythm = {
   \time 4/4
   4 4 4. 8
   8 8 4 4 8 8
   2 4 8 8 ...
 }

 and then apply this to different sequences of pitches:

 Seq1 = {
   \clef treble
   c d e f
   g a g f e d
   c e g c ...
 }

 Seq2 = {
   \clef bass
   c b a g
   f e f g a b
   c g e c ...
 }

#(define-public (for-some-music stop? music)
  Walk through @var{music}, process all elements calling @var{stop?}
and only recurse if this returns @code{#f}.
  (let loop ((music music))
(if (not (stop? music))
   (let ((elt (ly:music-property music 'element)))
 (if (ly:music? elt)
 (loop elt))
 (for-each loop (ly:music-property music 'elements))
 (for-each loop (ly:music-property music 'articulations))

#(define (extract-all-durations music)
   (map! (lambda (m) (ly:music-property m 'duration))
 (extract-music music
(lambda (m) (ly:duration?
  (ly:music-property m 'duration))

applyRhythm =
#(define-music-function (parser location p r)
  (ly:music? ly:music?)
(let ((l (extract-all-durations r)))
  (for-some-music
(lambda (m)
  (or (null? l)
  (and (ly:duration? (ly:music-property m 'duration))
   (begin
 (set! (ly:music-property m 'duration) (car l))
 (set! l (cdr l))
 #t
p))
  p)

Rhythm = {
s4 s4 s4. s8
s8 s8 s4 s4 s8 s8
s2 s4 s8 s8
}
 
SeqI = {
\clef treble
c d e f
g a g f e d
c e g c
}

SeqII = {
\clef bass
c b a g
f e f g a b
c g e c
}

\new PianoStaff
 \new Staff \applyRhythm \SeqI \Rhythm
   \new Staff \applyRhythm \SeqII \Rhythm



I have written the for-some-music function previously but not
committed it since I could not immediately think of an application.  But
it fits the bill here reasonably nicely.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user