Display lily music

Zur Navigation springen Zur Suche springen

Zu Testzwecken ist sehr nützlich, den Inhalt von Variablen als Scheme-Ausdrücke anzuzeigen.

#(display-lily-music mus)
#(display-music mus)
#(display-scheme-music mus)

alternativ

\displayLilyMusic mus
\void \displayLilyMusic mus
\displayMusic mus

Lilypond-Music anzeigen

Diese Funktion gibt den Musikausdruck in das Lilypond-Protokoll so aus, wie er in der Lilypond-Ausgabe erscheint.
#(display-lily-music mus)

Anwendung

\version "2.19.82"
\language "deutsch"

mus = { c' }

#(display-lily-music mus)

Ausgabe

Dieser Text erscheint im Lilypond-Protokoll.
{ c'4 }

Lilypond-Music als Scheme-Variable anzeigen

Diese Funktion gibt den Inhalt der Scheme-Variablen in das Lilypond-Protokoll aus.
#(display-scheme-music mus)

Anwendung

\version "2.19.82"
\language "deutsch"

mus = { c' }

#(display-scheme-music mus)

Ausgabe

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

Liste der definierten Scheme-Variablen ausgeben

Dies ist ein Hilfprogramm, das alle bisher definierten Variablen in das Log schreibt.

Genauer gesagt, alle Variablen, die zwischen der Codezeile

#(define current-module-bindings (ly:module->alist (current-module)))
und dem Aufruf des Codes, der mit #(let beginnt, liegen.

Scheme-Code

#(define current-module-bindings (ly:module->alist (current-module)))
%% alle Variablen, die ab hier bis zum Aufruf des Programms definiert werden, werden ausgegeben
#(let ((bindings
        (assoc-remove!
         (lset-difference
          equal?
          (ly:module->alist (current-module))
          current-module-bindings)
         'current-module-bindings)))
   (pretty-print
    (sort
     (map car bindings) symbol<?)))

Anwendung

#(define current-module-bindings (ly:module->alist (current-module)))
A = 1
BB = "zwei"
CCC = { c d e f g }
DDDD = "auskommentiert"
#(let ((bindings
        (assoc-remove!
         (lset-difference
          equal?
          (ly:module->alist (current-module))
          current-module-bindings)
         'current-module-bindings)))
   (pretty-print
    (sort
     (map car bindings) symbol<?)))

Ausgabe

(A BB CCC DDDD)

Variableninhalt C++

Diese Ausgabe zeigt den Inhalt der C++-Variablen. Mir erscheint diese Methode als am eher wenigsten verwendbar.

Anwendung

\version "2.19.82"
\language "deutsch"

mus = { c' }

#(display-music mus)

Ausgabe

#<Prob: Music C++: Music((origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:7>) (elements #<Prob: Music C++: Music((pitch . #<Pitch c' >) (duration . #<Duration 4 >) (origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:9>))((display-methods #<procedure #f (note)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types event note-event rhythmic-event melodic-event)) >
))((display-methods #<procedure #f (expr)> #<procedure #f (seq)>) (name . SequentialMusic) (length-callback . #<primitive-procedure ly:music-sequence::cumulative-length-callback>) (start-callback . #<primitive-procedure ly:music-sequence::first-start-callback>) (elements-callback . #<procedure #f (m)>) (iterator-ctor . #<primitive-procedure ly:sequential-iterator::constructor>) (types sequential-music)) >
: { ((origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:7>) (elements #<Prob: Music C++: Music((pitch . #<Pitch c' >) (duration . #<Duration 4 >) (origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:9>))((display-methods #<procedure #f (note)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types event note-event rhythmic-event melodic-event)) >
))
Elements: {
#<Prob: Music C++: Music((pitch . #<Pitch c' >) (duration . #<Duration 4 >) (origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:9>))((display-methods #<procedure #f (note)>) (name . NoteEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types event note-event rhythmic-event melodic-event)) >
: { ((pitch . #<Pitch c' >) (duration . #<Duration 4 >) (origin . #<location /home/user/Dokumente/Lilypond/Theorie/displays.ly:4:9>)) }
}
 }

Links