- mud = ''
-
- slur_begin =0
- if not str:
- return str
-
- articulation =''
- acc = UNDEF
- if str[0] in '^=_':
- c = str[0]
- str = str[1:]
- if c == '^':
- acc = 1
- if c == '=':
- acc = 0
- if c == '_':
- acc = -1
-
- octave = parser_state.base_octave
- if str[0] in "ABCDEFG":
- str = string.lower (str[0]) + str[1:]
- octave = octave - 1
-
-
- notename = 0
- if str[0] in "abcdefg":
- notename = (ord(str[0]) - ord('a') + 5)%7
- str = str[1:]
- else:
- return str # failed; not a note!
-
-
- __main__.lyric_idx = -1
-
- if parser_state.next_bar:
- voices_append(parser_state.next_bar)
- parser_state.next_bar = ''
-
- while str[0] == ',':
- octave = octave - 1
- str = str[1:]
- while str[0] == '\'':
- octave = octave + 1
- str = str[1:]
-
- (str, num,den,current_dots) = parse_duration (str, parser_state)
-
-
- if re.match('[ \t]*\)', str):
- str = string.lstrip (str)
-
- slur_end =0
- while str[:1] ==')':
- slur_end = slur_end + 1
- str = str[1:]
-
-
- if slur_end:
- voices_append ('%s' % ')' *slur_end )
-
- bar_acc = get_bar_acc(notename, octave, parser_state)
- pit = pitch_to_mudela_name(notename, acc, bar_acc, global_key[notename])
- oct = octave_to_mudela_quotes (octave)
- if acc != UNDEF and (acc == global_key[notename] or acc == bar_acc):
- mod='!'
- else:
- mod = ''
- voices_append ("%s%s%s%s" %
- (pit, oct, mod,
- duration_to_mudela_duration ((num,den), default_len, current_dots)))
-
- set_bar_acc(notename, octave, acc, parser_state)
- if parser_state.next_articulation:
- articulation = articulation + parser_state.next_articulation
- parser_state.next_articulation = ''
-
- voices_append (articulation)
-
- if parser_state.parsing_tuplet:
- parser_state.parsing_tuplet = parser_state.parsing_tuplet - 1
- if not parser_state.parsing_tuplet:
- voices_append ("}")
- if slur_begin:
- voices_append ('%s' % '(' * slur_begin )
-
-
- return str
-
-def junk_space (str):
- while str and str[0] in '\t\n ':
- str = str[1:]
-
- return str
+ mud = ''
+
+ slur_begin =0
+ if not str:
+ return str
+
+ articulation =''
+ acc = UNDEF
+ if str[0] in '^=_':
+ c = str[0]
+ str = str[1:]
+ if c == '^':
+ acc = 1
+ if c == '=':
+ acc = 0
+ if c == '_':
+ acc = -1
+
+ octave = parser_state.base_octave
+ if str[0] in "ABCDEFG":
+ str = string.lower (str[0]) + str[1:]
+ octave = octave - 1
+
+
+ notename = 0
+ if str[0] in "abcdefg":
+ notename = (ord(str[0]) - ord('a') + 5)%7
+ str = str[1:]
+ else:
+ return str # failed; not a note!
+
+
+ __main__.lyric_idx = -1
+
+ if parser_state.next_bar:
+ voices_append(parser_state.next_bar)
+ parser_state.next_bar = ''
+
+ while str[0] == ',':
+ octave = octave - 1
+ str = str[1:]
+ while str[0] == '\'':
+ octave = octave + 1
+ str = str[1:]
+
+ (str, num,den,current_dots) = parse_duration (str, parser_state)
+
+ if re.match('[ \t]*\)', str):
+ str = string.lstrip (str)
+
+ slur_end =0
+ while str[:1] ==')':
+ slur_end = slur_end + 1
+ str = str[1:]
+
+
+ bar_acc = get_bar_acc(notename, octave, parser_state)
+ pit = pitch_to_lilypond_name(notename, acc, bar_acc, global_key[notename])
+ oct = octave_to_lilypond_quotes (octave)
+ if acc != UNDEF and (acc == global_key[notename] or acc == bar_acc):
+ mod='!'
+ else:
+ mod = ''
+ voices_append ("%s%s%s%s" %
+ (pit, oct, mod,
+ duration_to_lilypond_duration ((num,den), default_len, current_dots)))
+
+ set_bar_acc(notename, octave, acc, parser_state)
+ if parser_state.next_articulation:
+ articulation = articulation + parser_state.next_articulation
+ parser_state.next_articulation = ''
+
+ voices_append (articulation)
+
+ if parser_state.parsing_tuplet:
+ parser_state.parsing_tuplet = parser_state.parsing_tuplet - 1
+ if not parser_state.parsing_tuplet:
+ voices_append ("}")
+ if slur_begin:
+ voices_append ('-(' * slur_begin )
+ if slur_end:
+ voices_append ('-)' *slur_end )
+
+ if global_options.beams and \
+ str[0] in '^=_ABCDEFGabcdefg' and \
+ not parser_state.parsing_beam and \
+ not parser_state.parsing_tuplet:
+ parser_state.parsing_beam = 1
+ voices_append_back( '[' )
+
+ return str
+
+def junk_space (str,state):
+ while str and str[0] in '\t\n\r ':
+ str = str[1:]
+ close_beam_state(state)
+
+ return str