Giter VIP home page Giter VIP logo

midiutil's Issues

Fix to TypeError in comparison function

What steps will reproduce the problem?
1. Try to add many beats to track by addNote will generate this error:

"midiutil\MidiFile.py", line 619
    self.MIDIEventList.sort(lambda x, y: int( 1000 * (x.time - y.time)))
TypeError: comparison function must return int, not long

2. May be only Win7 issue?
3. Ive fixed it changing line 619 (and 385 and 411 for thet matter):

self.MIDIEventList.sort(lambda x, y: cmp(x.time*1000 , y.time*1000))

What is the expected output? What do you see instead?
Not to see the error, with the fix above no more problems encoutered

What version of the product are you using? On what operating system?
Version 0.89

Please provide any additional information below.
Thanks for sharing your excellent work!

Original issue reported on code.google.com by [email protected] on 2 Sep 2014 at 4:21

MIDIHeader struct.pack() error

Hi,

I'm using Python 3, and there's an issue with the use of struct.pack() in 
MIDIHeader. Any help would be greatly appreciated. Thanks!

---

Traceback (most recent call last):
  File "I:/pm/start.py", line 299, in <module>
    pm = PerpetualMotion()
  File "I:/pm/start.py", line 98, in __init__
    self.score = MIDIFile(9)
  File "I:\pm\midiutil\MidiFile3.py", line 695, in __init__
    self.header = MIDIHeader(numTracks)
  File "I:\pm\midiutil\MidiFile3.py", line 649, in __init__
    self.headerString = struct.pack('cccc','M','T','h','d')
struct.error: char format requires a bytes object of length 1

Original issue reported on code.google.com by mikestopcontinues on 7 Sep 2013 at 3:44

Python 3: even your simple example doesn't work

What steps will reproduce the problem?
1. Install your code
2. copy your example into a file
3. run it

What is the expected output? What do you see instead?
Traceback (most recent call last):
  File "miditest.py", line 7, in <module>
    MyMIDI = MIDIFile(1)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/midiutil/MidiFile3.py", line 695, in __init__
    self.header = MIDIHeader(numTracks)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/midiutil/MidiFile3.py", line 649, in __init__
    self.headerString = struct.pack('cccc','M','T','h','d')
struct.error: char format requires a bytes object of length 1


What version of the product are you using? On what operating system?
Current version, OSX ML




Original issue reported on code.google.com by [email protected] on 5 Oct 2013 at 12:21

can't add 14-bit controller events

The documentation would make it seem like you can specify any number for 
"param1" in midi.addControllerEvent.

Attempting to add a controller event with paramValue > 255 results in the 
following error:

File "/Library/Python/2.7/site-packages/midiutil/MidiFile.py", line 540, in 
writeEventsToStream
    self.MIDIdata = self.MIDIdata + struct.pack('>B',event.paramerter1)
struct.error: ubyte format requires 0 <= number <= 255

Would be great if we could either extend the lib to support 14-bit messages 
like Pan and Pitch-Wheel. Or maybe there's another way to specify these 
messages and I'm missing something ...

Original issue reported on code.google.com by [email protected] on 14 Dec 2013 at 5:04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.