# the default placement for text in abc is above the staff.
# %%LY now supported.
# \breve and \longa supported.
-
+# M:none doesn't crash lily.
+
# Limitations
#
# Multiple tunes in single file not supported
#TODO:
+#
+# Convert to new chord styles.
+#
# UNDEF -> None
-
+#
program_name = 'abc2ly'
ks = hdr.keys ()
ks.sort ()
for k in ks:
+ hdr[k] = re.sub('"', '\\"', hdr[k])
outf.write ('\t%s = "%s"\n'% (k,hdr[k]))
outf.write ('}')
array2=string.split(array[1],'=')
denominator=array2[0]
perminute=array2[1]
- duration=str(string.atof(denominator)/string.atoi(numerator))
+ duration=str(string.atoi(denominator)/string.atoi(numerator))
midi_specs=string.join(["\\tempo", duration, "=", perminute])
else:
sys.stderr.write("abc2ly: Warning, unable to parse Q specification: %s\n" % a)
if re.match ('\([2-9]', str):
dig = str[1]
str = str[2:]
- state.parsing_tuplet = string.atoi (dig[0])
-
+ prev_tuplet_state = state.parsing_tuplet
+ state.parsing_tuplet = string.atoi (dig[0])
+ if prev_tuplet_state:
+ voices_append ("}")
voices_append ("\\times %s {" % tup_lookup[dig])
return str
a = re.sub('[ \t]*$','', a) #strip trailing blanks
if header.has_key('title'):
if a:
- header['title'] = header['title'] + '\\\\\\\\' + a
+ if len(header['title']):
+ header['title'] = header['title'] + '\\\\\\\\' + a
+ else:
+ header['subtitle'] = a
else:
header['title'] = a
if g == 'M': # Meter
set_default_len_from_time_sig (a)
else:
length_specified = 0
- voices_append ('\\time %s' % a)
+ if not a == 'none':
+ voices_append ('\\time %s' % a)
state.next_bar = ''
if g == 'K': # KEY
a = check_clef(a)
if base == 1:
if (multiply_tup[0] / multiply_tup[1]) == 2:
base = '\\breve'
+ if (multiply_tup[0] / multiply_tup[1]) == 3:
+ base = '\\breve'
+ dots = 1
if (multiply_tup[0] / multiply_tup[1]) == 4:
base = '\longa'
return '%s%s' % ( base, '.'* dots)
(str, num,den,current_dots) = parse_duration (str, parser_state)
-
if re.match('[ \t]*\)', str):
str = string.lstrip (str)
str = str[1:]
- if slur_end:
- voices_append ('%s' % ')' *slur_end )
-
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 not parser_state.parsing_tuplet:
voices_append ("}")
if slur_begin:
- voices_append ('%s' % '(' * slur_begin )
+ voices_append ('-(' * slur_begin )
+ if slur_end:
+ voices_append ('-)' *slur_end )
+
return str
This program converts ABC music files (see
http://www.gre.ac.uk/~c.walshaw/abc2mtex/abc.txt) To LilyPond input.
+
+
+Report bugs to bug-lilypond@gnu.org
+
+Written by Han-Wen Nienhuys <hanwen@cs.uu.nl>, Laura Conrad
+<lconrad@laymusic.org>, Roy Rankin <Roy.Rankin@@alcatel.com.au>
"""
def print_version ():