Re: Expanding bowed arpeggios

2013-01-28 Thread Olivier Biot
On Mon, Jan 28, 2013 at 10:03 AM, David Kastrup  wrote:

> Olivier Biot  writes:
>
> > Many thanks for your help David!
> >
> > Having used it I realize that it works perfectly for my purpose, but
> > maybe others may want to add e.g. fingerings, cautionary accidentals,
> > articulations and dynamics to the arpeggiated output. That of course
> > won't work with the current code for "arpeggiate" since I only look at
> > the notes.
> >
> > Imagine the following naive (not functional) snippet:
> >
> > \arpeggiate 16 c-< g'-1 b'!-3 f'-4-\!
> >
> > Ideally it would render the fingering either to the far left of the
> > arpeggio, or e.g. above each single note of the arpeggiated chord in
> > the first half (avoiding fingering repetitions).
> >
> > How could that be addressed?
>
> That involves, apart from the \relative aspect, deconstructing the above
> expression and synthesizing a new one from it.  There are no convincing
> user-level tools for deconstruction of a music expression short of
> picking everything apart in Scheme via ly:music-property and its ilk.
>
> There is some half-Scheme approach called with-music-match in the
> display-lily code.  Turning this into a proper and usefully powerful
> method working with LilyPond syntax templates, possibly combining it
> with the pattern-matching module available for GUILE would be an
> interesting task.
>
> But without a well-accessible more general transformation tool, I don't
> really see a real user-accessible solution that would not start from
> single pitches, thus not needing to deconstruct anything.
>

Thank you for explaining the complexity of my naive request. I apparently
managed to write a challenging trick question :-)

I suppose that, to get such a construct to work, one needs to:
1. change the argument type in 'arpeggiate' from 'ly:pitch' to something
else (maybe ly:music?)
2. separate "notes" (pitch & duration maybe) from their "extra"
(articulations, dynamics, fingerings, script etc).
3. do the relative / absolute pitch magic with 'make-relative'
4. reattach the "extra" bits to the right notes in 'arpeggiate'

Another approach could be to overlay the "extra" on the output of the
'arpeggiate' macro, similar to the 'changePitch' macro from LSR (
http://lsr.dsi.unimi.it/LSR/Item?id=654).

Thirdly, these "extra" bits could be provided as arguments of the
'arpeggiate' macro.

I don't think I can make any of the above work though :)

Best regards,

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


Re: Expanding bowed arpeggios

2013-01-28 Thread David Kastrup
Olivier Biot  writes:

> Many thanks for your help David!
>
> Having used it I realize that it works perfectly for my purpose, but
> maybe others may want to add e.g. fingerings, cautionary accidentals,
> articulations and dynamics to the arpeggiated output. That of course
> won't work with the current code for "arpeggiate" since I only look at
> the notes.
>
> Imagine the following naive (not functional) snippet:
>
> \arpeggiate 16 c-< g'-1 b'!-3 f'-4-\!
>
> Ideally it would render the fingering either to the far left of the
> arpeggio, or e.g. above each single note of the arpeggiated chord in
> the first half (avoiding fingering repetitions).
>
> How could that be addressed?

That involves, apart from the \relative aspect, deconstructing the above
expression and synthesizing a new one from it.  There are no convincing
user-level tools for deconstruction of a music expression short of
picking everything apart in Scheme via ly:music-property and its ilk.

There is some half-Scheme approach called with-music-match in the
display-lily code.  Turning this into a proper and usefully powerful
method working with LilyPond syntax templates, possibly combining it
with the pattern-matching module available for GUILE would be an
interesting task.

But without a well-accessible more general transformation tool, I don't
really see a real user-accessible solution that would not start from
single pitches, thus not needing to deconstruct anything.

-- 
David Kastrup


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


Re: Expanding bowed arpeggios

2013-01-27 Thread Olivier Biot
On Thu, Jan 17, 2013 at 2:56 PM, David Kastrup  wrote:

>
> Try something like (planning to commit this macro soonish)
> #(defmacro-public make-relative (pitches last-pitch music) [code snipped]
>
> arpeggiate =
> #(define-music-function (parser location d p1 p2 p3 p4)
>(ly:duration? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
>"Arpeggiate each of the 4 notes note with a duration of d."
>(make-relative (p1 p2 p3 p4) p1
> #{
>   $p1 $d ( $p2 $d $p3 $d $p4 $d )
>   $p4 $d ( $p3 $d $p2 $d $p1 $d )
> #}))
>
> This is based on the assumption that you want the next relative pitch be
> based on the _first_ note of the arpeggio.  If you want it based on the
> last instead, write
>(make-relative (p1 p2 p3 p4) p4
> in the respective line.
>

Thanks David - works like a charm!!!


>  > So far I didn't find a way to make my arpeggio expansion work with
> > notes in *relative pitch*. My bet is that I need to do some magic on
> > "ly:pitch?" to get it to work, but I am clueless since I don't know
> > what I should type as search keywords to get that information. Is
> > there for example a relative-pitch-to-absolute-pitch checker routine
> > that I could use?
>
> Sorry for taking so long.  Designing a "user interface" and actually
> coding this was not exactly trivial.  Note that arpeggiate will work
> fine _both_ when using \relative and when not using it.
>

Many thanks for your help David!

Having used it I realize that it works perfectly for my purpose, but maybe
others may want to add e.g. fingerings, cautionary accidentals,
articulations and dynamics to the arpeggiated output. That of course won't
work with the current code for "arpeggiate" since I only look at the notes.

Imagine the following naive (not functional) snippet:

\arpeggiate 16 c-< g'-1 b'!-3 f'-4-\!

Ideally it would render the fingering either to the far left of the
arpeggio, or e.g. above each single note of the arpeggiated chord in the
first half (avoiding fingering repetitions).

How could that be addressed?

Best regards,

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


Re: Expanding bowed arpeggios

2013-01-26 Thread David Kastrup
David Kastrup  writes:

> shutterfreak  writes:
>
>> shutterfreak wrote
>>> On Sat, Nov 24, 2012 at 1:26 PM, Olivier Biot <
>>
>>> olivier.biot@
>>
>>> >wrote:
>>> 
>>> Dear all,
>>> 
>>> Following up on my own request, I stumbled upon an insightful article
>>> featuring Bach's prelude for piano (BWV 846):
>>> http://news.lilynet.net/?The-LilyPond-Report-23#feature_story_prelude_1_in_scheme
>>> 
>>> Based on this example I managed to create a first version, which however
>>> only works with *absolute* pitches (see measure 1).
>>> 
>>> How can I make it work with *relative* pitches (see measure 2)?
>
> Try something like (planning to commit this macro soonish)
> #(defmacro-public make-relative (pitches last-pitch music)
>
>> So far I didn't find a way to make my arpeggio expansion work with
>> notes in *relative pitch*. My bet is that I need to do some magic on
>> "ly:pitch?" to get it to work, but I am clueless since I don't know
>> what I should type as search keywords to get that information. Is
>> there for example a relative-pitch-to-absolute-pitch checker routine
>> that I could use?
>
> Sorry for taking so long.  Designing a "user interface" and actually
> coding this was not exactly trivial.  Note that arpeggiate will work
> fine _both_ when using \relative and when not using it.

Enthusiastically acclaimed (none of the reviewers pointed out anything
he considered less than perfect), this macro has progressed into the
LilyPond code base under the auspices of issue 3118
http://code.google.com/p/lilypond/issues/detail?id=3118> and will
appear in version 2.17.11.

-- 
David Kastrup

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


Re: Expanding bowed arpeggios

2013-01-17 Thread David Kastrup
shutterfreak  writes:

> shutterfreak wrote
>> On Sat, Nov 24, 2012 at 1:26 PM, Olivier Biot <
>
>> olivier.biot@
>
>> >wrote:
>> 
>> Dear all,
>> 
>> Following up on my own request, I stumbled upon an insightful article
>> featuring Bach's prelude for piano (BWV 846):
>> http://news.lilynet.net/?The-LilyPond-Report-23#feature_story_prelude_1_in_scheme
>> 
>> Based on this example I managed to create a first version, which however
>> only works with *absolute* pitches (see measure 1).
>> 
>> How can I make it work with *relative* pitches (see measure 2)?
>> 
>> %%% BEGIN Snippet
>> \version "2.16.1"
>> 
>> arpeggiate = #(define-music-function (parser location d p1 p2 p3 p4)
>> (ly:duration? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
>> "Arpeggiate each of the 4 notes note with a duration of
>> d."
>> #{
>>   $p1 $d ( $p2 $d $p3 $d $p4 $d )
>>   $p4 $d ( $p3 $d $p2 $d $p1 $d )
>> #})
>> 
>> theMusic = {
>>   \arpeggiate 8 g d' a' e''
>>   \relative g {
>> \arpeggiate 8 g d' a' e'
>>   }
>> }

Try something like (planning to commit this macro soonish)
#(defmacro-public make-relative (pitches last-pitch music)
  "The list of pitch-carrying variables in @var{pitches} is used as a
sequence for creating relativable music from @var{music}.
The variables in @var{pitches} are, when considered inside of
@code{\\relative}, all considered to be specifications to the preceding
variable.  The first variable is relative to the preceding musical
context, and @var{last-pitch} specifies the pitch passed as relative
base onto the following musical context."

  ;; pitch and music generator might be stored instead in music
  ;; properties, and it might make sense to create a music type of its
  ;; own for this kind of construct rather than using
  ;; RelativeOctaveMusic
  (define ((make-relative::to-relative-callback pitches p->m p->p) music pitch)
(let* ((chord (make-event-chord
   (map
(lambda (p)
  (make-music 'NoteEvent
  'pitch p))
pitches)))
   (pitchout (begin
   (ly:make-music-relative! chord pitch)
   (event-chord-pitches chord
  (set! (ly:music-property music 'element)
(apply p->m pitchout))
  (apply p->p pitchout)))
  `(make-music 'RelativeOctaveMusic
   'to-relative-callback
   (,make-relative::to-relative-callback
(list ,@pitches)
(lambda ,pitches ,music)
(lambda ,pitches ,last-pitch))
   'element ,music))


arpeggiate =
#(define-music-function (parser location d p1 p2 p3 p4)
   (ly:duration? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
   "Arpeggiate each of the 4 notes note with a duration of d."
   (make-relative (p1 p2 p3 p4) p1
#{
  $p1 $d ( $p2 $d $p3 $d $p4 $d )
  $p4 $d ( $p3 $d $p2 $d $p1 $d )
#}))

This is based on the assumption that you want the next relative pitch be
based on the _first_ note of the arpeggio.  If you want it based on the
last instead, write
   (make-relative (p1 p2 p3 p4) p4
in the respective line.

> So far I didn't find a way to make my arpeggio expansion work with
> notes in *relative pitch*. My bet is that I need to do some magic on
> "ly:pitch?" to get it to work, but I am clueless since I don't know
> what I should type as search keywords to get that information. Is
> there for example a relative-pitch-to-absolute-pitch checker routine
> that I could use?

Sorry for taking so long.  Designing a "user interface" and actually
coding this was not exactly trivial.  Note that arpeggiate will work
fine _both_ when using \relative and when not using it.

-- 
David Kastrup

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


Re: Expanding bowed arpeggios

2013-01-12 Thread shutterfreak
shutterfreak wrote
> On Sat, Nov 24, 2012 at 1:26 PM, Olivier Biot <

> olivier.biot@

> >wrote:
> 
> Dear all,
> 
> Following up on my own request, I stumbled upon an insightful article
> featuring Bach's prelude for piano (BWV 846):
> http://news.lilynet.net/?The-LilyPond-Report-23#feature_story_prelude_1_in_scheme
> 
> Based on this example I managed to create a first version, which however
> only works with *absolute* pitches (see measure 1).
> 
> How can I make it work with *relative* pitches (see measure 2)?
> 
> %%% BEGIN Snippet
> \version "2.16.1"
> 
> arpeggiate = #(define-music-function (parser location d p1 p2 p3 p4)
> (ly:duration? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
> "Arpeggiate each of the 4 notes note with a duration of
> d."
> #{
>   $p1 $d ( $p2 $d $p3 $d $p4 $d )
>   $p4 $d ( $p3 $d $p2 $d $p1 $d )
> #})
> 
> theMusic = {
>   \arpeggiate 8 g d' a' e''
>   \relative g {
> \arpeggiate 8 g d' a' e'
>   }
> }
> 
> \score {
>   \new StaffGroup <<
> \new Staff {
>   \relative g {
> 
> 
> 1 q
>   }
> }
> \new Staff {
>   \theMusic
> }
>   >>
>   \layout { }
>   \midi { }
> }
> %%% END Snippet

Dear all,

So far I didn't find a way to make my arpeggio expansion work with notes in
*relative pitch*. My bet is that I need to do some magic on "ly:pitch?" to
get it to work, but I am clueless since I don't know what I should type as
search keywords to get that information. Is there for example a
relative-pitch-to-absolute-pitch checker routine that I could use?

Could somebody with better knowledge of LilyPond / Guile help me in making
it work or pointing me in the right direction?

Any help is greatly appreciated!

Olivier



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Expanding-bowed-arpeggios-tp136789p139404.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Expanding bowed arpeggios

2013-01-02 Thread Olivier Biot
On Sat, Nov 24, 2012 at 1:26 PM, Olivier Biot wrote:

> Hi all,
>
> Sometimes arpeggios are written as chords to avoid repetitive and lengthy
> arpeggio expansions in a written score.
>
> However, is there a way in LilyPond to transform chords into bowed
> arpeggio expansions, as illustrated in the example below (first bar =
> input, 2nd bar = automatically generated expansion based on input)?
>

Dear all,

Following up on my own request, I stumbled upon an insightful article
featuring Bach's prelude for piano (BWV 846):
http://news.lilynet.net/?The-LilyPond-Report-23#feature_story_prelude_1_in_scheme

Based on this example I managed to create a first version, which however
only works with *absolute* pitches (see measure 1).

How can I make it work with *relative* pitches (see measure 2)?

%%% BEGIN Snippet
\version "2.16.1"

arpeggiate = #(define-music-function (parser location d p1 p2 p3 p4)
(ly:duration? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
"Arpeggiate each of the 4 notes note with a duration of d."
#{
  $p1 $d ( $p2 $d $p3 $d $p4 $d )
  $p4 $d ( $p3 $d $p2 $d $p1 $d )
#})

theMusic = {
  \arpeggiate 8 g d' a' e''
  \relative g {
\arpeggiate 8 g d' a' e'
  }
}

\score {
  \new StaffGroup <<
\new Staff {
  \relative g {
1 q
  }
}
\new Staff {
  \theMusic
}
  >>
  \layout { }
  \midi { }
}
%%% END Snippet

Best regards,

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


Expanding bowed arpeggios

2012-11-24 Thread Olivier Biot
Hi all,

Sometimes arpeggios are written as chords to avoid repetitive and lengthy
arpeggio expansions in a written score.

However, is there a way in LilyPond to transform chords into bowed arpeggio
expansions, as illustrated in the example below (first bar = input, 2nd bar
= automatically generated expansion based on input)?

% BEGIN
\version "2.16.1"

\score {
  \new Staff {
\relative c, {
  \key c \major
  \time 4/4
  \clef "bass"
  \set fingeringOrientations = #'(right)
  2-\p^\markup{input} 2 |
  c16-0-\p^\markup{output} ( g'-0 e'-1 c'-2 )  c ( e, g, c,)c ( g'
f'-2 d'-4 )  d ( f, g, c,)
}
  }
}
% END

Best regards,

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