;-*-Mode:lisp,comment-column:60-*- ;; lp-skeletons.el --- ;; Copyright (C) 2007 Shelagh Manton ;; Author: Shelagh Manton ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 2 ;; of the License, or (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ;; 02111-1307, USA. ;; This is intended to be a library of skeletons for use with ;; LilyPond-mode. I have included abbrevs to make it easy to use. ;; Put the following lines in your .emacs (add-hook ;; 'Lilypond-mode-hook (lambda () (abbrevs-mode 1))) if you want to ;; use abbrevs and the following to load the file in lilypond-mode. ;; (add-hook 'Lilypond-mode-hook (lambda () (load-library ;; "/path/to/your/lp-skeletons.el"))) ;; This works but maybe there is some more elegant way of doing it. ; gtg (define-skeleton lp-book-skeleton "Insert a skeleton for lilybook. Only makes sense in an empty buffer." nil "\\documentclass["(skeleton-read "Papersize?: " )"]{article}" \n "\\begin{document}" \n > _ \n > "\\end{document}\n" ) ;;Usefull for easy insertion of snippets in a lilybook. ;gtg (define-skeleton lp-snippet "Inserts a music snippet in Lilybook" nil "\\begin{lilypond}\n" \n > "\\relative c'' {" \n > _ \n > "}" \n > "\\end{lilypond}" \n ) ;; this works well,.eg Creative commons and Personal ;; copyright. I looked at the (copyright) function and it won't work ;; here as it is itself a skeleton. ;gtg (define-skeleton lp-header "Interactively inserts header for Lilypond file. You need to decide where it goes as you can put a header block the last thing in a \score block, or by itself in the .ly file. There are some basic defaults if you don't know what to put, and if you don't want a section just RET. Lilypond markup is acceptable in these strings. There is an opportuntity to define your own personalised header. See lp-myheader." nil "\\header {" \n > "title = \""(skeleton-read "Title is: ") "\" " \n > "composer = \""(skeleton-read "Composer is: ")\| (user-full-name) "\" " \n > "copyright = \""(skeleton-read "Copyright: ") \| "Public Domain\" " \n > ( "Optional, Maintainer is: " "maintainer = \"" str "\" " \n) resume: > ( "Optional, Words by: " "poet = \"" str "\" " \n) ;;subprompt resume: > ( "Optional, Subtitle is: " "subtitle = \"" str "\" " \n);;subprompt resume: > ( "Optional, Arranger is: " "arranger = \"" str "\" " \n) ;;subprompt resume: > ( "Optional, Tempo is: " "meter = \"" str "\" "\n ) resume: > ( "Optional, Instrument?: " "instrument = \"" str "\" "\n) resume: > ( "Optional, Dedicated to: " "dedication = \"" str "\" "\n) resume: > ( "Optional, And at the bottom of the last page?: " "tagline = \"" str " "(format-time-string "%d %b %Y")"\"")\n resume: > "}" \n ) ;; (define-skeleton lp-myheader ;; "Interactively inserts personal header for Lilypond files. ;; You need to change this to make it useful for you. Of course you may delete ;; lines which are not applicable to your case." ;; " " ;; "\\header" \n ;; > "{" \n ;; > "title = \"" (skeleton-read "Title is: ") "\" " \n ; leave this line. ;; > "composer = \"" (user-full-name) "\" " \n ;; > "copyright = \"" YOUR DEFAULT COPYRIGHT CLAUSE \" " \n ;; > "poet = \"" YOUR POET'S NAME "\" " \n ; no words? get rid of this line. ;; > ( "Subtitle is: " "subtitle = \"" str "\" " \n); sometimes we might want a subtitle ;; resume: ;; > "arranger = \"" YOUR ARRANGER'S NAME "\" " \n ;; > ( "Optional, Tempo is: " "meter = \"" str "\" "\n ) ;; resume: ;; > "tagline = \""WHAT YOU WANT ON THE BOTTOM OF THE LAST PAGE "(format-time-string "%d %b %Y") \" " \n ;; > "}" \n ;; ) ;gtg (define-skeleton lp-block-comment ;maybe this should be a key binding? "Put a section of Lilypond code into a commented block. Will enclose the region into a block comment. Useful for debugging." nil "%{" \n > _ \n > "%}" \n ) ;gtg (define-skeleton lp-global "A simple global variable" nil "global = {"\n > "\\key "(skeleton-read "Key: ")" "(skeleton-read "\\major or \\minor: ") \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ") \n > ("Sometimes we want to define clef: " "\\clef " str )\n resume: > "}" \n ) ;gtg (define-skeleton lp-global-min "An even simpler global variable" nil "global = {"\n > "\\key "(skeleton-read "Key: ")" "(skeleton-read "\\major or \\minor: ") \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ") \n > "}" \n ) ;gtg ;;transpose skeleton. where the key to transpose from and to are asked ;;for. I left out the braces as sometimes variables are used. (define-skeleton lp-transpose-region "Insert region into a transpose asking for key from and to." nil "\\transpose "(skeleton-read "From: ")" "(skeleton-read "To: ")" " _ ) ;gtg ;;Define your own variables. Might be useful for beginners? (define-skeleton lp-variable "Define a variable for lilypond" nil (skeleton-read "Name of variable: ") " = {"\n > _ \n >"}" \n ) ;; I'd like to do a lp-copyright function based on (copyright) but ;; without the interaction. I would also like to colour the INSERT ;; NOTES and LYRICS in the .ly file so that they stand out ;; clearly. tried using the following in my .emacs file (add-hook ;; 'LilyPond-mode-hook (lambda () (font-lock-add-keywords nil ;; '(("FIXME" . font-lock-warning-face ))))) '(("\\<\\(INSERT ;; NOTES\\|CHORDS\\|LYRICS\\|ANY MORE\\)" 1 font-lock-warning-face ;; prepend))))) But this didn't work. Any suggestions? ;gtg ;;vocal ensemble (define-skeleton lp-vocal-ensemble "Insert form for vocal ensemble and place point at first insertion point" nil "\\version \"2.11.23\" " \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n " global = {" \n > "\\key "(skeleton-read "Key: ")" "(skeleton-read "\\major or \\minor: ") \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ") \n > "}" \n "sopMusic = \\relative c'' {" \n > _ \n > "}" \n "sopWords = \\lyricmode {" \n > "LYRICS"\n >"}" \n \n "altoMusic = \\relative c' {"\n > "INSERT NOTES" \n > "}"\n \n "altoWords =\\lyricmode {"\n > "LYRICS"\n > "}"\n \n "tenorMusic = \\relative c' {"\n > "INSERT NOTES"\n >"}"\n \n "tenorWords = \\lyricmode {"\n > "LYRICS"\n > "}"\n \n "bassMusic = \\relative c {"\n > "INSERT NOTES"\n >"}"\n \n "bassWords = \\lyricmode {"\n > "LYRICS"\n > "}"\n \n "\score {"\n > "\\new ChoirStaff << " \n \n > "\\new Lyrics = sopranos { s1 }" \n > "\\new Staff = women <<" \n > "\\new Voice =" \n > " \"sopranos\" { \\voiceOne << \\global \\sopMusic >> }" \n > "\\new Voice =" \n > " \"altos\" { \\voiceTwo << \\global \\altoMusic >> }" \n > ">>" \n > "\\new Lyrics = \"altos\" { s1 }" \n > "\\new Lyrics = \"tenors\" { s1 }" \n > "\\new Staff = men <<" \n > "\\clef bass" \n > "\\new Voice =" \n > " \"tenors\" { \\voiceOne <<\\global \\tenorMusic >> }" \n > "\\new Voice =" \n > "\"basses\" { \\voiceTwo <<\\global \\bassMusic >> }" \n > ">>" \n > "\\new Lyrics = basses { s1 }" \n \n > "\\context Lyrics = sopranos \\lyricsto sopranos \\sopWords" \n > "\\context Lyrics = altos \\lyricsto altos \\altoWords" \n > "\\context Lyrics = tenors \\lyricsto tenors \\tenorWords" \n > "\\context Lyrics = basses \\lyricsto basses \\bassWords" \n > ">>" \n \n > "\\layout {" \n > "\\context {" \n > " % a little smaller so lyrics" \n > " % can be closer to the staff" \n > "\\Staff" \n > "\\override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)" \n > "}" \n > "}" \n > "}" \n ) ;;;String quartets (define-skeleton lp-string-quartet "Insert a skeleton for a string quartet" nil > "\\version \"2.11.23\"" \n ;here a (lp-version) "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {" \n > "\\key "(skeleton-read "Key: ")" "(skeleton-read "\\major or \\minor: ") \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ") \n > "}" \n "violinOne = \\new Voice { \\relative c''{" \n > "\\set Staff.instrumentName = \"Violin 1\"" \n > _ \n > "\\bar \"|.\" }}" \n \n > " violinTwo = \\new Voice { \\relative c''{" \n > "\\set Staff.instrumentName = \"Violin 2\"" \n > "INSERT NOTES" \n > "\\bar \"|.\" }}" \n \n "viola = \\new Voice { \\relative c' {" \n > "\\set Staff.instrumentName = \"Viola\"" \n > "\\clef alto" \n > "INSERT NOTES" \n > "\\bar \"|.\" }}" \n \n > "cello = \\new Voice { \\relative c' {" \n > "\\set Staff.instrumentName = \"Cello\"" \n > "\\clef bass" \n > "INSERT NOTES" \n > "\\bar \"|.\"}}" \n \n "\\score {" \n > "\\new StaffGroup <<" \n > "\\new Staff << \\global \\violinOne >>" \n > "\\new Staff << \\global \\violinTwo >>" \n > "\\new Staff << \\global \\viola >>" \n > "\\new Staff << \\global \\cello >>" \n > " >>" \n \n > "\\layout { }" \n > "\\midi { }" \n > "}" \n ) ;; D.3.2 String quartet parts ;; The previous example produces a nice string quartet, but what if ;; you needed to print parts? This template demonstrates how to use ;; the \tag feature to easily split a piece into individual parts. ;; You need to split this template into separate files, the filenames are ;; contained in comments at the beginning of each file. piece.ly ;; contains all the music definitions. The other files – score.ly, ;; vn1.ly, vn2.ly, vla.ly, and vlc.ly – produce the appropiate part. ;; This skeleton could be made more useful if it actually opened the ;; subfiles in separate buffers with the appropriate skeleton already ;; inserted. Can you call skeletons within functions? Another thing to ;; find out. Tried a function to open a buffer based on the name of ;; the current buffer having some difficulties. Studying some ;; functions from files.el and simple.el (define-skeleton lp-string-quartet-parts "Insert the master skeleton" nil '(setq v1 (buffer-name)) > "%%%%% " v1 \n > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {" \n > "\\key "(skeleton-read "Key: ")" "(skeleton-read "\\major or \\minor: ") \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ") \n > "}" \n > \n > "Violinone = \\new Voice { \\relative c''{" \n > "\\set Staff.instrumentName = \"Violin 1\"" \n > _ \n > "\\bar \"|.\" }} %*********************************" \n \n > "Violintwo = \\new Voice { \\relative c''{" \n > "\\set Staff.instrumentName = \"Violin 2\"" \n > "INSERT NOTES" \n > "\\bar \"|.\" }} %*********************************" \n \n > "Viola = \\new Voice { \\relative c' {" \n > "\\set Staff.instrumentName = \"Viola\"" \n > "\\clef alto" \n > "INSERT NOTES" \n > "\\bar \"|.\" }} %*********************************" \n \n > "Cello = \\new Voice { \\relative c' {" \n > "\\set Staff.instrumentName = \"Cello\"" \n > "\\clef bass" \n > "INSERT NOTES" \n > "\\bar \"|.\"}} %**********************************" \n \n > "music = {" \n > "<<" \n > "\\tag #'score \\tag #'vn1 \\new Staff { << \\global \\Violinone >> }" \n > "\\tag #'score \\tag #'vn2 \\new Staff { << \\global \\Violintwo>> }" \n > "\\tag #'score \\tag #'vla \\new Staff { << \\global \\Viola>> }" \n > "\\tag #'score \\tag #'vlc \\new Staff { << \\global \\Cello>> }" \n > ">>" \n > "}" \n \n > "% You can call M-x lp-sub-buffer in new buffer and get the related parts files." \n > "% And call M-x lp-score-buffer in new buffer and get the related score.ly file." \n ) ;; I've just realised I won't be able to work this one out how I ;; wanted to. There are too many cyclical dependancies. This file ;; needs to know the names of files which don't exist yet. Or perhaps ;; if there is a wrapper function, it might know the names of all the ;; files before they are created and therefore these variables will be ;; possible. My head's spinning ;gtg ;; need to work out how to include this in the parts collection of skeletons (define-skeleton lp-score-buffer "Inserts a skeleton for the score.ly file for doing parts." "What is the master file? " > "%%%%% score.ly" \n > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "\\include \"" str "\"" \n > "#(set-global-staff-size 14)" \n \n > "\\score {" \n > "\\new StaffGroup \keepWithTag #'score \music" \n > "\\layout {" _ "}" \n > "\\midi { }" \n > "}" \n ) ;; good to go pity it's not as useful as I thought it would be. ;; Maybe it could be useful as a general function where people want to ;; extract parts. ;gtg (define-skeleton lp-sub-buffer "Insert a buffer with skeleton to another related buffer" "What is your master file name? " '(setq v1 (buffer-name)) > "%%%%% " v1 \n > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "\\include \"" str "\"" \n \n > "\\score {" \n '(setq v2 (substring v1 0 -3)) > "\\keepWithTag #'" v2 " \\music" \n > "\\layout {" _ " }" \n > "}" \n ) ;;;Solo piano - good to go (define-skeleton lp-solo-piano "Insert a simple piano staff." nil "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {" \n > "\\key "(skeleton-read "Key: ")\| "c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > "}" > "upper = \\relative c'' {" \n "\\global" \n > _ \n > "}" \n \n > " lower = \\relative c {" \n "\\global"\n > "INSERT NOTES" \n > " }" \n \n "\\score {" \n > "\\new PianoStaff <<" \n > "\\set PianoStaff.instrumentName = \"Piano\"" \n > "\\new Staff = \"upper\" \\upper" \n > "\\new Staff = \"lower\" \\lower" \n > ">>" \n > "\\layout { }" \n > "\\midi { }" \n > "}" \n ) ;;;Piano and melody with lyrics ;;Here is a typical song format: one staff with the melody and lyrics, ;;with piano accompaniment underneath. (define-skeleton lp-piano-melody-lyrics ;lppml "Insert skeleton for melody with piano accompaniment." nil "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {"\n > "\\key "(skeleton-read "Key: ")\| "c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > "}" \n "melody = \\relative c'' {" \n > "\\clef \"treble\""\n > _ \n > "}" \n \n "text = \\lyricmode {" \n > "LYRICS" \n > "}" \n \n "upper = \\relative c'' {" \n > "\\clef \"treble\""\n > "INSERT NOTES" \n > "}" \n \n "lower = \\relative c {" \n > "\\clef \"bass\""\n > "INSERT NOTES" \n > "}" \n \n "\\score {" \n > "\\global" \n > "<<" \n > "\\new Voice = \"mel\" {" \n > "\\autoBeamOff" \n > "\\melody" \n > "}" \n \n > "\\new Lyrics \\lyricsto mel \\text" \n > "\\new PianoStaff <<" \n > "\\new Staff = \"upper\" \\upper" \n > "\\new Staff = \"lower\" \\lower" \n > ">>" \n > ">>" \n \n "\\layout {" \n > "\\context { \\RemoveEmptyStaffContext }" \n > "}" \n \n > "\\midi { }" \n > "}" \n ) ;;;Piano centered lyrics ;gtg ;; Instead of having a full staff for the melody and lyrics, you ;; can place the lyrics between the piano staff (and omit the separate melody staff). (define-skeleton lp-piano-centered-lyrics "Insert a skeleton for piano with centered lyrics" nil "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {" \n > "\\key "(skeleton-read "Key: ")\| "c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > "}" \n \n "upper = \\relative c'' {" \n > "\\global" \n > _ \n > "}" \n \n "lower = \\relative c {" \n > " \\global" \n > "INSERT NOTES" \n > "}" \n \n > "text = \\lyricmode {" \n > "LYRICS" \n > "}" \n \n "\\score {" \n > "\\new GrandStaff <<" \n > "\\new Staff = upper { \\new Voice = \"singer\" \\upper }" \n > "\\new Lyrics \\lyricsto \"singer\" \\text" \n > "\\new Staff = lower {" \n > "\\clef bass" \n > "\\lower" \n > "}" \n > ">>" \n \n "\\layout {" \n > "\\context { \\GrandStaff \\accepts \"Lyrics\" }" \n > "\\context { \\Lyrics \\consists \"Bar_engraver\" }" \n > "}" \n \n > " \\midi { }" \n > "}" \n ) ;;;Piano centered dynamics ;gtg (define-skeleton lp-piano-centered-dynamics "Insert skeleton of piano staff with centered dynamics" "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "global = {" \n > "\\key "(skeleton-read "Key: ")\|"c "(skeleton-read "\\major, \\minor or \\dorian etc: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > "}" \n "upper = \\relative c'' {" \n > "\\clef treble" \n > "\\global" \n > _ \n > "}" \n \n "lower = \\relative c {" \n > "\\clef bass" \n > "\\global" \n > "INSERT NOTES" \n > "}" \n \n "dynamics = {" \n > "DYNAMICS % for example s2\\fff\\> s4 s\\!\\pp" \n > "}" \n \n "pedal = {" \n > "s2\\sustainDown s2\\sustainUp" \n > "}" \n \n "\\score {" \n > "\\new PianoStaff <<" \n > "\\new Staff = \"upper\" \\upper" \n > "\\new Dynamics = \"dynamics\" \\dynamics" \n > "\\new Staff = \"lower\" <<" \n > "\\clef bass" \n > "\\lower" \n > ">>" \n > "\\new Dynamics = \"pedal\" \\pedal" \n > ">>" \n "\\layout {" \n > "\\context {" \n > "\\type \"Engraver_group\"" \n > "\\name Dynamics" \n > "\\alias Voice % So that \\cresc works, for example." \n > "\\consists \"Output_property_engraver\"" \n \n > "\\override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)" \n > "pedalSustainStrings = #'(\"Ped.\" \"*Ped.\" \"*\")" \n > "pedalUnaCordaStrings = #'(\"una corda\" \"\" \"tre corde\")" \n \n > "\\consists \"Piano_pedal_engraver\"" \n > "\\consists \"Script_engraver\"" \n > "\\consists \"Dynamic_engraver\"" \n > "\\consists \"Text_engraver\"" \n \n > "\\override TextScript #'font-size = #2" \n > "\\override TextScript #'font-shape = #'italic" \n > "\\override DynamicText #'extra-offset = #'(0 . 2.5)" \n > "\\override Hairpin #'extra-offset = #'(0 . 2.5)" \n \n > "\\consists \"Skip_event_swallow_translator\"" \n \n > "\\consists \"Axis_group_engraver\"" \n > "}" \n \n "\\context {" \n > "\\PianoStaff" \n > "\\accepts Dynamics" \n > "\\override VerticalAlignment #'forced-distance = #7" \n > "}" \n > "}" \n > "}" \n \n "\\score {" \n > "\\new PianoStaff <<" \n > "\\new Staff = \"upper\" << \\upper \\dynamics >>" \n > "\\new Staff = \"lower\" << \\lower \\dynamics >>" \n > "\\new Dynamics = \"pedal\" \\pedal" \n > ">>" \n \n "\\midi {" \n > "\\context {" \n > "\\type \"Performer_group\"" \n > "\\name Dynamics" \n > "\\consists \"Piano_pedal_performer\"" \n > "}" \n \n "\\context {" \n > "\\PianoStaff" \n > "\\accepts Dynamics" \n > "}" \n > "}" \n > "}" \n ) ;;;Notes only ;The first example gives you a staff with notes, . Cut and paste this into a file, add ;notes, and you're finished! ;gtg (define-skeleton lp-melody "Insert simple melody skeleton. Suitable for a solo instrument or a melodic fragment" nil > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n "melody = \\relative c' {" \n > "\\key "(skeleton-read "Key: ")\|"c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > ("Sometimes we want to define clef: " "\\clef " str )\n resume: > _ \n > "}" \n \n "\\score {" \n > "\\new Staff \\melody" \n > "\\layout { }" \n > "\\midi {}" \n > "}" \n ) ;;;Notes and lyrics ;gtg (define-skeleton lp-melody-lyrics "Insert simple melody skeleton with lyrics. This example turns off automatic beaming, which is common for vocal parts. If you want to use automatic beaming, you'll have to change or comment out the relevant line." nil > " \\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n " melody = \\relative c' {" \n > "\\key "(skeleton-read "Key: ")\|"c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > ("Sometimes we want to define clef: " "\\clef " str )\n resume: > _ \n > " }" \n \n " text = \\lyricmode {" \n > "LYRICS" \n > "}" \n \n "\\score{" \n > " <<" \n > "\\new Voice = \"one\" {" \n > "\\autoBeamOff %Comment out this line for autobeaming." \n > "\\melody" \n > "}" \n > "\\new Lyrics \\lyricsto \"one\" \\text" \n > " >>" \n " \\layout { }" \n " \\midi { }" \n > "}" \n ) ;;;Notes and chords ;gtg (define-skeleton lp-melody-chords "Insert simple melody skeleton with chords" nil > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "melody = \\relative c' {" \n > "\\key "(skeleton-read "Key: ")\|"c "(skeleton-read "\\major or \\minor: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > ("Sometimes we want to define clef: " "\\clef " str ) resume: \n > _ \n > "}" \n \n > "harmonies = \\chordmode {" \n > "CHORDS %for example c d:dim e:sus4 (not real music!)" \n > "}" \n \n > "\\score {" \n > "<<" \n > "\\new ChordNames {" \n > "\\set chordChanges = ##t" \n > "\\harmonies" \n > "}" \n > "\\new Staff \\melody" \n > ">>" \n \n > "\\layout{ }" \n > "\\midi { }" \n > "}" \n ) ;;;Notes, lyrics, and chords. ;;This template allows you to prepare a song with melody, words, and ;;chords. ;gtg (define-skeleton lp-leadsheet "Insert simple melody skeleton with lyrics and chords." nil > "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "melody = \\relative c' {" \n > "\\key "(skeleton-read "Key: ")\| "c "(skeleton-read "\\major, \\minor or \\ionian: ")\| " \\major" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n > ("Sometimes we want to define clef: " "\\clef " str )\n resume: > _ \n > "}" \n \n > "text = \\lyricmode {" \n > "LYRICS" \n > " }" \n \n > "harmonies = \\chordmode {" \n > "CHORDS" \n > "}" \n \n > "\\score {" \n > "<<" \n > "\\new ChordNames {" \n > "\\set chordChanges = ##t" \n > "\\harmonies" \n > "}" \n > "\\new Voice = \"one\" {" \n > "\\autoBeamOff %Comment out this line for autobeaming." \n > "\\melody" \n > "}" \n > "\\new Lyrics \\lyricsto \"one\" \\text" \n > ">>" \n > "\\layout { }" \n > "\\midi { }" \n > "}" \n ) ;;;Hymn template one set of lyrics for four parts. (define-skeleton lp-hymn ;;gtg "Inserts a skeleton for a hymn-like vocal arrangement. One set of lyrics and four parts." nil "\\version \"2.11.23\"" \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "#(set-global-staff-size 20)" \n > "\\include \"english.ly\" %put your own favoured language file in here eg. italiano.ly etc " \n > "upperOne = " \n > "\\relative a'{" \n > "\\time "(skeleton-read "Time, needs to be of form N/N: ")\| "4/4" \n \n > "\\voiceOne" \n > _ \n > "}" \n \n > "upperTwo = \\relative a'{" \n > "\\voiceTwo" \n > "INSERT NOTES" \n > "}" \n \n > "lowerOne = \\relative a {" \n > "\\voiceOne" \n > "INSERT NOTES" \n > "}" \n \n > "lowerTwo = \\relative c {" \n > "\\voiceTwo" \n > "INSERT NOTES" \n > "}" \n \n > "firstverse = \\lyricmode {" \n > "LYRICS" \n > "}" \n \n > "secondverse = \\lyricmode {" \n > "LYRICS" \n > "}" \n \n > "thirdverse = \\lyricmode {" \n > "LYRICS" \n > "}" \n > "" \n > "fourthverse = \\lyricmode {" \n > "LYRICS" \n > "}" \n > "" \n > "refrain = \\lyricmode {" > "REFRAIN" \n > "}" \n \n > "\\score{ " \n > "\\context StaffGroup <<" \n > "\\context Staff = \"upper\" " \n \n > "<<" \n > "\\clef treble" \n > "\\context Voice = \"one\" \\upperOne" \n > "\\context Voice = \"two\" \\upperTwo " \n > ">>" \n \n > "\\lyricsto \"one\" \\new Lyrics {" \n > "\\set stanza = \"1. \"" \n > "\\firstverse" \n > "}" \n \n > "\\lyricsto \"one\" \\new Lyrics {" \n > "\\set stanza = \"2. \"" \n > "\\secondverse " \n > "}" \n \n > "\\lyricsto \"one\" \\new Lyrics {" \n > "\\set stanza = \"3. \"" \n > "\\thirdverse " \n > "}" \n \n > "\\context Staff = \"lower\" <<" \n > "\\clef bass" \n > "\\context Voice = \"one\" \\lowerOne" \n > "\\context Voice = \"two\" \\lowerTwo" \n > ">>" \n > ">>" \n \n > "\\layout {" \n > "\\context{\\Lyrics" \n > "minimumVerticalExtent = #'(-0.5 . 3)" \n > "}" \n \n > "\\context{\\StaffGroup" \n > "\\remove \"Span_bar_engraver\"" \n > "}" \n \n > "\\context{\\Staff" \n > "minimumVerticalExtent = #'(-3 . 3)" \n > "autoBeaming = ##t" \n > "\\unset melismaBusyProperties " \n > "}" \n \n > "\\context{\\Score" \n > "barNumberVisibility = #all-invisible" \n > "}" \n > "}" \n \n > "\\midi { }" \n > "}" \n > "\\paper {" \n > "linewidth = 6\\in " \n > "indent = 0" \n > "pagenumber = \"no\"" \n > "}" \n ) ; works ;; just do it so that it comes out exactly as written (define-skeleton lp-ancient-style "Insert the neomensural tamplate" nil > "\\version \"2.11.23\" " \n "Use convert-ly to update this file if the version is different to the lilypond you use." \n \n > "global = {" \n > "\\set Score.skipBars = ##t" \n \n > "% incipit" \n > "\\once \\override Score.SystemStartBracket #'transparent = ##t" \n > "\\override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing" \n > "\\key f \\major" \n > "\\time 2/2" \n > "\\once \\override Staff.TimeSignature #'style = #'neomensural" \n > "\\override Voice.NoteHead #'style = #'neomensural" \n > "\\override Voice.Rest #'style = #'neomensural" \n > "\\set Staff.printKeyCancellation = ##f" \n > "\\cadenzaOn % turn off bar lines" \n > "\\skip 1*10" \n > "\\once \\override Staff.BarLine #'transparent = ##f" \n > "\\bar \"\|\|\"" \n > "\\skip 1*1 % need this extra \\skip such that clef change comes" \n > "% after bar line" \n > "\\bar \"\"" \n \n > "% main" \n > "\\revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect?" \n > "\\cadenzaOff % turn bar lines on again" \n > "\\once \\override Staff.Clef #'full-size-change = ##t" \n > "\\set Staff.forceClef = ##t" \n > "\\key g \\major" \n > "\\time 4/4" \n > "\\override Voice.NoteHead #'style = #'default" \n > "\\override Voice.Rest #'style = #'default" \n \n > "% FIXME: setting printKeyCancellation back to #t must not" \n > "% occur in the first bar after the incipit. Dto. for forceClef." \n > "% Therefore, we need an extra \\skip." \n > "\\skip 1*1" \n > "\\set Staff.printKeyCancellation = ##t" \n > "\\set Staff.forceClef = ##f" \n \n > "\\skip 1*7 % the actual music" \n \n > "% let finis bar go through all staves" \n > "\\override Staff.BarLine #'transparent = ##f" \n \n > "% finis bar" \n > "\\bar \"\|.\"" \n > "}" \n \n > "discantusNotes = {" \n > "\\transpose c' c'' {" \n > "\\set Staff.instrumentName = \"Discantus\"" \n \n > "% incipit" \n > "\\clef \"neomensural-c1\"" \n > "c'1. s2 % two bars" \n > "\\skip 1*8 % eight bars" \n > "\\skip 1*1 % one bar" \n \n > "% main" \n > "\\clef \"treble\"" \n > "d'2. d'4 \|" \n > "b e' d'2 \|" \n > "c'4 e'4.( d'8 c' b \|" \n > "a4) b a2 \|" \n > "b4.( c'8 d'4) c'4 \|" \n > "\\once \\override NoteHead #'transparent = ##t c'1 |" \n > "b\\breve \|" \n > "}" \n > "}" \n \n > "discantusLyrics = \\lyricmode {" \n > "% incipit" \n > "IV-" \n \n > "% main" \n > "la -- te De -- \|" \n > "o, om --" \n > "nis ter -- \|" \n > "ra, __ om- \|" \n > "\"...\" \|" \n > "-us. \|" \n > "}" \n \n > "altusNotes = {" \n > "\\transpose c' c'' {" \n > "\\set Staff.instrumentName = \"Altus\"" \n \n > "% incipit" \n > "\\clef \"neomensural-c3\"" \n > "r1 % one bar" \n > "f1. s2 % two bars" \n > "\\skip 1*7 % seven bars" \n > "\\skip 1*1 % one bar" \n \n > "% main" \n > "\\clef \"treble\"" \n > "r2 g2. e4 fis g \| % two bars" \n > "a2 g4 e \|" \n > "fis g4.( fis16 e fis4) \|" \n > "g1 \|" \n > "\\once \\override NoteHead #'transparent = ##t g1 \|" \n > "g\\breve \|" \n > "}" \n > "}" \n \n > "altusLyrics = \\lyricmode {" \n > "% incipit" \n > "IV-" \n \n > "% main" \n > "Ju -- bi -- la -- te \| % two bars" \n > "De -- o, om -- \|" \n > "nis ter -- ra, \|" \n > "\"...\" \|" \n > "-us. \|" \n > "}" \n \n > "tenorNotes = {" \n > "\\transpose c' c' {" \n > "\\set Staff.instrumentName = \"Tenor\"" \n \n > "% incipit" \n > "\\clef \"neomensural-c4\"" \n > "r\\longa % four bars" \n > "r\\breve % two bars" \n > "r1 % one bar" \n > "c'1. s2 % two bars" \n > "\\skip 1*1 % one bar" \n > "\\skip 1*1 % one bar" \n \n > "% main" \n > "\\clef \"treble_8\"" \n > "R1 \|" \n > "R1 \|" \n > "R1 \|" \n > "r2 d'2. d'4 b e' \| % two bars" \n > "\\once \\override NoteHead #'transparent = ##t e'1 \|" \n > "d'\\breve \|" \n > "}" \n > "}" \n \n > "tenorLyrics = \\lyricmode {" \n > "% incipit" \n > "IV-" \n \n > "% main" \n > "Ju -- bi -- la -- te \| % two bars" \n > "\"...\" \|" \n > "-us. \|" \n > "}" \n \n > "bassusNotes = {" \n > "\\transpose c' c' {" \n > "\\set Staff.instrumentName = \"Bassus\"" \n \n > "% incipit" \n > "\\clef \"bass\"" \n > "r\\maxima % eight bars" \n > "f1. s2 % two bars" \n > "\\skip 1*1 % one bar" \n \n > "% main" \n > "\\clef \"bass\"" \n > "R1 \|" \n > "R1 \|" \n > "R1 \|" \n > "R1 \|" \n > "g2. e4 \|" \n > "\\once \\override NoteHead #'transparent = ##t e1 \|" \n > "g\\breve \|" \n > "}" \n > "}" \n \n > "bassusLyrics = \\lyricmode {" \n > "% incipit" \n > "IV-" \n \n > "% main" \n > "Ju -- bi- \|" \n > "\"...\" \|" \n > "-us. \|" \n > "}" \n \n > "\\score {" \n > "\new StaffGroup = choirStaff <<" \n > "\new Voice =" \n > "\"discantusNotes\" << \\global \\discantusNotes >>" \n > "\new Lyrics =" \n > "\"discantusLyrics\" \\lyricsto discantusNotes { \\discantusLyrics }" \n > "\new Voice =" \n > "\"altusNotes\" << \\global \\altusNotes >>" \n > "\new Lyrics =" \n > "\"altusLyrics\" \\lyricsto altusNotes { \\altusLyrics }" \n > "\new Voice =" \n > "\"tenorNotes\" << \\global \\tenorNotes >>" \n > "\new Lyrics =" \n > "\"tenorLyrics\" \\lyricsto tenorNotes { \\tenorLyrics }" \n > "\new Voice =" \n > "\"bassusNotes\" << \\global \\bassusNotes >>" \n > "\new Lyrics =" \n > "\"bassusLyrics\" \\lyricsto bassusNotes { \\bassusLyrics }" \n > ">>" \n > "\\layout {" \n > "\\context {" \n > "\\Score" \n \n > "% no bars in staves" \n > "\\override BarLine #'transparent = ##t" \n \n > "% incipit should not start with a start delimiter" \n > "\\remove \"System_start_delimiter_engraver\"" \n > "}" \n > "\\context {" \n > "\\Voice" \n \n > "% no slurs" \n > "\\override Slur #'transparent = ##t" \n \n > "% Comment in the below \"\\remove\" command to allow line" \n > "% breaking also at those barlines where a note overlaps" \n > "% into the next bar. The command is commented out in this" \n > "% short example score, but especially for large scores, you" \n > "% will typically yield better line breaking and thus improve" \n > "% overall spacing if you comment in the following command." \n > "%\\remove \"Forbid_line_break_engraver\"" \n > "}" \n > "}" \n > "}" \n ) (define-skeleton lp-tuplet ;candidate for keybinding? "Wrap a region in or insert a triplet or tuplet" nil "\\times "(skeleton-read "Duration of notes/Number of notes eg:2/3 ") " { " _ " } " ) (define-skeleton lp-slur "Wrap a region in a slur structure" nil "( " _ ")" ) (define-skeleton lp-phrase "Insert a phrasing slur" nil "\\( " _ "\\) " ) (define-skeleton lp-manual-beams "Insert manual beams" nil "[ " _ "] " ) (define-skeleton lp-partial "Insert a \\partial " nil "\\partial "(skeleton-read "Length of note*number of notes eg: 8*5 ")" " _ " \|" ) (define-skeleton lp-cadenza "Insert or wrap a region" nil "\\cadenzaOn " _ " \\cadenzaOff " ) (define-skeleton lp-crescendo "Insert a crescendo" nil "\\< " _ "\\! " ) (define-skeleton lp-trill "Insert a trill" nil "\\startTrillSpan " _ "\\stopTrillSpan " ) (define-skeleton lp-pedal " " nil "\\sustainDown " _ "\\sustainUp " ) (define-skeleton lp-horizontal-bracket "Insert analysis brackets or wrap a region in analysis brackets. Put \\Staff \\consists \"Horizontal_bracket_engraver\" in the layout block." nil "\\startGroup " _ "\\stopGroup " ) (define-skeleton lp-sostenuto "Insert or wrap a region with sostenuto pedal." nil "\\sostenutoDown" _ "\\sostenutoUp " ) (define-skeleton lp-repeat "Insert a repeat structure without an alternate ending." nil "\\repeat "(skeleton-read "volta, unfold, tremolo, percent: ")" "(skeleton-read "how many times? ") " { " _ " } " ) (define-skeleton lp-repeat-alternate "Insert a repeat structure with an alternate ending. Uses volta." nil "\\repeat volta "(skeleton-read "how many times? ") " { " _ " } " \n > "\\alternative {" \n > "{ INSERT NOTES } { INSERT NOTES } { ANY MORE? }"\n > "}" \n ) (define-skeleton lp-text-spanner "Insert a text spanner. Some tweaks are #'edge-text #'dash-period #'style #'edge-height #'dash-fraction #'thickness. You can have more than one \override tweak." nil ("What kind of text spanner? For example; edge-text, style, or dash-period?: ""\\override TextSpanner #'"str" = #"(skeleton-read "What value; can be a number, 'string or '(list): "))\n >" SINGLE NOTE \\startTextSpan " _ " \\stopTextSpan" ) ;; Some examples of TextSpanner tweaks. ;; \override TextSpanner #'dash-period = #2 ;; \override TextSpanner #'dash-fraction = #0.0 ;; \override TextSpanner #'style = #'dashed-line ;; \override TextSpanner #'edge-height = #'(1 . -2) ;; \override TextSpanner #'dash-period = #10 ;; \override TextSpanner #'dash-fraction = #.5 ;; \override TextSpanner #'thickness = #10 (defvar LilyPond-mode-abbrev-table (let ((ac abbrevs-changed)) (define-abbrev LilyPond-mode-abbrev-table "lph" "" 'lp-header) (define-abbrev LilyPond-mode-abbrev-table "lpg" "" 'lp-global) (define-abbrev LilyPond-mode-abbrev-table "lpve" "" 'lp-vocal-ensemble) (define-abbrev LilyPond-mode-abbrev-table "lpgm" "" 'lp-global-min) (define-abbrev LilyPond-mode-abbrev-table "lpbk" "" 'lp-book-skeleton) (define-abbrev LilyPond-mode-abbrev-table "lpsn" "" 'lp-snippet) (define-abbrev LilyPond-mode-abbrev-table "lpbc" "" 'lp-block-comment) (define-abbrev LilyPond-mode-abbrev-table "lptr" "" 'lp-transpose-region) (define-abbrev LilyPond-mode-abbrev-table "lpvb" "" 'lp-var-block) (define-abbrev LilyPond-mode-abbrev-table "lpsq" "" 'lp-string-quartet) (define-abbrev LilyPond-mode-abbrev-table "lph" "" 'lp-hymn) (define-abbrev LilyPond-mode-abbrev-table "lpls" "" 'lp-lead-sheet) (define-abbrev LilyPond-mode-abbrev-table "lpmc" "" 'lp-melody-chords) (define-abbrev LilyPond-mode-abbrev-table "lpml" "" 'lp-melody-lyrics) (define-abbrev LilyPond-mode-abbrev-table "lpm" "" 'lp-melody) ;;You get the idea. (setq abbrevs-changed ac) LilyPond-mode-abbrev-table)) (setq skeleton-end-hook nil)