[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Jianpu music notation question
From: |
Menu Jacques |
Subject: |
Re: Jianpu music notation question |
Date: |
Mon, 21 Aug 2017 20:40:28 +0200 |
Hello,
I gave a try at a simple Scheme function named jianpu, and the two scores
produced by the example below are identical, at least as far as I can see.
What should be done for this approach to work with more complex music than a
mere sequence of notes?
Thanks if you can help!
JM
%%%%%%%%%%%%%%%%%%
\version "2.12.2"
#(set-global-staff-size 20)
\header{
title = "晴雯歌(二胡I)"
% un-comment the next line to remove Lilypond tagline:
%tagline=""
}
\paper {
}
jianpuGlobal = {
\override Staff.TimeSignature #'style = #'numbered
\override Staff.Stem #'transparent = ##t
\override Stem #'direction = #DOWN
\override Stem #'length-fraction = #0.5
\override Beam #'beam-thickness = #0.1
\override Beam #'length-fraction = #0.5
\override Voice.Rest #'style = #'neomensural % this size tends to line up
better (we'll override the appearance)
\override Accidental #'font-size = #-4
\override TupletBracket #'bracket-visibility = ##t
\tupletUp
\override Tie #'transparent = ##t
% \override Tie #'staff-position = #0
% \set stemLeftBeamCount = #0
% \set stemRightBeamCount = #0
}
jianpu =
#(define-music-function
(note)
(ly:music?)
#{
% \tweak NoteHead.stencil #ly:text-interface::print
% \tweak NoteHead.text
% \markup \musicglyph #"custodes.mensural.u0"
% \markup {\bold \raise #-0.75 \musicglyph #"nine"}
\override NoteHead.stencil =
#(lambda (grob)
(let* (
(pitch (ly:event-property (ly:grob-property grob 'cause) 'pitch))
(notename (ly:pitch-notename pitch))
;; (noteoctave (ly:pitch-octave pitch))
;; (notealteration (ly:pitch-alteration pitch))
)
(case notename
;; 0 is C, which is 1 in jianpu, and a rest is 0 in jianpu
((0) (grob-interpret-markup grob (make-bold-markup "1")))
((1) (grob-interpret-markup grob (make-bold-markup "2")))
((2) (grob-interpret-markup grob (make-bold-markup "3")))
((3) (grob-interpret-markup grob (make-bold-markup "4")))
((4) (grob-interpret-markup grob (make-bold-markup "5")))
((5) (grob-interpret-markup grob (make-bold-markup "6")))
((6) (grob-interpret-markup grob (make-bold-markup "7")))
((7) (grob-interpret-markup grob (make-bold-markup "0")))
(else (grob-interpret-markup grob (make-bold-markup "?")))
)
)
)
\tweak Stem.stencil ##f
#note
#})
\markup{"With \jianpu:"}
music = {c''4. d''4 r4}
\score {
<<
\override Score.BarNumber #'break-visibility = #end-of-line-invisible
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
\new RhythmicStaff \with {
\remove Staff_symbol_engraver
\consists "Accidental_engraver"
}
{
\jianpuGlobal
\new Voice="jianpu" {
\time 6/4
\key f \major
\mark \markup {
\column {
{"M=6/4"}
{"1=F"}
{" "}
}
}
\jianpu \music
\bar "|."
}
}
>>
\layout {}
}
\markup{"With \applyOutput:"}
#(define (note-one grob grob-origin context)
(if (grob::has-interface grob 'note-head-interface)
(begin
(ly:grob-set-property! grob 'stencil
(grob-interpret-markup grob
(make-lower-markup 0.5 (make-bold-markup "1")))))))
#(define (note-two grob grob-origin context)
(if (grob::has-interface grob 'note-head-interface)
(begin
(ly:grob-set-property! grob 'stencil
(grob-interpret-markup grob
(make-lower-markup 0.5 (make-bold-markup "2")))))))
\score {
<<
\override Score.BarNumber #'break-visibility = #end-of-line-invisible
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
\new RhythmicStaff \with {
\remove Staff_symbol_engraver
\consists "Accidental_engraver"
}
{
\jianpuGlobal
\new Voice="jianpu" {
\time 6/4
\key f \major
\mark \markup {
\column {
{"M=6/4"}
{"1=F"}
{" "}
}
}
\applyOutput #'Voice #note-one
\displayMusic c''4.
\applyOutput #'Voice #note-two
\displayMusic d''4
\displayMusic r4
\bar "|."
}
}
>>
\layout {}
}
%%%%%%%%%%%%%%%%%%