mirror of
https://github.com/kastdeur/bwwtolily.git
synced 2024-12-05 01:13:31 +01:00
Parse note ties of the form '^t[abcdef]'
This commit is contained in:
parent
b29a4fd5d9
commit
b9bfeed838
1 changed files with 10 additions and 2 deletions
12
bwwtolily.py
12
bwwtolily.py
|
@ -52,6 +52,8 @@ class bwwtolily :
|
||||||
self.regex_strike = re.compile("str([h|l]*[abcdefg])")
|
self.regex_strike = re.compile("str([h|l]*[abcdefg])")
|
||||||
#a regex to find dots
|
#a regex to find dots
|
||||||
self.regex_dot = re.compile("'[h|l]*[abcdefg]")
|
self.regex_dot = re.compile("'[h|l]*[abcdefg]")
|
||||||
|
#a regex to find note ties
|
||||||
|
self.regex_tie = re.compile("\^t[h|l]?[abcdefg]")
|
||||||
#a regex to find sub repeats
|
#a regex to find sub repeats
|
||||||
self.regex_sub_repeat = re.compile("'([0-9]+)")
|
self.regex_sub_repeat = re.compile("'([0-9]+)")
|
||||||
#a regex to find note slurs, not slur embellishments
|
#a regex to find note slurs, not slur embellishments
|
||||||
|
@ -162,7 +164,7 @@ class bwwtolily :
|
||||||
self.transpose(element)
|
self.transpose(element)
|
||||||
|
|
||||||
def lilynote(self,bwwname):
|
def lilynote(self,bwwname):
|
||||||
#convert a bww notename to a lilypond notename
|
'''convert a bww notename to a lilypond notename'''
|
||||||
#make the notename lowercase
|
#make the notename lowercase
|
||||||
notename = bwwname.lower()
|
notename = bwwname.lower()
|
||||||
|
|
||||||
|
@ -179,7 +181,7 @@ class bwwtolily :
|
||||||
return lilynote
|
return lilynote
|
||||||
|
|
||||||
def transpose(self,element):
|
def transpose(self,element):
|
||||||
#receive a bww element and return a lilypond equivalent
|
'''receive a bww element and return a lilypond equivalent'''
|
||||||
|
|
||||||
#is the element a note?
|
#is the element a note?
|
||||||
note_result = self.regex_note_info.search(element)
|
note_result = self.regex_note_info.search(element)
|
||||||
|
@ -286,6 +288,12 @@ class bwwtolily :
|
||||||
self.tune_elements[self.most_recent_note]+="."
|
self.tune_elements[self.most_recent_note]+="."
|
||||||
return
|
return
|
||||||
|
|
||||||
|
#is the element a note tie
|
||||||
|
tie_result = self.regex_tie.search(element)
|
||||||
|
if tie_result:
|
||||||
|
self.tune_elements[self.most_recent_note]+="~"
|
||||||
|
return
|
||||||
|
|
||||||
#is the element a slur?
|
#is the element a slur?
|
||||||
slur_result = self.regex_slur.search(element)
|
slur_result = self.regex_slur.search(element)
|
||||||
if slur_result:
|
if slur_result:
|
||||||
|
|
Loading…
Reference in a new issue