Updated Readme

MakeDrum script removed (not necessarily needed for lilydrum )
Removed 'indent = 0' line (see above)
This commit is contained in:
Eric Teunis de Boone 2016-11-27 23:14:25 +01:00
parent 0d959e7202
commit bc65949a6c
3 changed files with 93 additions and 300 deletions

110
README.md
View File

@ -1,30 +1,106 @@
# pipeband-drumming
First trial with github, purpose is to set up a lilypond file in the same way as there is a bagpipe.ly (see github.com/svenax/bagpipemusic). Main focus is on pipeband snare drumming.
# Lilydrum (pipeband-drumming notation)
Somehow, the drums part in lilypond does not cover a notation with only right left. That is right is above the line and left is below it. In the same manner as the bagpipe.ly file, flams and drags are defined as a shortcut.
There has been a lilypond include file earlier made by Simon Froger (which includes all of the above). So first version is a shameless copy.
This is meant to extend or translate some parts.
There has been a lilypond include file earlier, made by Simon Froger (which includes all of the above). So first version is a shameless copy.
The original file can still be found at http://lsr.di.unimi.it/LSR/Snippet?id=970
As the repo has been torn apart to separate these files from an actual music repo, you can find most of my music on [github](github.com/kastdeur/pipeband-music), there's even a ['master repo'](github.com/kastdeur/pipeband-drumming) which should set up most of the environment needed to compile this music (also pulling in [svenax's bagpipemusic](github.com/svenax/bagpipemusic)).
## How to use
---------------------
To make a pipeband drum staff simply use
`\new PipeBandDrumStaff {`
This creates a DrumStaff with a few specific changes.
!! Note that you do not need to use PipeBandDrumStaff to use the rest.
##TODO
Music needs to be defined in \drummode.
You can use every regular drum character (such as `sn` or `bd`), as `d` and `g` are appended to the list.
```lilypond
\score {
\header { title = "Standards 6/8" }
\new PipeBandDrumStaff {
\drummode {
\time 6/8
\partial 8 d8:32(_"7" |
\repeat volta 2 {
g8.[) g16 \dragd d8] d8.[ d16 \dragg g8] |
g8.[ \dragd d16 d8] d8.[ d16 \dragg g8] |
\flamddr d8. d16 g8 d4.:32(_"13" |
d8.) g16 d8 \flamg g4 d8:32(_"7" \fr |
\break
g8.[) g16 \dragd d8] d8.[ d16 \dragg g8] |
g8.[ \dragd d16 d8] d8.[ d16 \dragg g8] |
\flamddr d8. d16:64(_"5" d8) \flamd d8. d16 \flamg g8 |
d8.:32(_"5" d16) \flamg g8 \flamd d4. \fr |
}
}
}
}
```
### Embellishments (Side)
-----------------
Flams and Drags can be added using `\flam` and `\drag`. They can determine whether to be left or right by themselves for simple expressions.
If a certain hand is needed they can be inserted directly by appending `d` or `g` to `flam`,`drag`,..
A `\flam d` is equal to `\flamd d`
There are currently 4 such shortcuts:
`\flam` - A Flam
`\drag` - A Drag
`\ruff` - A Ruff
`\sruff` - A Swiss Ruff
### Unison Brackets (Side)
------------------
Unison Brackets are triggered using `\dr`.
They need an endpoint which is defined by `\fr`
~~You can use `\tutti` for this aswell.
It takes a music expression which is automagically put under brackets.~~~
(not yet)
Appending `dr` to the `\flam`'s or `\drag`'s triggers the unison bracket.
e.g. `\flamdr` of `\draggdr`
### Flourishing (Tenor)
-------------
A few flourishes have been added, most are from the [EUSPBA](http://www.euspba.org/resource/music/EUSPBA_drums_tenorflourishing.pdf):
`\flourish`
`\splitTheFeather`
`\cartWheel`
`\up`
`\blfy` - butterfly
`\rblfy` - reverse butterfly
`\rthrow` - throw right
`\lthrow` - throw left
`\bthrow` - throw both
`\rpush` - push right
`\lpush` - push left
`\bpush` - push both
`\andrewStop` - St. Andrew's Stop
`\stop`
Scoops have not been created yet
## TODO
--------------------------
* ~~See if aliases work~~ `foo = { \bar }`
* show 8th and 16th beats in autobeaming, currently only 8ths: d32[[ g] d[ g]] d32[[ g] d[ g]]
* Macro for tutti's (unisons)
- on just one note
- with open ending
- on just one note
- with open ending
* Macro for "Part $m of $n"
* 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)
* A tuplet beginning with a flam has a strange tuplet beam (slanted) (fixable by putting the flam outside of the tuplet .. However the flam function doesnt work that way (yet))
* 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)
* A tuplet beginning with a flam has a strange tuplet beam (slanted)
(fixable by putting the flam outside of the tuplet .. However the flam function doesnt work that way (yet))
* It's customary to have 4 bars per line for portrait and 8 for landscape... (most of the time this can be accomplished by \break-ing every 8 measures and having enough notes in)
* SIDE sticking
rimshot default + cross
* rimshot `defaultnote + cross`
* FLOURISHING short long note above-note
ups \up arrow-up ( I don't like the arrow I scripted )
scoop \scoop arrow-right-(diag-up then diag-down) [propably start on beginning of note and filter out the last one]
[further EUSPBA symbols](www.euspba.org/resource/music/EUSPBA_drums_tenorflourishing.pdf)
* scoop `\scoop` arrow-right-(diag-up then diag-down)
[propably start on beginning of note and filter out the last one]
* [further flourish symbols](http://www.euspba.org/resource/music/EUSPBA_drums_tenorflourishing.pdf)

View File

@ -24,7 +24,6 @@ drumPitchNames =
)
\layout {
indent = 0.0
\context {
\DrumStaff
\name PipeBandDrumStaff

282
makedrum
View File

@ -1,282 +0,0 @@
#!/usr/bin/env python3
## Generate pdf form lilypond file
## by using standard command
##
## Most of programming was done by Sven Axelsson, http://svenax.net/
import io, os
from argparse import ArgumentParser
class MakeDrum:
LILYPOND = 'lilypond'
VERSION = '0.9.5'
MASTER_DIR = os.path.dirname(os.path.abspath(__file__))
RUN_DIR = os.path.abspath(os.curdir)
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('-x', '--drumfile',
dest='lilydrum', default=os.path.join(self.MASTER_DIR,'lilydrum.ly'),
help='Use the specified file for drums')
parser.add_argument('-c', '--pipefile',
dest='lilypipe', default=os.path.join(self.MASTER_DIR,'bagpipe.ly'),
help='Use the specified file for pipes')
parser.add_argument('-i', '--include',
dest='includes', nargs='*', default=[],action='append',
help='Include the specified file for compiling')
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='18',
help='Staff size. Default: 18pt.')
parser.add_argument('-w', '--view-spacing',
action='store_true', dest='view_spacing', default=False,
help='Turn on "Paper.annotatespacing".')
parser.add_argument('-r', '--suffix',
dest='suffix', default='',
help='String added at end of pdf\'s filename')
parser.add_argument('-g', '--generated',
dest='gen_out', default=self.TMP_DIR,
help='Put generated lilyfiles in $gen_out')
parser.add_argument('-q', '--self-compilable', default=False,
action='store_true', dest='compilable',
help='Make a self compilable file')
parser.add_argument('--no-compile', default=True,
action='store_false', dest='compile',
help='Do not compile generated Lilypond files')
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('-d', '--out-dir',
dest='out_dir', default='pdf',
help='Output dir, for lilypond. If it doesn\'t exist, try to create it')
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 != '':
with io.open(self.args.list_file, 'r', encoding='utf8') as list_file:
for line in list_file.readlines():
self.args.music_file.append(line)
# Check for files
if not self.args.music_file:
parser.print_usage()
return
# Check for files to include
self.args.includes = [el for elements in self.args.includes for el in elements]
# 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
if not os.path.exists(os.path.join(os.path.curdir, self.args.out_dir)):
try: os.makedirs(os.path.join(os.path.curdir, self.args.out_dir))
except:
print('Seems like no output directory can be created')
return
for file_path in self.args.music_file:
self.processit(self.TMP_DIR, os.path.join(self.RUN_DIR, file_path), self.args.gen_out, self.args.compile)
if not os.listdir(self.TMP_DIR):
os.rmdir(self.TMP_DIR)
def processit(self, tmp_dir, file, gen_out, compile):
print ('Generating for ',file, end=' ', flush=True)
tmp_file = self.maketemplate(tmp_dir, file, self.args.compilable)
print ('[OK]')
if gen_out is not None and gen_out != tmp_dir:
new_tmp_file = os.path.basename(tmp_file).replace(self.TMP_PREFIX, '');
print ('Moving ', tmp_file, ' to ', new_tmp_file, end=' ', flush=True)
gen_dir = os.path.join(self.RUN_DIR, gen_out);
# if not dir $gen_out, make it
if not os.path.exists(gen_dir):
try: os.makedirs(gen_dir)
except:
print('[Error]')
print(' ! Seems like the {} directory cannot be created'.format(gen_dir))
return
# mv file to dir, remove self.TMP_PREFIX
os.rename(tmp_file, os.path.join(gen_dir, new_tmp_file))
tmp_file = new_tmp_file
print('[OK]')
if compile:
if self.args.log:
logfile = os.path.join(self.TMP_DIR, os.path.relpath(file).replace(".ly", '').replace('/', '-')+'.log')
log = ' > '+logfile+' 2>&1'
else:
log = ''
print ('Compiling ', file, end=' ', flush=True)
if not self.args.log:
print()
lilyout = os.path.join(self.RUN_DIR, self.args.out_dir, os.path.basename(tmp_file).replace(self.TMP_PREFIX, '').replace(".ly", ''))
lilycmd = self.LILYPOND+' --pdf --output='+lilyout+' '+tmp_file+log
if os.system(lilycmd) != 0:
self.remove_tmp_dir = False
print ('[Error]')
if self.args.log:
print (' ! Did not compile, please see the log at ', logfile)
else :
print ('[OK]')
if self.args.clean:
#remove files
if self.args.log:
os.remove(logfile)
if not self.args.compilable:
os.remove(tmp_file)
def maketemplate(self, tmp_dir, file, compilable):
lily_includes = ''
include_drum_file = False
include_pipe_file = False
if not self.args.lilydrum or self.args.lilydrum == "''":
self.args.lilydrum = False
if not self.args.lilypipe or self.args.lilypipe == "''":
self.args.lilypipe = False
# find out whether drum, pipes, or full score
if self.args.lilydrum:
for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
if ext in file:
include_drum_file = True
break
if self.args.lilypipe:
for ext in ['full', 'pipes']:
if ext in file:
include_pipe_file = True
break
if include_drum_file:
self.args.includes.insert(0, self.args.lilydrum)
if include_pipe_file:
self.args.includes.insert(0, self.args.lilypipe)
# 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')
# Make the file
with io.open(tmp_file, 'w+', encoding='utf8') as out_file:
def printline(line, relpath = file):
# Check if there's an include in the line, if there is try to copy it all (Recursive)
if line.startswith(u'\\include'):
# Rewrite includes to absolute location of file
incline = line.replace('\\include', '').strip('"\'\n ')
printline(u"\n %%%% \"{}\"\n".format(incline))
if not incline.startswith('\\'): #already absolute
incline = os.path.join(os.path.abspath(os.path.dirname(relpath)), incline)
if compilable:
try:
inc_file = io.open(incline,'r',encoding='utf8')
except IOError:
out_file.write(line + "%% Error to copy %%\n")
return
with inc_file:
for subline in inc_file.readlines():
printline(subline, incline)
else:
out_file.write(u"\\include \""+incline+"\"\n")
return
out_file.write(line.replace('\r', ''))
# Go do things with it
printline(u'\ufeff')
printline(
u"""% Generated from """+file+""" by """+__file__+""" version """+self.VERSION+"""
\\version "2.18.0"
#(ly:set-option 'point-and-click #f)
%\layout {
% \context {
% \Score {
% \override NonMusicalPaperColumn #'line-break-permission = ##f
% }
% }
%}
""")
for f in self.args.includes:
printline(u"\n")
printline(u"\\include \"{}\"".format(f), self.RUN_DIR+'/build')
printline(u"""
#(set-global-staff-size """+self.args.staffsize+""")
#(set-default-paper-size \""""+self.args.papersize+"""\" '"""+self.args.orientation+""")
% The tune to generate.
""")
# Read lily file into tmp file
with io.open(file, 'r', encoding='utf8') as in_file:
for line in in_file.readlines():
if line.startswith(u'\ufeff'): continue
printline(line)
# Return tmp_file_path
return tmp_file
MakeDrum();