[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lilypond to read xml piano sheet music and output it with a number a
From: |
David Kastrup |
Subject: |
Re: Lilypond to read xml piano sheet music and output it with a number added to each note relative to middle c |
Date: |
Mon, 31 Jul 2017 11:48:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Petri Moilanen <address@hidden> writes:
> Can Lilypond be used to import xml piano sheet music
XML import quality is so-so. Expect to hand-edit afterwards.
> and then run a snippet which will calculate a relative position for
> each note against middle c and output the same back as pdf having the
> number added below each note on the right and left staff ? The middle
> c would start from 1 and then b would be -1.
>
> I would like to automate the process so that I could run a command
> from the command line to process several xml files in a batch.
>
> If this cannot be done using a snippet, what other alternatives one
> could have ?
This is a basic engraver application:
\version "2.18.0"
scale-nos =
#(lambda (c)
(let ((notes '()))
(make-engraver
(listeners ((note-event this note)
(let ((p (ly:event-property note 'pitch)))
(if (ly:pitch? p)
(set! notes (cons (ly:pitch-steps p) notes))))))
((process-acknowledged this)
(if (pair? notes)
(let ((grob (ly:engraver-make-grob this 'TextScript '())))
(set! (ly:grob-property grob 'text)
#{ \markup \center-align \override #'(baseline-skip . 1.5)
\right-column
\finger #(map number->string (sort notes >)) #})
(set! (ly:grob-property grob 'parent-alignment-X) CENTER)
(set! notes '())))))))
\new Staff \with { \consists \scale-nos }
{
\partial 8 c'8 | <c' e' g>2. r8
c'8 | <c' e' g'> 2. r8
c'8 | <c'' e' g'>1 | \bar "|."
}
--
David Kastrup