lilypond-user
[Top][All Lists]
Advanced

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

Re: how to create a new staff using scheme?


From: Nicolas Sceaux
Subject: Re: how to create a new staff using scheme?
Date: Tue, 29 Mar 2005 22:49:58 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

address@hidden (Pedro Kröger) writes:

> Ferenc Wagner <address@hidden> writes:
>> let his webpage speak for him:
>> http://nicolas.sceaux.free.fr/schemingly/scheme-hacks.html
>
> thanks for the link. as good as schemingly is, I don't think it is the
> library nicolas was refering to in the email.
>
> address@hidden (Pedro Kröger) writes:
>>> BTW, where are this mus:new, mus:set, and friends defined? it's the kind
>>> of thing grep that doen't help :-(
>
> duh! they are not defined in lilypond. they are things that probably
> nicolas defined in his library. I know because here
> http://lists.gnu.org/archive/html/lilypond-user/2004-07/msg00109.html he
> showed how to define mus:set
>
> Pedro

Sorry for not answering sooner...

the things that were shown in the link above are old stuff that should
be thrown away (...which I just did).

IHMO, there's two possible paths when one wants to generate music
expressions (at least, that's what I'm doing in my own scores):

1) define a function that uses #{ #}.

2) when this is not enough (sometimes, it is not), using raw scheme to
build the music expressions.

 - the first thing to do is to build the pattern that you want to
  generate, using LilyPond syntax, eg: 

    \new Staff { c }

 - then, to print it (typically in a scheme REPL) using a pretty
   printer (more on that latter):

    guile> (mus:display #{ \new Staff \notemode { c } #})
(make-music 'SequentialMusic
  'elements (list
             (make-music 'ContextSpeccedMusic
               'context-id "$uniqueContextId"
               'property-operations (list)
               'context-type 'Staff
               'element (make-music 'SequentialMusic
                            'elements (list
                                       (make-music 'EventChord
                                         'elements (list
                                                    (make-music 'NoteEvent
                                                      'duration 
(ly:make-duration 2 0 1 1)
                                                      'pitch (ly:make-pitch -1 
0 0)))))))))
    guile> 

 - put that into the body of a function, and put parameters where
   appropriate.


This week end, I'll clean and fix some bugs in this pretty printer,
and upload it in CVS (maybe replacing `music-display'?).

I'll also post here a commented version of Bach first prelude from Das
Wohltemperierte Clavier, which I wrote several months ago, and which
makes use of scheme tricks in order to generate itself. The final
score looks like:

\prelude {
                c'   e'  g' c'' e''
                c'   d'  a' d'' f''
                b    d'  g' d'' f''
                c'   e'  g' c'' e''
                c'   e'  a' e'' a''
                c'   d'  fis' a' d''
                b    d'  g' d'' g''
                b    c'  e' g' c''
                a    c'  e' g' c''
                d    a   d' fis' c''
                g    b   d' g' b'   
 ...

nicolas




reply via email to

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