commit 792d8f563e9c11f2550a3ae67145a04a7a6823a1 Author: Eric Teunis de Boone Date: Thu Jan 7 14:47:02 2016 +0100 workable right now diff --git a/build b/build new file mode 100644 index 0000000..7411d29 --- /dev/null +++ b/build @@ -0,0 +1,42 @@ +#!/bin/bash + +MKDRUMCOMMAND="./lily_files/makedrum" +MKDRUMOPTIONS="-i ./lily_files/defs.ly -x ./lily_files/lilydrum.ly -c ./lily_files/bagpipe_new.ly" +MUSIC_DIR="./music" + +trap "echo Aborted!; exit;" SIGINT SIGTERM + +another_dir() { + d=$1 + for f in $d/* + do + if [ -d "$f" ]; then + if [ "$f" == "template" ]; then + continue + fi + + another_dir $f + continue + fi + if [ ! -f "$f" ]; then + continue + fi + + if [[ ! "$f" == *.ly ]]; then + continue + fi + + $MKDRUMCOMMAND $MKDRUMOPTIONS "$f" + done; +} + +if [ "$1" == "-a" ]; then + echo "Build all" + another_dir $MUSIC_DIR +elif [ -f "$1" ]; then + echo "Build file" + $MKDRUMCOMMAND $MKDRUMOPTIONS "$1" +elif [ -d "$1" ]; then + echo "Build files in directory" + another_dir "$1" +fi diff --git a/bwwtolily/README.md b/bwwtolily/README.md new file mode 100644 index 0000000..6a51a5e --- /dev/null +++ b/bwwtolily/README.md @@ -0,0 +1,17 @@ +bwwtolily will attempt to convert a .bww or .bmw file to a lilypond +(http://lilypond.org) parsable file. Not all of the embellishments +get converted properly, this is espessially true with piobaireachd, +and the program will list the embellishments that were not converted. + +If you recognize an embellishment that isn't being parsed, please +send an email regarding the embellishment to jezra@jezra.net and I +will try to add the embellishment to the application. + +usage: +>bwwtolily -i /path/to/a/bww/file + +optionally, using the "-l" flag will try to run lilypond on the +created .ly file +example: +>bwwtolily -i /path/to/bww/file -l + diff --git a/bwwtolily/bwwtolily.py b/bwwtolily/bwwtolily.py new file mode 100644 index 0000000..ae235d5 --- /dev/null +++ b/bwwtolily/bwwtolily.py @@ -0,0 +1,391 @@ +#!/usr/bin/env python +# +#bwwtolily: will convert a bww file to a lilypond file +#copyright: 2008 Jezra Lickter +#GPL v3 + +from optparse import OptionParser +import sys,os,re,subprocess + +version = "0.4.2" + +#make a print function to handle various version of python +def do_print(string): + try: + eval("print "+string) + except: + print(string) + +#define the class that will convert a bww file to a lilypond file +class bwwtolily : + def __init__(self,addmidi=False): + self.tune_elements = [] + self.most_recent_note = 0 + self.in_note_group=False + self.slur_tie_pending = False + self.last_group_close=0 + '''compile a few regex queries''' + #make a regex to determine if something is a lilypond note + self.regex_lilynote= re.compile("[abcdefgAG][0-9]*") + #try to determine the time signature + self.sig_regex = re.compile("([0-9])_([0-9])") + #a regex to find notes + self.regex_note_info=re.compile("(?P[A-Z]+)(?P[a-z]*)_(?P