[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looking for script to color noteheads on handbell music
From: |
Stephen Corey |
Subject: |
Re: looking for script to color noteheads on handbell music |
Date: |
Sat, 12 Sep 2009 18:58:36 +0000 (UTC) |
User-agent: |
Pan/0.132 (Waxed in Black) |
This is the type of thing I was looking for. Thank you very much for the
quick response and handy tips. I'm including my template for anyone else
who may be looking for something similar at a later time. It isn't
totally refined for handbells but is a good starting point.
\version "2.12.1"
%Association list of pitches to colors, C4 - C7
%Excludes Cb, Fb, E#, B# and double accidentals
#(define color-mapping
(list
(cons (ly:make-pitch -1 0 0) (x11-color 'black)) ; C4
(cons (ly:make-pitch -1 0 1/2) (x11-color 'black)) ; C#4
(cons (ly:make-pitch -1 1 -1/2) (x11-color 'black)) ; (D flat)
(cons (ly:make-pitch -1 1 0) (x11-color 'black)) ; D4
(cons (ly:make-pitch -1 1 1/2) (x11-color 'black)) ; D#4
(cons (ly:make-pitch -1 2 -1/2) (x11-color 'black)) ; (E flat)
(cons (ly:make-pitch -1 2 0) (x11-color 'black)) ; E4
(cons (ly:make-pitch -1 3 0) (x11-color 'black)) ; F4
(cons (ly:make-pitch -1 3 1/2) (x11-color 'black)) ; F#4
(cons (ly:make-pitch -1 4 -1/2) (x11-color 'black)) ; (G flat)
(cons (ly:make-pitch -1 4 0) (x11-color 'black)) ; G4
(cons (ly:make-pitch -1 4 1/2) (x11-color 'black)) ; G#4
(cons (ly:make-pitch -1 5 -1/2) (x11-color 'black)) ; (A flat)
(cons (ly:make-pitch -1 5 0) (x11-color 'black)) ; A4
(cons (ly:make-pitch -1 5 1/2) (x11-color 'black)) ; A#4
(cons (ly:make-pitch -1 6 -1/2) (x11-color 'black)) ; (B flat)
(cons (ly:make-pitch -1 6 0) (x11-color 'black)) ; B4
(cons (ly:make-pitch 0 0 0) (x11-color 'black)) ; C5
(cons (ly:make-pitch 0 0 1/2) (x11-color 'black)) ; C#5
(cons (ly:make-pitch 0 1 -1/2) (x11-color 'black)) ; (D flat)
(cons (ly:make-pitch 0 1 0) (x11-color 'black)) ; D5
(cons (ly:make-pitch 0 1 1/2) (x11-color 'black)) ; D#5
(cons (ly:make-pitch 0 2 -1/2) (x11-color 'black)) ; (E flat)
(cons (ly:make-pitch 0 2 0) (x11-color 'black)) ; E5
(cons (ly:make-pitch 0 3 0) (x11-color 'black)) ; F5
(cons (ly:make-pitch 0 3 1/2) (x11-color 'black)) ; F#5
(cons (ly:make-pitch 0 4 -1/2) (x11-color 'black)) ; (G flat)
(cons (ly:make-pitch 0 4 0) (x11-color 'black)) ; G5
(cons (ly:make-pitch 0 4 1/2) (x11-color 'black)) ; G#5
(cons (ly:make-pitch 0 5 -1/2) (x11-color 'black)) ; (A flat)
(cons (ly:make-pitch 0 5 0) (x11-color 'black)) ; A5
(cons (ly:make-pitch 0 5 1/2) (x11-color 'black)) ; A#5
(cons (ly:make-pitch 0 6 -1/2) (x11-color 'black)) ; (B flat)
(cons (ly:make-pitch 0 6 0) (x11-color 'black)) ; B5
(cons (ly:make-pitch 1 0 0) (x11-color 'black)) ; C6
(cons (ly:make-pitch 1 0 1/2) (x11-color 'black)) ; C#6
(cons (ly:make-pitch 1 1 -1/2) (x11-color 'black)) ; (D flat)
(cons (ly:make-pitch 1 1 0) (x11-color 'black)) ; D6
(cons (ly:make-pitch 1 1 1/2) (x11-color 'black)) ; D#6
(cons (ly:make-pitch 1 2 -1/2) (x11-color 'black)) ; (E flat)
(cons (ly:make-pitch 1 2 0) (x11-color 'black)) ; E6
(cons (ly:make-pitch 1 3 0) (x11-color 'black)) ; F6
(cons (ly:make-pitch 1 3 1/2) (x11-color 'black)) ; F#6
(cons (ly:make-pitch 1 4 -1/2) (x11-color 'black)) ; (G flat)
(cons (ly:make-pitch 1 4 0) (x11-color 'black)) ; G6
(cons (ly:make-pitch 1 4 1/2) (x11-color 'black)) ; G#6
(cons (ly:make-pitch 1 5 -1/2) (x11-color 'black)) ; (A flat)
(cons (ly:make-pitch 1 5 0) (x11-color 'black)) ; A6
(cons (ly:make-pitch 1 5 1/2) (x11-color 'black)) ; A#6
(cons (ly:make-pitch 1 6 -1/2) (x11-color 'black)) ; (B flat)
(cons (ly:make-pitch 1 6 0) (x11-color 'black)) ; B6
(cons (ly:make-pitch 2 0 0) (x11-color 'black)) ; C7
))
%Compare pitch and alteration and octave
#(define (pitch-equals? p1 p2)
(and
(= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
(= (ly:pitch-notename p1) (ly:pitch-notename p2))
(= (ly:pitch-octave p1) (ly:pitch-octave p2))))
#(define (pitch-to-color pitch)
(let ((color (assoc pitch color-mapping pitch-equals?)))
(if color
(cdr color))))
#(define (color-notehead grob)
(pitch-to-color
(ly:event-property (event-cause grob) 'pitch)))
#(set-global-staff-size 26)
\header {
title = "Handbell Color Template"
subtitle = ""
composer = ""
arranger = ""
}
upper = \relative c' {
\override NoteHead #'color = #color-notehead
\override Staff.TimeSignature #'style = #'()
\clef treble
\key c \major
\time 4/4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This forces bar numbers on every measure %
\override Score.BarNumber
#'break-visibility = #end-of-line-invisible
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
r1 r2 r4 d8 dis e f fis g gis a ais b c cis d dis e f fis g
gis a ais b c b bes a aes g ges f e ees d des c b bes a aes g ges
f e ees d des r2 r1 r
\bar "|."
}
lower = \relative c {
\override NoteHead #'color = #color-notehead
\override Staff.TimeSignature #'style = #'()
\clef bass
\key c \major
\time 4/4
c8 cis d dis e f fis g gis a ais b c cis r4 r1 r r r r r2
c8 b bes a aes g ges f e ees d des c1
}
\score {
\new PianoStaff <<
\new Staff = "upper" \upper
\new Staff = "lower" \lower
>>
\layout {
indent = 0.0 \cm
}
\midi {
\context {
\Score
tempoWholesPerMinute = #(ly:make-moment 100 4)
}
}
}