Esempio n. 1
0
 def key_signature_event(self, key="C"):
     """Return the bytes for a key signature event."""
     if key.islower():
         val = minor_keys.index(key) - 7
         mode = b"\x01"
     else:
         val = major_keys.index(key) - 7
         mode = b"\x00"
     if val < 0:
         val = 256 + val
     key = a2b_hex("%02x" % val)
     return self.delta_time + META_EVENT + KEY_SIGNATURE + b"\x02" + key + mode
Esempio n. 2
0
 def key_signature_event(self, key='C'):
     """Return the bytes for a key signature event."""
     if key.islower():
         val = minor_keys.index(key) - 7
         mode = '\x01'
     else:
         val = major_keys.index(key) - 7
         mode = '\x00'
     if val < 0:
         val = 256 + val
     key = a2b_hex('%02x' % val)
     return '{0}{1}{2}\x02{3}{4}'.format(self.delta_time, META_EVENT,
                                         KEY_SIGNATURE, key, mode)
Esempio n. 3
0
 def key_signature_event(self, key='C'):
     """Return the bytes for a key signature event."""
     if str(key).islower():
         val = minor_keys.index(key) - 7
         mode = b'\x01'
     else:
         val = major_keys.index(key) - 7
         mode = b'\x00'
     if val < 0:
         val = 256 + val
     key = a2b_hex('%02x' % val)
     return self.delta_time + META_EVENT + KEY_SIGNATURE + b'\x02' + key\
          + mode
Esempio n. 4
0
 def key_signature_event(self, key='C'):
     """Return the bytes for a key signature event."""
     if key[0].islower():
         val = minor_keys.index(key) - 7
         mode = '\x01'
     else:
         val = major_keys.index(key) - 7
         mode = '\x00'
     if val < 0:
         val = 256 + val
     key = a2b_hex('%02x' % val)
     return '{0}{1}{2}\x02{3}{4}'.format(self.delta_time, META_EVENT,
             KEY_SIGNATURE, key, mode)