Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not enough values on to_TimeSignatureEvent #7

Closed
SaschaVanEssen opened this issue Jul 22, 2020 · 3 comments
Closed

Not enough values on to_TimeSignatureEvent #7

SaschaVanEssen opened this issue Jul 22, 2020 · 3 comments

Comments

@SaschaVanEssen
Copy link

SaschaVanEssen commented Jul 22, 2020

Hello and thank you for this great library! I am using it to do some processing on midi files, but I am having an issue with the TimeSignature of certain midi files.

Making a csv csv_string = py_midicsv.midi_to_csv(source) gives me the line 1, 0, Time_signature, 4, 2. Then when I try to parse it back to midi (without any processing) midi = py_midicsv.csv_to_midi(csv_string) I get the following error:

File ".../py_midicsv/csvmidi.py", line 46, in parse
    event = csv_to_midi_map[identifier](tr, time, identifier, line[3:])
File ".../py_midicsv/csv_converters.py", line 142, in to_TimeSignatureEvent
    num, denom, click, notesq = map(int, line)
ValueError: not enough values to unpack (expected 4, got 2)

Is this a known issue and how can I prevent it?

@timwedde
Copy link
Owner

Hm yes, that does indeed appear to be a bug. Would you be able to supply the exact file that you used when you encountered this error? I would like to reproduce this on my end as faithfully as possible.

@SaschaVanEssen
Copy link
Author

I saved a few files here: https://www.dropbox.com/sh/zybjyos8g4dlddn/AABx6Raie4jzwWoIljFA9Hz3a?dl=0
Please check them out and let me know if there's anything else you need.

@timwedde
Copy link
Owner

timwedde commented Jul 23, 2020

Alright, seems like there was an issue with some MIDI files containing the full TimeSignature spec that I expected. We're now adding default values if they don't exist, fixing this issue. I'll prepare a new release shortly.

Edit: New release 1.11.0 is up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants