Add template

This commit is contained in:
contrapunctus 2020-11-27 03:32:46 +05:30
commit fee9323fce
9 changed files with 202 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pdf
output/

85
01 Gute Nacht/build.scm Executable file
View File

@ -0,0 +1,85 @@
#!/usr/bin/guile -s
!#
(use-modules
(ice-9 match)
(srfi srfi-1)
(ice-9 format)
(ice-9 regex))
;; (format #t "~2%")
(define *options*
'("pac" "size"))
(define *project-name*
(regexp-substitute #f (string-match ".*/" (getcwd)) 'post))
;; Looks through the args list for the first occurrence of each valid
;; option from *options*
(define get-valid-args
(lambda (cli-args)
;; (format (current-error-port) "cli-args - ~s~%" cli-args)
(map (lambda (opt)
(find (lambda (cli-word)
(string-match
(string-append "^" opt)
cli-word))
cli-args))
*options*)))
;; changes args into a key-value alist
(define valid-args->alist
(lambda (valid-args)
;; (format (current-error-port) "valid-args - ~s~%" valid-args)
(map (lambda (arg)
(and arg
(string-contains arg "=")
(cons
(regexp-substitute #f (string-match "=" arg) 'pre)
(regexp-substitute #f (string-match "=" arg) 'post))))
valid-args)))
(if (< (length (command-line)) 2)
(format #t "~a~%" "Usage: build.scm TARGET [ARG=VALUE]*")
(let* ((cli-args (command-line))
(target (cadr cli-args))
(valid-args (get-valid-args cli-args))
(args-alist (valid-args->alist valid-args))
(size (match (assoc-ref args-alist "size")
("a4" "-a4")
(_ "")))
(pac (match (assoc-ref args-alist "pac")
("off" "-dno-point-and-click ")
(_ "")))
(ly-command (string-append "lilypond "
pac
"-o \"output/"
*project-name*
(match target
("main" "")
(_ (string-append "-" target)))
(match pac
("" "-pacON")
(_ ""))
(match size
("" "")
(_ "-"))
size
"\" "
target size ".ly")))
;; (format (current-error-port)
;; (string-append
;; "cli-args - ~s~%"
;; "target - ~s~%"
;; "valid-args - ~s~%"
;; "args-alist - ~s~%"
;; "size - ~s~%"
;; "pac - ~s~%")
;; cli-args
;; target
;; valid-args
;; args-alist
;; size
;; pac)
(format #t "~2%~a~2%" ly-command)
(system ly-command)))

4
01 Gute Nacht/chords.ly Executable file
View File

@ -0,0 +1,4 @@
\version "2.18.2"
chordSymbols = \chordmode {
}

6
01 Gute Nacht/common.ly Executable file
View File

@ -0,0 +1,6 @@
\version "2.18.2"
common = {
\time 2/4
\key d \minor
}

12
01 Gute Nacht/lyrics.ly Executable file
View File

@ -0,0 +1,12 @@
voiceLyrics = \lyricsto "voice" {
}
scoreLyrics = \markup {
\column {
\line { }
\vspace #1
}
}

29
01 Gute Nacht/main.ly Executable file
View File

@ -0,0 +1,29 @@
\version "2.18.2"
\include "../project-common.ly"
\include "common.ly"
\include "chords.ly"
\include "music/voice.ly"
\include "lyrics.ly"
\include "music/guitar.ly"
\header {
title = \markup \fontsize #2 "I. Gute Nacht"
composer = \composer
poet = \poet
arranger = \arranger
copyright = \copyright
}
\score {
<<
\new Staff << \new Voice = "voice" { \voice } >>
\new Lyrics \voiceLyrics
\new Staff << \new Voice { \guitar } >>
>>
}
\scoreLyrics

View File

@ -0,0 +1,38 @@
\version "2.20.0"
guitarTuning = \mark \markup \column {
\line {
\override #'(font-size . 0.05) { \circle 3 }
\small "= F3"
}
\line {
\override #'(font-size . 0.05) { \circle 2 }
\small "= A3"
}
}
melody = \relative c'' {
\common
}
middle = \relative c' {
\common
}
bass = \relative c, {
\common
}
guitar = {
\clef "treble_8"
\guitarTuning
<<
\melody \\
\voiceThree \middle \\
\voiceTwo \bass
>>
}

9
01 Gute Nacht/music/voice.ly Executable file
View File

@ -0,0 +1,9 @@
\version "2.18.2"
voice = \relative c' {
\common
\barNumberCheck #1
R1*3 |
}

17
project-common.ly Normal file
View File

@ -0,0 +1,17 @@
\version "2.18.2"
composer = "Franz Schubert"
poet = "Wilhelm Müller"
arranger = "arr. Kashish"
copyright = \markup \center-column {
\smaller {
"The author of this arrangement, contrapunctus/Kashish (xmpp:contrapunctus@jabber.fr), would like to release it into the"
\raise #1
\concat {
\bold "public domain "
"using the Creative Commons CC0 License - "
\with-url #"http://creativecommons.org/publicdomain/zero/1.0/"
{http://creativecommons.org/publicdomain/zero/1.0/}
}
}
}