Small updates, fixed makedrum script

This commit is contained in:
Eric Teunis de Boone 2016-10-26 11:21:41 +02:00
commit 7767d88405
6 changed files with 76 additions and 44 deletions

View File

@ -28,6 +28,7 @@
#(ly:set-option 'relative-includes #t) #(ly:set-option 'relative-includes #t)
\include "lilydrum/layout_tweaks.ily" \include "lilydrum/layout_tweaks.ily"
\include "lilydrum/naming.ily"
\include "lilydrum/musical_functions.ily" \include "lilydrum/musical_functions.ily"
\include "lilydrum/embellishments.ily" \include "lilydrum/embellishments.ily"
\include "lilydrum/flourishing.ily" \include "lilydrum/flourishing.ily"

View File

@ -69,28 +69,37 @@ autohand = #(define-music-function (parser location note left right) (ly:music?
flam = #(define-music-function (parser location note) (ly:music?) #{ flam = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note { \flamg } { \flamd } \autohand $note { \flamg } { \flamd }
#}) #})
flamdr = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note { \flamgdr } { \flamddr }
#})
% Drag % Drag
drag = #(define-music-function (parser location note) (ly:music?) #{ drag = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \dragg \dragd \autohand $note \dragg \dragd
#}) #})
dragdr = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \draggdr \dragddr
#})
% Open Drag % Open Drag
odrag = #(define-music-function (parser location note) (ly:music?) #{ odrag = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \odragg \odragd \autohand $note \odragg \odragd
#}) #})
odragdr = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \odraggdr \odragddr
#})
% Ruff % Ruff
ruff = #(define-music-function (parser location note) (ly:music?) #{ ruff = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \ruffg \ruffd \autohand $note \ruffg \ruffd
#}) #})
ruffdr = #(define-music-function (parser location note) (ly:music?) #{
\autohand $note \ruffgdr \ruffddr
#})
% Swiss Ruff % Swiss Ruff
sruff = #(define-music-function (parser location note) (ly:music?) #{ sruff = #(define-music-function (parser location note) (ly:music?) #{
% is note right-handed? then \flamd \autohand $note \sruffg \sruffd
% if left, then \flamg #})
#(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand") sruffdr = #(define-music-function (parser location note) (ly:music?) #{
#{ \sruffg #} \autohand $note \sruffgdr \sruffddr
#{ \sruffd #})
% print the note, else it won't show up
$note
#}) #})

View File

@ -93,20 +93,3 @@ drumPitchNames =
\accepts "PipeBandDrumStaff" \accepts "PipeBandDrumStaff"
} }
} }
% =================================================== %
% *Shorts* for Naming %
% =================================================== %
instrumentSide = "Side"
instrumentTenor = "Tenor"
instrumentBass = "Bass"
instrumentPipes = "Pipes"
shortInstrumentSide = "S.D."
shortInstrumentTenor = "T.D."
shortInstrumentBass = "B.D."
shortInstrumentPipes = "P."
composerSide = ""
composerTenor = ""
composerBass = ""
composerPipes = ""

View File

@ -5,13 +5,13 @@
eighthBeaming = { eighthBeaming = {
\set baseMoment = #(ly:make-moment 1/8) \set baseMoment = #(ly:make-moment 1/8)
\set beatStructure = #'( 2 2 ) \set beatStructure = #'( 2 )
} }
eighthReelBeaming = { eighthReelBeaming = {
\set baseMoment = #(ly:make-moment 1/8) \set baseMoment = #(ly:make-moment 1/8)
\set beatStructure = #'( 4 4) \set beatStructure = #'( 4 )
} }
compoundEighthBeaming = { eighthCompoundBeaming = {
\set baseMoment = #(ly:make-moment 1/8) \set baseMoment = #(ly:make-moment 1/8)
\set beatStructure = #'( 3 ) \set beatStructure = #'( 3 )
} }
@ -22,10 +22,6 @@ triplet = #(define-music-function (parser location notes) (ly:music?) #{ \tuplet
% dynamics % dynamics
v = #(define-event-function (parser location) () #{ \upbow #}) v = #(define-event-function (parser location) () #{ \upbow #})
% repeat brackets
dr = #(define-event-function (parser location) () #{ \startGroup #})
fr = #(define-event-function (parser location) () #{ \stopGroup #})
% dynamics with extended lines % dynamics with extended lines
dynLine = #(define-music-function dynLine = #(define-music-function
(parser location text) (parser location text)
@ -41,7 +37,10 @@ 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) }
#}) #})
% unison brackets
% still to add: a little 'u' % still to add: a little 'u'
dr = #(define-event-function (parser location) () #{ \startGroup #})
fr = #(define-event-function (parser location) () #{ \stopGroup #})
tutti = #(define-event-function (parser location notes) (ly:music?) #{ tutti = #(define-event-function (parser location notes) (ly:music?) #{
\startGroup \startGroup
$notes $notes

31
lilydrum/naming.ily Normal file
View File

@ -0,0 +1,31 @@
% =================================================== %
% *Shorts* for Naming %
% =================================================== %
#(newline)
#(display "Short naming loaded")
instrumentSide = "Side"
instrumentTenor = "Tenor"
instrumentBass = "Bass"
instrumentLyrics = "Lyrics"
instrumentPipes = "Pipes"
instrumentPipessecnd = "Seconds"
instrumentPipesthrd = "Thirds"
instrumentSecnd = "Seconds"
instrumentThrd = "Thirds"
shortInstrumentLyrics = ""
shortInstrumentSide = "S.D."
shortInstrumentTenor = "T.D."
shortInstrumentBass = "B.D."
shortInstrumentPipes = "P."
shortInstrumentPipessecnd = "P2"
shortInstrumentPipesthrd = "P3"
shortInstrumentSecnd = "2nd"
shortInstrumentThrd = "3rd"
composerLyrics = ""
composerSide = ""
composerTenor = ""
composerBass = ""
composerPipes = ""
composerPipessecnd = ""
composerPipesthrd = ""

View File

@ -32,7 +32,7 @@ class MakeDrum:
dest='lilydrum', default=os.path.join(self.MASTER_DIR,'lilydrum.ly'), dest='lilydrum', default=os.path.join(self.MASTER_DIR,'lilydrum.ly'),
help='Use the specified file for drums') help='Use the specified file for drums')
parser.add_argument('-c', '--pipefile', parser.add_argument('-c', '--pipefile',
dest='lilypipe', default='bagpipe.ly', dest='lilypipe', default=os.path.join(self.MASTER_DIR,'bagpipe.ly'),
help='Use the specified file for pipes') help='Use the specified file for pipes')
parser.add_argument('-i', '--include', parser.add_argument('-i', '--include',
dest='includes', nargs='*', default=[],action='append', dest='includes', nargs='*', default=[],action='append',
@ -96,9 +96,9 @@ class MakeDrum:
# Input files # Input files
if self.args.list_file != '': if self.args.list_file != '':
with io.open(self.args.list_file, 'r', encoding='utf8') as list_file: with io.open(self.args.list_file, 'r', encoding='utf8') as list_file:
for line in list_file.readlines(): for line in list_file.readlines():
self.args.music_file.append(line) self.args.music_file.append(line)
# Check for files # Check for files
if not self.args.music_file: if not self.args.music_file:
@ -179,27 +179,35 @@ class MakeDrum:
if not self.args.compilable: if not self.args.compilable:
os.remove(tmp_file) os.remove(tmp_file)
def maketemplate(self, tmp_dir, file, compilable): def maketemplate(self, tmp_dir, file, compilable):
lily_includes = '' lily_includes = ''
include_drum_file = False include_drum_file = False
include_pipe_file = False include_pipe_file = False
# find out whether drum, pipes, or full score
for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
if ext in file:
include_drum_file = True
break
for ext in ['full', 'pipes']: # find out whether drum, pipes, or full score
if ext in file: if self.args.lilydrum:
include_pipe_file = True for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
break if ext in file:
include_drum_file = True
break
else:
print('no lilydrum file')
if self.args.lilypipe:
for ext in ['full', 'pipes']:
if ext in file:
include_pipe_file = True
break
else:
print('no lilypipe file')
if include_drum_file: if include_drum_file:
self.args.includes.insert(0, self.args.lilydrum) self.args.includes.insert(0, self.args.lilydrum)
if include_pipe_file: if include_pipe_file:
self.args.includes.insert(0, self.args.lilypipe) self.args.includes.insert(0, self.args.lilypipe)
# set up a tmp file with template and file combined # set up a tmp file with template and file combined
tmp_file = os.path.join(tmp_dir, self.TMP_PREFIX + os.path.relpath(file).replace('../','').replace('music/','',1).replace('/', '-')[:-3] + self.args.suffix + '.ly') tmp_file = os.path.join(tmp_dir, self.TMP_PREFIX + os.path.relpath(file).replace('../','').replace('music/','',1).replace('/', '-')[:-3] + self.args.suffix + '.ly')
@ -217,6 +225,7 @@ class MakeDrum:
if not incline.startswith('\\'): #already absolute if not incline.startswith('\\'): #already absolute
incline = os.path.join(os.path.abspath(os.path.dirname(relpath)), incline) incline = os.path.join(os.path.abspath(os.path.dirname(relpath)), incline)
if compilable: if compilable:
try: try:
inc_file = io.open(incline,'r',encoding='utf8') inc_file = io.open(incline,'r',encoding='utf8')