-# find transposition of C-major scale that belongs here.
def interpret_finale_key_sig (finale_id):
+ """
+find the transposition of C-major scale that belongs here.
+
+we are not going to insert the correct major/minor, we only want to
+have the correct number of accidentals
+"""
+
p = (0,0)
- if 0 <= finale_id < 7:
- while finale_id > 0:
+
+
+ bank_number = finale_id >> 8
+ accidental_bits = finale_id & 0xff
+
+ if 0 <= accidental_bits < 7:
+ while accidental_bits > 0:
p = transpose (p, (4,0)) # a fifth up
- finale_id = finale_id - 1
- elif 248 < finale_id <= 255:
- while finale_id < 256:
+ accidental_bits = accidental_bits - 1
+ elif 248 < accidental_bits <= 255:
+ while accidental_bits < 256:
p = transpose (p, (3,0))
- finale_id = finale_id + 1
-
+ accidental_bits = accidental_bits + 1
+
p = (p[0] % 7, p[1])
+
return p
# should cache this.
if not cs or not ce:
raise IndexError
- cs.note_suffix = '(' + cs.note_suffix
- ce.note_prefix = ce.note_prefix + ')'
+ cs.note_suffix = '-(' + cs.note_suffix
+ ce.note_suffix = ce.note_suffix + '-)'
+
except IndexError:
sys.stderr.write ("""\nHuh? Slur no %d between (%d,%d), with %d notes""" % (self.number, startnote, endnote, len (chords)))
def __init__ (self, number):
self.timesig = ''
self.number = number
- self.keysignature = None
+ self.key_signature = None
self.scale = None
self.force_break = 0
def set_timesig (self, finale):
(beats, fdur) = finale
(log, dots) = EDU_to_duration (fdur)
+
+ if dots == 1:
+ beats = beats * 3
+ log = log * 2
+ dots = 0
+
if dots <> 0:
- sys.stderr.write ("\nHuh? Beat duration has a dot? (EDU Duration = %d)" % fdur)
+ sys.stderr.write ("\nHuh? Beat duration has dots? (EDU Duration = %d)" % fdur)
self.timesig = (beats, log)
def length (self):
return self.timesig
- def set_keysig (self, finale):
+ def set_key_sig (self, finale):
k = interpret_finale_key_sig (finale)
- self.keysignature = k
+ self.key_signature = k
self.scale = find_scale (k)
def set_flags (self,flag1, flag2):
e = ''
if g:
- if last_key <> g.keysignature:
- e = e + "\\key %s \\major " % lily_notename (g.keysignature)
- last_key = g.keysignature
+ if last_key <> g.key_signature:
+ pitch= g.key_signature
+ e = e + "\\key %s \\major " % (lily_notename (pitch))
+
+ last_key = g.key_signature
if last_time <> g.timesig :
e = e + "\\time %d/%d " % g.timesig
last_time = g.timesig
if rest:
nn = rest
- s = s + '%s%d%s' % (nn, self.duration[0], '.'* self.duration[1])
+ s = s + nn
if not self.pitches:
- s = 'r%d%s' % (self.duration[0] , '.'* self.duration[1])
- s = self.note_prefix + s + self.note_suffix
+ s = 'r'
if len (self.pitches) > 1:
- s = '<%s>' % s
+ s = '<< %s >>' % s
+
+ s = s + '%d%s' % (self.duration[0], '.'* self.duration[1])
+ s = self.note_prefix + s + self.note_suffix
s = self.chord_prefix + s + self.chord_suffix
+
return s
measno = indices[0]
keynum = contents[1]
meas =self. get_global_measure (measno)
- meas.set_keysig (keynum)
+
+ meas.set_key_sig (keynum)
beats = contents[2]
beatlen = contents[3]
sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version))
def help ():
- sys.stdout.write("""Usage: etf2ly [OPTION]... ETF-FILE
+ sys.stdout.write("""Usage: etf2ly [OPTIONS]... ETF-FILE
Convert ETF to LilyPond.
Options:
- -h,--help this help
- -o,--output=FILE set output filename to FILE
- -v,--version version information
+ -h, --help print this help
+ -o, --output=FILE set output filename to FILE
+ -v, --version show version information
Enigma Transport Format is a format used by Coda Music Technology's
Finale product. This program will convert a subset of ETF to a
ready-to-use lilypond file.
-Report bugs to bug-lilypond@gnu.org
+Report bugs to bug-lilypond@gnu.org.
+
+Written by Han-Wen Nienhuys <hanwen@cs.uu.nl>.
-Written by Han-Wen Nienhuys <hanwen@cs.uu.nl>
""")
def print_version ():
and you are welcome to change it and/or distribute copies of it under
certain conditions. Invoke as `midi2ly --warranty' for more information.
-Copyright (c) 2000 by Han-Wen Nienhuys <hanwen@cs.uu.nl>
+Copyright (c) 2000--2003 by Han-Wen Nienhuys <hanwen@cs.uu.nl>
""" % version)