I have a file I am running through my editor. It should be adding missing program changes and bank selects.
In the middle of one track, there is this:
[20659] 6220: 95 34 00 -- Note Off
[20663] 10050: b5 00 00 -- Bank Select MSB
[20667] 10080: 95 3b 41 -- Note On
and a little further on, still the same track
[21461] 17740: 95 34 00 -- Note Off
[21465] 21570: b5 00 00 -- Bank Select MSB
[21469] 21600: 95 3b 41 -- Note On
There is no program change anywhere in the remainder of the track.
My instrument detection code relies on either A) a defined program change, or B) a NOTE ON on a track that does not yet have a program change present. Since this track does indeed have a program change at the beginning of the track, it seems that I do not pick up these rouge Bank Selects. Because they have no following program change, they do nothing anyway, correct?
I'm wondering if I should try to get my editor to pick them up, or if I should just leave it as is since the original file had non-functionable bank selects in it to begin with.
The beginning of that track has this, just FYI. Before and after running through my editor.
[20018] MTrk:
[20027] 0: ff03 -- Sequence Name: Funk Guitar
[20042] 0: ff04 -- Instrument Name: & Muted Guitar
[20060] 0: b5 79 00 -- Reset All Controllers
[20064] 0: b5 5d 50 -- Effects 3 Depth
[20067] 0: b5 5b 7f -- Effects 1 Depth
[20070] 0: b5 07 64 -- Channel Volume MSB
[20073] 0: b5 00 08 -- Bank Select MSB
[20076] 0: c5 1c -- Program Change
[20080] 900: 95 34 55 -- Note On
[20038] MTrk:
[20047] 0: ff03 -- Sequence Name: Funk Guitar
[20062] 0: ff04 -- Instrument Name: & Muted Guitar
[20080] 0: b5 79 00 -- Reset All Controllers
[20084] 0: b5 5d 50 -- Effects 3 Depth
[20087] 0: b5 5b 7f -- Effects 1 Depth
[20090] 0: b5 07 64 -- Channel Volume MSB
[20093] 0: b5 00 08 -- Bank Select MSB
[20096] 0: b5 20 00 -- Bank Select LSB
[20100] 0: c5 1c -- Program Change
[20104] 900: 95 34 55 -- Note On
Jason,
Maybe the midi file you're testing has been used with other hardware that dis support bank selects, but has then been used with a setup that did not (or did less so) and bank selects were disabled but not completely.
However, yes, as you say, the bank select is not implemented until the Program Change command is supplied, so if there is no PC then the BS does nothing. Just for tidyness (and to avoid any confusion) if a PC command is removed then any associated BS commands should be removed as well - but maybe someone didn't know that?
Geoff
It's possible. I am testing with a bunch of files downloaded from random places on the internet. I have come across some real doozies that were either made with a bad piece of software, or were improperly edited at some point in their lifetime. One particular file has 1931 bank selects(!!!) (a random mixture of repeating MSBs and LSBs) and 509 program changes, most of which are grouped together in 3s or 4s setting the same instruments over and over on the same channels. Another had the entire file duplicated within itself, so it had 21 tracks, and then those same 21 tracks added to the end. Others, like ones I made using someone's video game music conversion app, are full of invalid values for a bunch of things (values > 127 for things like volume). I'm slowly weeding out the bad eggs, but leaving a few that I think might be useful for testing robustness of my editor.
Thanks for the idea π
I have added warnings about the unused Bank/RPN/NRPN in the latest version of https://github.com/jazz-soft/test-midi-files
Please check it out!
[quotePost id=10507]Thanks for the idea π
I have added warnings about the unused Bank/RPN/NRPN in the latest version of https://github.com/jazz-soft/test-midi-files
Please check it out![/quotePost]Haha! The first 913 lines of output for that particular file are
WARNING: offset xxxxx track x tick xxxxxx -- Obsolete Bank Select (bx x0 00 -- Bank Select xSB)
So maybe the other 1018 actually do something? π
I'm attaching the file, in case you want to look it over to verify :p
I guess I will need to suppress the output if there are too many warnings of the same type.
Wait for the next release π
[quotePost id=10569]I guess I will need to suppress the output if there are too many warnings of the same type.
Wait for the next release :)[/quotePost]No, actually, I think it's important to keep them. Otherwise I wouldn't know which ones were giving the error. I was just laughing that the file is soooo messed up that that is the output of the test. I actually think maybe there should be MORE things marked, because while most of the non-errored bank selects are then followed by a program change (thus TECHNICALLY valid), they are not actually changing anything because it's the same thing 4 or 5 times, like so:
[code type=markup]
[ 368] 13888: b1 20 00 -- Bank Select LSB
[ 372] 13888: b1 00 00 -- Bank Select MSB
[ 376] 13888: b1 20 00 -- Bank Select LSB
[ 380] 13888: c1 27 -- Program Change (Synth Bass 2)
[ 383] 13888: 91 24 5f -- Note On
[ 387] 14008: 81 24 40 -- Note Off
[ 392] 14688: 91 24 57 -- Note On
[ 396] 14748: 81 24 40 -- Note Off
[ 400] 14808: 91 24 5f -- Note On
[ 404] 14928: 81 24 40 -- Note Off
[ 408] 15048: 91 24 5f -- Note On
[ 413] 15208: 81 24 40 -- Note Off
[ 418] 15528: 91 24 5f -- Note On
[ 423] 15728: 81 24 40 -- Note Off
[ 427] 15728: b1 20 00 -- Bank Select LSB
[ 431] 15728: b1 00 00 -- Bank Select MSB
[ 435] 15728: b1 00 00 -- Bank Select MSB
[ 439] 15728: b1 20 00 -- Bank Select LSB
[ 443] 15728: c1 27 -- Program Change (Synth Bass 2)
[ 446] 15728: 91 1e 5f -- Note On
[ 450] 15748: 81 1e 40 -- Note Off
[ 454] 15748: b1 20 00 -- Bank Select LSB
[ 458] 15748: b1 00 00 -- Bank Select MSB
[ 462] 15748: b1 00 00 -- Bank Select MSB
[ 466] 15748: b1 20 00 -- Bank Select LSB
[ 470] 15748: c1 27 -- Program Change (Synth Bass 2)
[ 473] 15748: 91 26 5f -- Note On
[/code]
Clearly there's no point to ANY of those bank selects or program changes after 372, 376, and 380, as they are all just resetting what is already set. :p
Nobody is going to read thousand warnings.
Please check the latest version, the output looks like this:
WARNING: offset 296 track 2 tick 11928 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
WARNING: offset 300 track 2 tick 11928 -- Obsolete Bank Select (b1 00 00 -- Bank Select MSB)
WARNING: offset 368 track 2 tick 13888 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
WARNING: offset 427 track 2 tick 15728 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
WARNING: offset 431 track 2 tick 15728 -- Obsolete Bank Select (b1 00 00 -- Bank Select MSB)
WARNING: offset 454 track 2 tick 15748 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
WARNING: offset 458 track 2 tick 15748 -- Obsolete Bank Select (b1 00 00 -- Bank Select MSB)
WARNING: offset 516 track 2 tick 17548 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
WARNING: offset 520 track 2 tick 17548 -- Obsolete Bank Select (b1 00 00 -- Bank Select MSB)
WARNING: offset 535 track 2 tick 17668 -- Obsolete Bank Select (b1 20 00 -- Bank Select LSB)
and 903 more of "Obsolete Bank Select" ...
Question for native English speaker: is there a better word to use instead of "Obsolete"?
[quotePost id=10581]
Question for native English speaker: is there a better word to use instead of "Obsolete"?[/quotePost]
Unnecessary or redundant.
Thanks! Will change to "Unnecessary" in the next release...
Sema,
Maybe the more accurate word here would be superfluous.
I assume that the first instance of each message (regarding a specific BS/PC) would be retained, it's just the repeats of the same message that are not required.
Redundant would be more appropriate than unnecessary, but superfluous would be slightly more accurate?
Geoff
How about "Unused" ?
[quotePost id=10581]Nobody is going to read thousand warnings.
[/code]
I would. :p I'm actually using it to tell me exactly where problems are so I can (try to) fix them. If it just says "903 more" then I would continuously have to fix a few, re-run the test, fix a few more, rerun the test...
By having them all there, I can see that tracks 2, 6, 7, and 9 all have a pile of extra bank selects. If it didn't show them all, I wouldn't know about 6, 7, or 9 without manually scanning through to find them myself.
But that being said, I am NOT fixing this particular file. This is just a worst-case example. And I mean worst! π
I think "Unnecessary" gets the point across. It means "not needed".
"Redundant" means "repeated", which would not apply to a bank select that is not followed by a program change, as in my original post.
"Unused" doesn't really work, because technically they are used, they just don't do anything useful.