Skip to content

mxm, IT's mad science

Sections
Personal tools
You are here: Home » Products » Open Source » Python Midi Package » Problem with flats in Key Signature
Downloads
You can download mxm products here.

Due to it's technical and international nature, this section is in english.

Max M Has a blog too.

og er glad for mad

 

Comment

Above in this comment thread: Python Midi Package

Problem with flats in Key Signature

Posted by Anonymous User at 2007-02-20 07:40 PM
Hi,

I'm having a problem with your module: when I add a negative value as the first argument to midi.key_signature(), to indicate flats, it gives me this:

File "./xml2midi.py", line 131, in xml2midi
midi.key_signature(-3,0)
File "midi/MidiOutFile.py", line 381, in key_signature
self.meta_slice(KEY_SIGNATURE, fromBytes([sf, mi]))
File "midi/DataTypeConverters.py", line 143, in fromBytes
return pack('%sB' % len(value), *value)
File "/usr/lib/python2.5/struct.py", line 63, in pack
return o.pack(*args)
struct.error: ubyte format requires 0 <= number <= 255

Is this a bug, or am I doing something wrong?

Thanks, for any help and for the otherwise great module!

solution

Posted by Anonymous User at 2007-02-20 08:39 PM
Ok, it's solved when I do (sharpsFlats+256)%256. But isn't that supposed to be done inside the module?