Created
July 17, 2015 09:14
-
-
Save fiee/b657506c118d799300b3 to your computer and use it in GitHub Desktop.
global settings for my LilyPond templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\version "2.18.0" | |
%#(ly:set-option (quote no-point-and-click)) | |
#(ly:set-option 'midi-extension "mid") % default is "midi" | |
\header{ | |
title = "" | |
poet = "" | |
composer = "" | |
instrument = "" | |
source = "" | |
maintainer = "Henning Hraban Ramm" | |
lastupdated = "2014-09-05" | |
tagline = "" | |
copyright = "" | |
} | |
\paper { | |
%#(define fonts (make-pango-font-tree "TeX Gyre Schola" "LMSans10" "LMTypewriter10 Regular" (/ 20 20))) | |
% TeX Gyre Schola has no Cyrillic glyphs | |
#(define fonts (make-pango-font-tree "Century Schoolbook L" "LMSans10" "LMTypewriter10 Regular" (/ 20 20))) | |
indent = 0\mm | |
ragged-bottom = ##t | |
ragged-last-bottom = ##t | |
print-page-number = ##f | |
left-margin = 20\mm | |
line-width = 175\mm | |
top-margin = 10\mm | |
bookTitleMarkup = \markup { | |
\override #'(baseline-skip . 3.5) | |
\column { | |
\fill-line { \fromproperty #'header:dedication } | |
\override #'(baseline-skip . 3.5) | |
\column { | |
\huge \larger \bold | |
\fill-line { | |
\override #'(font-name . "Noteworthy Bold") % title font | |
\larger \fromproperty #'header:title | |
} | |
\fill-line { | |
\large \smaller \bold | |
\larger \fromproperty #'header:subtitle | |
} | |
\combine \null \vspace #0.33 | |
\fill-line { | |
\fromproperty #'header:poet | |
{ \large \bold \fromproperty #'header:instrument } | |
\fromproperty #'header:composer | |
} | |
\fill-line { | |
\fromproperty #'header:meter | |
\fromproperty #'header:arranger | |
} | |
} | |
} | |
} | |
} | |
#(define (addBrackets grob) | |
"Place brackets around a text object." | |
(let* ( | |
; Get current text | |
(currentText (ly:grob-property grob 'text)) | |
(bracketedText (markup "(" currentText ")"))) | |
; Store the bracketed text back | |
(ly:grob-set-property! grob 'text bracketedText) | |
) | |
; and print it | |
(ly:text-interface::print grob)) | |
% German Chord-Names using the german Note-Names (no sharp- or flat-Symbol), | |
% with the possibility of lowercase output. | |
% After -> http://lists.gnu.org/archive/html/lilypond-user/2009-09/msg00622.html | |
#(define (pitch-alteration-semitones pitch) | |
(inexact->exact (round (* (ly:pitch-alteration pitch) 2)))) | |
#(define (chord-name->my-german-markup-text-alteration pitch lowercase?) | |
(define (conditional-string-downcase str condition) | |
(if condition | |
(string-downcase str) | |
str)) | |
(let* ((name (ly:pitch-notename pitch)) | |
(alt-semitones (pitch-alteration-semitones pitch)) | |
(n-a (if (equal? (cons name alt-semitones) '(6 . -1)) | |
(cons 7 alt-semitones) | |
(cons name alt-semitones)))) | |
(make-line-markup | |
(list | |
(make-simple-markup | |
(conditional-string-downcase | |
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a)) | |
lowercase?)) | |
(let ((alteration (/ (cdr n-a) 2))) | |
(cond | |
((and (= alteration FLAT) (= (car n-a) 7)) | |
empty-markup) | |
((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) )) | |
(make-simple-markup "s")) | |
((= alteration FLAT) (make-simple-markup "es")) | |
((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2))) | |
(make-simple-markup "ses")) | |
((= alteration DOUBLE-FLAT) | |
(make-simple-markup "eses")) | |
((= alteration SHARP) | |
(make-simple-markup "is")) | |
((= alteration DOUBLE-SHARP) | |
(make-simple-markup "isis")) | |
(else empty-markup))))))) | |
%% Not really needed, a little shorter, though | |
#(define myGermanChords chord-name->my-german-markup-text-alteration) | |
#(define (note-name->myGerman-markup pitch lowercase?) | |
(let* ((name (ly:pitch-notename pitch)) | |
(alt-semitones (pitch-alteration-semitones pitch)) | |
(n-a (cond ((equal? (cons name alt-semitones) '(6 . -1)) | |
(cons 7 (+ 1 alt-semitones))) | |
((equal? (cons name alt-semitones) '(6 . -2)) | |
(cons 6 alt-semitones)) | |
(else (cons name alt-semitones))))) | |
(make-line-markup | |
(list | |
(string-append | |
(list-ref '("c" "d" "e" "f" "g" "a" "h" "b") (car n-a)) | |
(cond ((equal? (car n-a) 7) "") | |
((or (equal? (car n-a) 2) (equal? (car n-a) 5)) | |
(list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a)))) | |
(else (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a)))))))))) | |
onceDowncaseChordBass = \once \set chordNoteNamer = #note-name->myGerman-markup | |
% use \partialInline #1 #4 { c }, if you need a \partial anywhere else than in the first measure | |
partialInline = #(define-music-function (parser location dur mus) | |
(ly:duration? ly:music?) | |
#{ | |
\set Timing.measureLength = $(ly:duration-length dur) | |
$mus | |
\unset Timing.measureLength % Sure you need to unset?!? | |
#}) | |
midpartial = | |
#(define-music-function (parser location music) | |
(ly:music?) | |
#{ | |
\once\omit Score.BarNumber | |
\cadenzaOn | |
#music \bar "|" | |
\cadenzaOff | |
#}) | |
% Klezmer scale | |
freygish = #`((0 . ,NATURAL) (1 . ,FLAT) (2 . ,NATURAL) | |
(3 . ,NATURAL) (4 . ,NATURAL) (5 . ,FLAT) (6 . ,FLAT)) | |
textsegno = \markup \tiny { \musicglyph #"scripts.segno" } | |
% some shortcuts | |
% capital last letter is always "once" | |
% smN = small note size, nmN = normal note size | |
smN = \override NoteHead.font-size = #-3 | |
smn = \once \override NoteHead.font-size = #-3 | |
nmN = \override NoteHead.font-size = #0 | |
% opC = optional chord (in brackets) | |
opC = \once \override ChordNames.ChordName.stencil = #addBrackets | |
% cnh = cross note head (once) | |
cnh = \once \override NoteHead.style = #'cross | |
cnH = \cnh | |
% ccJ/N = chordChanges yes/no | |
ccJ = \set chordChanges = ##t | |
ccN = \set chordChanges = ##f | |
% chordmode functions | |
% e.g. \chordmode { c1\super "II" } | |
csuper = #(define-event-function (parser location arg) (markup?) | |
#{ ^\markup #arg #}) | |
csub = #(define-event-function (parser location arg) (markup?) | |
#{ _\markup #arg #}) | |
% rest that combines automatically in different voices | |
% see also http://lsr.dsi.unimi.it/LSR/Snippet?id=336 | |
rr = | |
#(define-music-function | |
(parser location dur) | |
(ly:duration?) | |
#{ \tweak direction #'CENTER r$dur #}) | |
noDynamics = \layout { \context { \Score \override DynamicText.stencil = ##f } } | |
\layout { | |
\context { \Score | |
\override BarNumber.break-visibility = #all-invisible | |
\override HeaderText.font-name = #"Noteworthy Bold" | |
} | |
\context { \Staff | |
\override TimeSignature.style = #'numbered | |
} | |
\context { \ChordNames | |
chordChanges = ##t | |
chordNameLowercaseMinor = ##t | |
chordRootNamer = #myGermanChords | |
majorSevenSymbol = \markup{ 7+ } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment