Hi Karl,

>  Running lilypond tt.ly > tt.log 2>&1 with files tt.ly and tt.scm
>  I get tt.log.
> 
>  As seen in the log (display-scheme-music music) prints out
>  something which looks like a list, but taking car of music
>  gives my an error and appearently music isn't a list, or
>  any other type mentioned in r5rs and r6rs, it seems to be
>  something c++ related.
> 
>  So what is music ?
>  Where can I find routines for that kind of objects so I can
>  study them ?
>  And why does extending.pdf claim that it is a list:
> 
> 1.2.8 Internal music representation
> Internally, music is represented as a Scheme list.

Music is a so called prob (property object, I think). This is a C++-class that 
basically consists of 
two alists of properties: An immutable list of properties (such as the 'name) 
and a mutable list of 
properties. In this sense the notion that music is stored in scheme lists is 
correct, but they are 
encasuled in a c++-class with custom setters and getters (ly:music-property 
music 'prop) and 
(ly:music-set-property! ...).

If you want to interact with music objects best place to start would probably 
be to use

#(display-scheme-music #{ c d e #})

which will print a representation such as

(make-music
 'SequentialMusic
 'elements
 (list (make-music
        'NoteEvent
        'pitch
        (ly:make-pitch -1 0)
        'duration
        (ly:make-duration 2))
       (make-music
        'NoteEvent
        'pitch
        (ly:make-pitch -1 1)
        'duration
        (ly:make-duration 2))
       (make-music
        'NoteEvent
        'pitch
        (ly:make-pitch -1 2)
        'duration
        (ly:make-duration 2))))

which can also be used to construct this object via scheme. Here you see:

* A music object
  * name property: SequentialMusic
  * elements propery: List of
    * a music object
      * name property: NoteEvent
      * pitch property: (ly:make-pitch -1 0)
      * duration property: (ly:make-duration 2)
    ...

You can then access and set these properties with the ly:music-propery and 
ly:music-set-
propery! functions.

Cheers,
Tina

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to