mirror of
https://github.com/kastdeur/pipeband-music.git
synced 2024-12-22 16:23:31 +01:00
Created script to easily compile a score.
Should be further extended for compiling a full drumscore, however, this will lead to a change in file structure of the 'music' files modified: TODO modified: lilydrum.ly new file: makedrum
This commit is contained in:
parent
3b80ad9473
commit
e90059648c
10 changed files with 411 additions and 36 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
||||||
*tmp*
|
*tmp*
|
||||||
bwwtolily.py
|
bwwtolily.py
|
||||||
_output/
|
_output/
|
||||||
|
pdf/
|
||||||
|
|
30
4-4_marches/the_old_rustic_bridge.tenor.ly
Executable file
30
4-4_marches/the_old_rustic_bridge.tenor.ly
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
\version "2.18.2"
|
||||||
|
|
||||||
|
\include "lilydrum.ly"
|
||||||
|
|
||||||
|
\score {
|
||||||
|
\new DrumStaff {
|
||||||
|
\drummode {
|
||||||
|
\time 4/4
|
||||||
|
|
||||||
|
\repeat volta 2 {
|
||||||
|
\partial 16 g16 |
|
||||||
|
d4 g8 d g4 d8. g16 |
|
||||||
|
d8 g d4 g r |
|
||||||
|
d4 g8 d g d g d |
|
||||||
|
g4 r4 d4 r4 |
|
||||||
|
|
||||||
|
d4 g8 d g4 d8. g16 |
|
||||||
|
d8 g d4 g r |
|
||||||
|
d4 g8 d g d g d |
|
||||||
|
g4 r4 d4 r4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\header {
|
||||||
|
title = "The Old Rustic Bridge"
|
||||||
|
meter = "March"
|
||||||
|
instrument = "Tenor"
|
||||||
|
}
|
||||||
|
}
|
18
5-4_marches/cullen_bay.bass.ly
Executable file
18
5-4_marches/cullen_bay.bass.ly
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
\version "2.18.2"
|
||||||
|
|
||||||
|
\include "lilydrum.ly"
|
||||||
|
|
||||||
|
\score {
|
||||||
|
\new DrumStaff {
|
||||||
|
\time 5/4
|
||||||
|
\repeat volta 2 {
|
||||||
|
\repeat unfold 8 { d4-^ g d-> g d | }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\header {
|
||||||
|
title = "Cullen Bay"
|
||||||
|
meter = "March"
|
||||||
|
instrument = "Bass"
|
||||||
|
}
|
||||||
|
}
|
28
5-4_marches/cullen_bay.tenor.ly
Executable file
28
5-4_marches/cullen_bay.tenor.ly
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
\version "2.18.2"
|
||||||
|
|
||||||
|
\include "lilydrum.ly"
|
||||||
|
|
||||||
|
\score {
|
||||||
|
\new DrumStaff {
|
||||||
|
\drummode {
|
||||||
|
\time 5/4
|
||||||
|
\repeat volta 4 {
|
||||||
|
d8-> g d g d-> g d4 d4 |
|
||||||
|
d8. g16 d8-> g8-> r8 g8 d4 d4 |
|
||||||
|
d8-> g d g d-> g d8.-> g16-> r8 d8-> |
|
||||||
|
d4 d4 d8 g8 d4 d4 |
|
||||||
|
|
||||||
|
d4 g4 d4 g4 d4 |
|
||||||
|
d8. g16 d8-> g8-> r8 g8 d4 d4 |
|
||||||
|
d4 g4 d8-> g8 d8.-> g16-> r8 d8->
|
||||||
|
d4 d4 d8 g8 d4 d4 |
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\header {
|
||||||
|
title = "Cullen Bay"
|
||||||
|
meter = "March"
|
||||||
|
instrument = "Tenor"
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,3 +7,7 @@ There has been a lilypond include file earlier made by Simon Froger (which inclu
|
||||||
This is meant to extend or translate some parts.
|
This is meant to extend or translate some parts.
|
||||||
|
|
||||||
The original file can still be found at http://lsr.di.unimi.it/LSR/Snippet?id=970
|
The original file can still be found at http://lsr.di.unimi.it/LSR/Snippet?id=970
|
||||||
|
|
||||||
|
|
||||||
|
Currently, the most advanced score is MacKenzie Highlanders in 2-4_marches/mackenzie_highlanders.side.ly
|
||||||
|
This score is used for most of the layout.
|
39
TODO
39
TODO
|
@ -1,15 +1,30 @@
|
||||||
TODO
|
TODO
|
||||||
* flam function : detect whether left flam or right flam. This depends on the note, whether it is right or left respectively
|
|
||||||
* show 8th and 16th beats in beaming, currently only 8ths
|
* show 8th and 16th beats in beaming, currently only 8ths
|
||||||
* include EUSPBA flourishing symbols, maybe a sprite file ?!?
|
* Macro for tutti's (unisons)
|
||||||
* spanners (traditional and regimental spanners)
|
* Macro for "Part 2 of $n"
|
||||||
* symbols
|
* If 8/16/32/..th notes come before a flam, they have a flag instead of a beam (fixable by explicit beaming, but rather have a good autobeaming)
|
||||||
* Very special beats (backsticking, crosssticking and the like..)
|
* A tuplet beginning with a flam has a strange tuplet beam (slanted)
|
||||||
* Macros for tutti's (unisons), "Part 2 of $n",
|
* It's custormary to have 4 bars per line for portrait and 8 for landscape...
|
||||||
|
|
||||||
* Find a nice filing system for easy saving, editing, generation of the scores
|
* TEMPLATING
|
||||||
*** script to easily generate the scores
|
Find a nice filing system for easy saving, editing, generation of the scores
|
||||||
should be able to generate single instrument scores aswell as full drumscores,
|
*** script to easily generate the scores
|
||||||
and possibly fullscores (with the pipetune)
|
should be able to generate single instrument scores aswell as full drumscores,
|
||||||
from referenced files
|
and possibly fullscores (with the pipetune)
|
||||||
*** templates
|
from referenced files
|
||||||
|
*** templates
|
||||||
|
|
||||||
|
* SIDE sticking (lookup swiss notation)
|
||||||
|
regular default
|
||||||
|
cross-stick cross
|
||||||
|
rimshot default + cross
|
||||||
|
backstick white triangle pointing down
|
||||||
|
|
||||||
|
|
||||||
|
* FLOURISHING short note above-note
|
||||||
|
regular flourish \fl cross
|
||||||
|
ups \up arrow-up
|
||||||
|
scoop \scoop arrow-right-(diag-up\diag-down)
|
||||||
|
split the feather \stf xcircle
|
||||||
|
cartwheel \cart
|
||||||
|
(EUSPBA symbols)
|
27
airs/farewell_to_camraw.tenor.ly
Executable file
27
airs/farewell_to_camraw.tenor.ly
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
\version "2.18.2"
|
||||||
|
|
||||||
|
\include "lilydrum.ly"
|
||||||
|
|
||||||
|
\score {
|
||||||
|
\new DrumStaff {
|
||||||
|
\drummode {
|
||||||
|
\time 4/4
|
||||||
|
\repeat volta 2 {
|
||||||
|
R1
|
||||||
|
r8 g d16 g d g d8 g d16 g d g |
|
||||||
|
d8 g d16 g d g d4 d16 g d g |
|
||||||
|
d4 g16 d g d d4 r4 |
|
||||||
|
d4 d8 g d4 r4 |
|
||||||
|
d4 d8 g d4 r4 |
|
||||||
|
d8 g d g d4 d8 g |
|
||||||
|
d8 g r4 r2 |
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\header {
|
||||||
|
title = "Farewell to Camraw"
|
||||||
|
meter = "Slow Air"
|
||||||
|
instrument = "Tenor"
|
||||||
|
}
|
||||||
|
}
|
37
airs/the_mist_covered_mountains.tenor.ly
Executable file
37
airs/the_mist_covered_mountains.tenor.ly
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
\version "2.18.2"
|
||||||
|
|
||||||
|
\include "lilydrum.ly"
|
||||||
|
|
||||||
|
\score {
|
||||||
|
\new DrumStaff {
|
||||||
|
\drummode {
|
||||||
|
\time 6/8
|
||||||
|
\repeat volta 2 {
|
||||||
|
d4. g |
|
||||||
|
d4. g8 r8 g8 |
|
||||||
|
d4. g8. d16 g8 |
|
||||||
|
d8. g16 d8 g8 r8 g8 |
|
||||||
|
d4. g |
|
||||||
|
d4. g8 r8 g8 |
|
||||||
|
d4. g8. d16 g8 |
|
||||||
|
d8 g8 d8 g8 r4
|
||||||
|
}
|
||||||
|
\repeat volta 2 {
|
||||||
|
d4. g |
|
||||||
|
d4. g8 r8 g8 |
|
||||||
|
d4. g |
|
||||||
|
d4. g8 r8 g8 |
|
||||||
|
d4. g |
|
||||||
|
d4. g8 r8 g8 |
|
||||||
|
r8. g16 d8 r8. d16 g8 |
|
||||||
|
d8 g8 d8 g8 r4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\header {
|
||||||
|
title = "The Mist Covered Mountains"
|
||||||
|
meter = "Slow Air"
|
||||||
|
instrument = "Tenor"
|
||||||
|
}
|
||||||
|
}
|
89
lilydrum.ly
89
lilydrum.ly
|
@ -85,8 +85,6 @@ drumPitchNames =
|
||||||
% dynamics up
|
% dynamics up
|
||||||
\dynamicUp
|
\dynamicUp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
% slurs below rolls number
|
% slurs below rolls number
|
||||||
%\override TextScript.outside-staff-priority = ##f
|
%\override TextScript.outside-staff-priority = ##f
|
||||||
%\override TextScript.side-axis = #0
|
%\override TextScript.side-axis = #0
|
||||||
|
@ -103,10 +101,10 @@ drumPitchNames =
|
||||||
%\override StemTremolo.Y-offset = #-2.8
|
%\override StemTremolo.Y-offset = #-2.8
|
||||||
|
|
||||||
% repeat brackets
|
% repeat brackets
|
||||||
%\consists "Horizontal_bracket_engraver"
|
\consists "Horizontal_bracket_engraver"
|
||||||
%\override HorizontalBracket.staff-padding = #6.5 % staff-padding
|
\override HorizontalBracket.staff-padding = #3.5 % staff-padding
|
||||||
%\override HorizontalBracket.direction = #DOWN % brackets under thr staff
|
\override HorizontalBracket.direction = #UP % brackets under thr staff
|
||||||
%\override HorizontalBracket.bracket-flare = #'(0 . 0) % vertical brackets
|
\override HorizontalBracket.bracket-flare = #'(0 . 0) % vertical brackets
|
||||||
|
|
||||||
}
|
}
|
||||||
\context {
|
\context {
|
||||||
|
@ -147,10 +145,43 @@ sixteenthBeaming = {
|
||||||
subdivideBeams = ##t
|
subdivideBeams = ##t
|
||||||
strictBeatBeaming = ##t
|
strictBeatBeaming = ##t
|
||||||
|
|
||||||
\override TupletBracket.bracket-visibility = ##f
|
\override TupletBracket.bracket-visibility = #'if-no-beams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
% ================================================= %
|
||||||
|
% Side Sticking (modifies note, or adds mark) %
|
||||||
|
% ================================================= %
|
||||||
|
backstick = #(define-music-function (parser location notes) (ly:music?)
|
||||||
|
#{
|
||||||
|
\temporary \override Staff.NoteHead.style = #'triangle
|
||||||
|
$notes
|
||||||
|
\revert Staff.NoteHead.style
|
||||||
|
#})
|
||||||
|
crossstick = #(define-music-function (parser location notes) (ly:music?)
|
||||||
|
#{
|
||||||
|
\temporary \override Staff.NoteHead.style = #'xcircle
|
||||||
|
$notes
|
||||||
|
\revert Staff.NoteHead.style
|
||||||
|
#})
|
||||||
|
rimshot = #(define-music-function (parser location notes) (ly:music?)
|
||||||
|
#{
|
||||||
|
$notes
|
||||||
|
\once \override Staff.NoteHead.style = #'cross
|
||||||
|
\once \hide Stem
|
||||||
|
d
|
||||||
|
#})
|
||||||
|
|
||||||
|
% ================================================= %
|
||||||
|
% Tenor Flourishing %
|
||||||
|
% ================================================= %
|
||||||
|
flourish = #(define-music-function (parser location notes) (ly:music?)
|
||||||
|
#{
|
||||||
|
\temporary \override Staff.NoteHead.style = #'cross
|
||||||
|
$notes
|
||||||
|
\revert Staff.NoteHead.style
|
||||||
|
#})
|
||||||
|
|
||||||
% ================================================= %
|
% ================================================= %
|
||||||
% Functions %
|
% Functions %
|
||||||
% ================================================= %
|
% ================================================= %
|
||||||
|
@ -183,6 +214,13 @@ dynLine = #(define-music-function
|
||||||
\once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -1) }
|
\once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -1) }
|
||||||
#})
|
#})
|
||||||
|
|
||||||
|
tutti = #(define-event-function (parser location notes) (ly:music?) #{
|
||||||
|
\startGroup
|
||||||
|
% still to add: a little 'u'
|
||||||
|
$notes
|
||||||
|
\stopGroup
|
||||||
|
#})
|
||||||
|
|
||||||
% ================================================= %
|
% ================================================= %
|
||||||
% Flams, Drags & the sort %
|
% Flams, Drags & the sort %
|
||||||
% ================================================= %
|
% ================================================= %
|
||||||
|
@ -206,30 +244,33 @@ drumgrace = #(define-music-function (parser location notes) (ly:music?) #{
|
||||||
|
|
||||||
|
|
||||||
% Flams
|
% Flams
|
||||||
flamd = \drummode { \drumgrace { g8 } } % right Flam, actually flam(left) note(right)
|
flamd = \drummode { \drumgrace { g8 } } % Flam right
|
||||||
flamddr = \drummode { \drumgrace { g8\startGroup } } % with start repeat
|
flamg = \drummode { \drumgrace { d8 } } % Flam left
|
||||||
flamg = \drummode { \drumgrace { d8 } } % left Flam
|
flamddr = \drummode { \drumgrace { g8\startGroup } } % Flam right with start repeat
|
||||||
flamgdr = \drummode { \drumgrace { d8\startGroup } } % with start repeat
|
flamgdr = \drummode { \drumgrace { d8\startGroup } } % Flam left with start repeat
|
||||||
|
|
||||||
% Drags
|
% Drags
|
||||||
dragd = \drummode { \drumgrace { g16[ g] }} % right Drag
|
dragd = \drummode { \drumgrace { g16[ g] }} % Drag right
|
||||||
dragddr = \drummode { \drumgrace { g16[\startGroup g] }} % with start repeat
|
dragg = \drummode { \drumgrace { d16[ d] }} % Drag left
|
||||||
dragg = \drummode { \drumgrace { d16[ d] }} % left Drag
|
dragddr = \drummode { \drumgrace { g16[\startGroup g] }} % Drag right with start repeat
|
||||||
draggdr = \drummode { \drumgrace { d16[\startGroup d] }} % with start repeat
|
draggdr = \drummode { \drumgrace { d16[\startGroup d] }} % Drag left with start repeat
|
||||||
|
|
||||||
% Ruff
|
% Ruff
|
||||||
ruffg = \drummode { \drumgrace { g16[ d g] }} % left Ruff
|
ruffg = \drummode { \drumgrace { g16[ d g] }} % Ruff right
|
||||||
ruffgdr = \drummode { \drumgrace { g16[\startGroup d g] }} % with start repeat
|
ruffd = \drummode { \drumgrace { d16[ g d] }} % Ruff left
|
||||||
ruffd = \drummode { \drumgrace { d16[ g d] }} % right Ruff
|
ruffgdr = \drummode { \drumgrace { g16[\startGroup d g] }} % Ruff right with start repeat
|
||||||
ruffddr = \drummode { \drumgrace { d16[\startGroup g d] }} % with start repeat
|
ruffddr = \drummode { \drumgrace { d16[\startGroup g d] }} % Ruff left with start repeat
|
||||||
|
|
||||||
% Swiss Ruff
|
% Swiss Ruff
|
||||||
sruffg = \drummode { \drumgrace { g16[ d d] }} % left Swiss Ruff
|
sruffg = \drummode { \drumgrace { g16[ d d] }} % Swiss Ruff right
|
||||||
sruffgdr = \drummode { \drumgrace { g16[\startGroup d d] }} % with start repeat
|
sruffd = \drummode { \drumgrace { d16[ g g] }} % Swiss Ruff left
|
||||||
sruffd = \drummode { \drumgrace { d16[ g g] }} % right Swiss Ruff
|
sruffgdr = \drummode { \drumgrace { g16[\startGroup d d] }} % Swiss Ruff right with start repeat
|
||||||
sruffddr = \drummode { \drumgrace { d16[\startGroup g g] }} % with start repeat
|
sruffddr = \drummode { \drumgrace { d16[\startGroup g g] }} % Swiss Ruff left with start repeat
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% Embellishment functions, automatic left or right %%
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
% Embellishment functions, automatic left or right
|
|
||||||
% Flam
|
% Flam
|
||||||
flam = #(define-music-function (parser location note) (ly:music?) #{
|
flam = #(define-music-function (parser location note) (ly:music?) #{
|
||||||
% is note right-handed? then \flamd
|
% is note right-handed? then \flamd
|
||||||
|
|
174
makedrum
Executable file
174
makedrum
Executable file
|
@ -0,0 +1,174 @@
|
||||||
|
#!/usr/bin/python3.4
|
||||||
|
|
||||||
|
## Generate pdf form lilypond file
|
||||||
|
## by using standard command
|
||||||
|
##
|
||||||
|
## Most of programming was done by Sven Axelsson, http://svenax.net/
|
||||||
|
|
||||||
|
import codecs, os
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
class MakeDrum:
|
||||||
|
LILYPOND = 'lilypond'
|
||||||
|
VERSION = '0.7'
|
||||||
|
TMP_DIR = './tmp'
|
||||||
|
TMP_PREFIX = 'tmp_'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
# Gather options and create the template file
|
||||||
|
|
||||||
|
usage = __file__
|
||||||
|
parser = ArgumentParser(usage)
|
||||||
|
|
||||||
|
parser.add_argument('--version',
|
||||||
|
action='store_true', dest='show_version', default=False,
|
||||||
|
help='show makeDrum version and exit')
|
||||||
|
parser.add_argument('--lilyversion',
|
||||||
|
action='store_true', dest='show_lilyversion', default=False,
|
||||||
|
help='show Lilypond version and exit')
|
||||||
|
|
||||||
|
parser.add_argument('-p', '--paper-size',
|
||||||
|
dest='papersize', default='a4',
|
||||||
|
help='Paper size. Default: A4')
|
||||||
|
parser.add_argument('-o', '--orientation',
|
||||||
|
dest='orientation', default='landscape',
|
||||||
|
help='Paper orientation. Default: landscape')
|
||||||
|
parser.add_argument('-s', '--staff-size',
|
||||||
|
dest='staffsize', default='16',
|
||||||
|
help='Staff size. Default: 16pt.')
|
||||||
|
parser.add_argument('-f', '--format',
|
||||||
|
dest='format', default=None,
|
||||||
|
help='Use header format file "header_{format}". Default: "header_default"')
|
||||||
|
parser.add_argument('-w', '--view-spacing',
|
||||||
|
action='store_true', dest='view_spacing', default=False,
|
||||||
|
help='Turn on "Paper.annotatespacing".')
|
||||||
|
|
||||||
|
parser.add_argument('--no-log',
|
||||||
|
action='store_false', dest='log', default=True,
|
||||||
|
help='Do not generate log files.')
|
||||||
|
parser.add_argument('--no-cleanup',
|
||||||
|
action='store_false', dest='clean', default=True,
|
||||||
|
help='Leave all temporary files in place')
|
||||||
|
parser.add_argument('music_file',
|
||||||
|
default='', nargs='+',
|
||||||
|
help='file to process')
|
||||||
|
parser.add_argument('-@', '--list_file',
|
||||||
|
dest='list_file', default='',
|
||||||
|
help='list of files to process')
|
||||||
|
|
||||||
|
self.args = parser.parse_args()
|
||||||
|
|
||||||
|
if self.args.show_version:
|
||||||
|
print(__name__, ' ', self.VERSION)
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.args.show_lilyversion:
|
||||||
|
print(os.system(self.LILYPOND+' --version'))
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.args.view_spacing:
|
||||||
|
self.args.view_spacing = "##t"
|
||||||
|
else:
|
||||||
|
self.args.view_spacing = "##f"
|
||||||
|
|
||||||
|
# Input files
|
||||||
|
if self.args.list_file != '':
|
||||||
|
self.args.music_file.append(open(self.args.list_file, 'r').readlines())
|
||||||
|
close(self.args.list_file)
|
||||||
|
|
||||||
|
# Clean up of files
|
||||||
|
self.remove_tmp_dir = self.args.clean
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(os.path.curdir, self.TMP_DIR)):
|
||||||
|
try: os.makedirs(os.path.join(os.path.curdir, self.TMP_DIR))
|
||||||
|
except:
|
||||||
|
print('Seems like no temporary directory can be created')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
for file_path in self.args.music_file:
|
||||||
|
self.processit(self.TMP_DIR, file_path)
|
||||||
|
|
||||||
|
#if not
|
||||||
|
#os.rmdir(self.TMP_DIR)
|
||||||
|
|
||||||
|
def processit(self, tmp_dir, file):
|
||||||
|
if self.args.log:
|
||||||
|
logfile = os.path.join(self.TMP_DIR, file.strip('.ly').replace('/', '-')+'.log')
|
||||||
|
log = ' > '+logfile+' 2>&1'
|
||||||
|
else:
|
||||||
|
log = ''
|
||||||
|
|
||||||
|
if self.args.format is None:
|
||||||
|
if file.endswith(".book"):
|
||||||
|
header_format = "header_book"
|
||||||
|
else:
|
||||||
|
header_format = "header_default"
|
||||||
|
|
||||||
|
tmp_file = self.maketemplate(tmp_dir, file, header_format)
|
||||||
|
|
||||||
|
print ('Compiling ', file, end=' ', flush=True)
|
||||||
|
|
||||||
|
lilycmd = self.LILYPOND+' --pdf --output=./pdf/'+os.path.basename(tmp_file).strip(self.TMP_PREFIX).strip('ly')+' '+tmp_file+log
|
||||||
|
|
||||||
|
if os.system(lilycmd) != 0:
|
||||||
|
self.remove_tmp_dir = False
|
||||||
|
print ('[Error]')
|
||||||
|
print (' ! Did not compile, please see the log at ', logfile)
|
||||||
|
else :
|
||||||
|
print ('[OK]')
|
||||||
|
os.remove(logfile)
|
||||||
|
os.remove(tmp_file)
|
||||||
|
|
||||||
|
|
||||||
|
def maketemplate(self, tmp_dir, file, header_format):
|
||||||
|
# set up a tmp file with template and file combined
|
||||||
|
tmp_file = os.path.join(tmp_dir, self.TMP_PREFIX + file.replace('/', '-'))
|
||||||
|
|
||||||
|
out_file = codecs.open(tmp_file, 'w+', 'utf8')
|
||||||
|
out_file.write(u'\ufeff')
|
||||||
|
|
||||||
|
out_file.write(u"""
|
||||||
|
% Generated from """+file+""" by """+__file__+"""
|
||||||
|
|
||||||
|
\\version "2.18.0"
|
||||||
|
|
||||||
|
#(ly:set-option 'point-and-click #f)
|
||||||
|
|
||||||
|
#(set-global-staff-size """+self.args.staffsize+""")
|
||||||
|
#(set-default-paper-size \""""+self.args.papersize+"""\" '"""+self.args.orientation+""")
|
||||||
|
|
||||||
|
\\include "../"""+header_format+""".ily"
|
||||||
|
\\include "lilydrum.ly"
|
||||||
|
|
||||||
|
% Local tweaks
|
||||||
|
\\paper {
|
||||||
|
ragged-bottom = ##t
|
||||||
|
}
|
||||||
|
\layout {
|
||||||
|
\context {
|
||||||
|
\Score
|
||||||
|
% We only permit explicit line breaks
|
||||||
|
\override NonMusicalPaperColumn #'line-break-permission = ##f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
% The tune to generate.
|
||||||
|
""")
|
||||||
|
|
||||||
|
# Read lily file into tmp file
|
||||||
|
music = codecs.open(file, 'r', 'utf8').read()
|
||||||
|
if music.startswith(u'\ufeff'): music = music[1:]
|
||||||
|
music = music.split(u'\n')
|
||||||
|
printit = 1
|
||||||
|
for line in music:
|
||||||
|
if line.strip().startswith(u'\\include "lilydrum.ly"'): continue
|
||||||
|
if printit:
|
||||||
|
out_file.write(line.replace('\r', '')+'\n')
|
||||||
|
out_file.close()
|
||||||
|
|
||||||
|
# Return tmp_file_path
|
||||||
|
return tmp_file
|
||||||
|
|
||||||
|
|
||||||
|
MakeDrum();
|
Loading…
Reference in a new issue