accraze / python-twelve-tone

:notes: 12-tone matrix to generate dodecaphonic melodies :notes:
https://pypi.python.org/pypi/twelve-tone
BSD 2-Clause "Simplified" License
71 stars 5 forks source link

Event pitches should be integers #19

Closed javipus closed 4 years ago

javipus commented 4 years ago

Running

from twelve_tone.composer import Composer
c = Composer()
c.compose()
c.save_to_midi()

throws error: required argument is not an integer.

This happens because miditime saves pitch info using struct.pack('>B',event.pitch), which requires the second argument to be an integer. Therefore, the problem is fixed by casting numbers in c.matrix to int.

Environment info:

accraze commented 4 years ago

Thanks for the bug report @javipus! I just confirmed the error happens for me as well on macOS. I will push up a patch shortly. Cheers!