-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Midi Import hang #1971
Comments
Could you provide a midi file for which this problem occurs? That would
|
Unfortunately, it is not possible to attach a midi file. But most of the files that you can download from the link below will hang (e.g. Twenty_4_Seven-Take_Me_Away.mid) on win XP. |
Importing drums has improved a bit in master, but there are probably files where it still sucks badly. |
sometimes it help to convert the problem file to 'midi1' |
Looks like the example file has so short notes in the drum track that LMMS rounds them down to 0 ticks and ignores them. I'm thinking a simple addition of Didn't get a hang on Linux with master branch, but the window did go dark while importing, which might be related to the hang, e.g. LMMS not responding to some OS message or whatever. |
I've had this problem too. Sometimes, if you're luck, you just have to wait 3 o 4 minutes. But most of the times it will stop responding forever. Tried on Win7 64bit |
Sounds like we aren't calling qApp->processEvents() regularly during the
|
And the import really is awfully slow. I compared Rosegarden (3 seconds) and LMMS (25 seconds) opening the file mentioned above. After some poking around I believe most of the time (~18 seconds in my test or some 70-ish %) is spent in this if clause: https://github.com/LMMS/lmms/blob/master/plugins/MidiImport/MidiImport.cpp#L435. Even if there is a huge number of pitch bends or something in that file, I think it's worth a closer look. |
I did some profiling with Valgrind and it turns out that there are two main causes for the slow import of the aforementioned MIDI file (
If you comment out the aforementioned calls the import just flies. The calls to |
@michaelgregorius, see softrabbit@1e29da4 for my thoughts on |
@michaelgregorius That's very useful info - thanks for sharing it here. I don't know enough about the internals of LMMS to answer the DetuningHelper question, but all I can say is to be careful when using Valgrind as a profiler. On top of executing each instruction, it does a whole host of dependency tracking (in order to catch uses of uninitialized variables) and such for every instruction. This means that because of the overhead, an integer division might take only 3% longer than an integer add, vs 300% longer when run outside of valgrind. Similar issues occur with its heap allocator, which results in new/delete operations taking much longer than they typically would in normal execution. So it's quite possible that the two bottlenecks you mentioned could be anomalies that only become significant under valgrind and not in regular use. I'd recommend an alternative, but my experience with profiling is fairly minimal beyond that. |
FYI, in regards to the MIDI files.... for uploading files, it looks like GitHub will have a storage solution very soon.... https://github.com/early_access/large_file_storage/ Thought it was slightly on-topic in regards to hosting some of these files. :) |
@Wallacoloo I think Valgrind was pretty accurate in this case. Here is what I did in my profiler run using a release build:
After the analysis of the results I then commented out the calls to The way I understand it Valgrind simulates the CPU (instructions) and should therefore know exactly which instructions are executed and what cost are associated with each instruction. However, I don't what exact models they use, i.e. whether they model the different microprocessor architectures, etc. Does anyone know a good free stochastic profiler by the way? These usually don't have that much impact on the execution time and performance but still provide a good picture of what's happening. |
I just want to drop in some help as well. An example of a MIDI file I used to be able to open just fine, but now can't, as per all that's been discussed so far, is the Koopa Cape MIDI on this page http://www.vgmusic.com/music/console/nintendo/wii/ (check under Mario Kart Wii). Oh, and while importing, LMMS reports quite a lot of "Volume / Model is already connected to this pattern." warnings on the bottom-left. |
@Espyo Do you mean that the Koopa Cape MIDI file just opens slowly or that you cannot open it at all? Just asking because on my local master build the file is imported successfully. Again if I comment out the call to I assume that the current implementation of If the message should be kept for interactive cases (and my assumption is correct in the first place) there are two ways I can think of to handle the problem:
I would prefer the first solution because it keeps the usage of |
@michaelgregorius Sorry, should've been more detailed. Yeah, that MIDI is one of the cases where it slowly imports, and then hangs on the 66% mark. |
@Espyo No problem. :) The problem with the failing import should be fixed in master. |
@michaelgregorius, ok to close? |
@tresf I guess it should be OK to close the issue. I have create two new issues which cover the performance problems. |
👍 |
In version 1.1.3 (win32) the import of larger midi files hangs always at 66%.
In version 1.0.0 (win32) the import does not hang but the drum channels are not imported.
Does a workaround exist (for example converting midi files to a lmms project file with an external tool)?
The text was updated successfully, but these errors were encountered: