[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lilypond to Braille
From: |
Keith OHara |
Subject: |
Re: Lilypond to Braille |
Date: |
Fri, 15 Nov 2013 04:12:53 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Maurits Lamers <maurits <at> weidestraat.nl> writes:
> I might be wrong, but I don't think creating a separate Braille context
will work, as it would require the
> same music to be defined twice, one as normal music and one as Braille.
I do not know what you mean by 'defining' the music, but I suspect you
can get two types of output with only 'defining' the music once.
music = \chordmode {c2:dim ges2:m}
<<\new ChordNames \music
\new Staff \music >>
\new Staff \with { \consists Chord_name_engraver }
\transpose c aes, \music
In any case, I suggested the second output only for the use by
sighted programmers to help debug the output. You only really
need the text output.
> My main question here still is how this would work if both Braille and
normal notation would be generated. If
> the Braille engravers "override" the normal engravers, how would this
work exactly?
>
In LilyPond added engravers do not replace the existing engravers,
but act in parallel to them. Most engravers (and the midi performers)
are written in C++, but it is easier to make a quick example with
a Scheme engraver.
I do not program in Scheme, but was able to copy from the
"scheme-engraver" regression test
<http://lilypond.org/doc/v2.17/input/regression/0b/lily-86b85ffb.ly>
and the example "Defining an engraver in Scheme: ambitus engraver"
<http://www.lilypond.org/doc/v2.17/Documentation/snippets/>
to make demonstration tha prints nubmers on stdout based on the
pitches that go to the Staff
\version "2.16.2"
\new Staff \with {
\consists
#(make-engraver
(listeners
((note-event engraver event)
(let* ((pitch (ly:event-property event 'pitch))
(octave (ly:pitch-octave pitch))
(notename (ly:pitch-notename pitch))
(alteration (ly:pitch-alteration pitch))
(a (ly:engraver-make-grob engraver 'TextScript event))
(b (ly:engraver-make-grob engraver 'TextScript event)))
(format #t "~a: ~a (~a)" octave notename alteration) (newline)
(ly:grob-set-property! a 'font-size -4)
(ly:grob-set-property! b 'direction UP)
(ly:grob-set-property! b 'font-size -4)
(ly:grob-set-property! a 'text (format #f "~a" pitch))
(ly:grob-set-property! b 'text (format #f "~a:~a(~a)"
octave notename alteration))))))
} \transpose c ees \relative c' { c2 d( e f) g a( b c) }