Note length

Trouble with Synthesia, your keyboard, or adapter? Think you found a bug?
When describing problems, always mention your OS and game version (shown at the bottom of the title screen).
  • If your keyboard has USB or MIDI ports, there is a tremendously high chance (>99%) it will work with Synthesia. See what you'll need on the keyboards page.
  • If you have a Logitech webcam and can't get your keyboard/adapter to work, see this post.
Post Reply
Posts: 321

Post by Pianotehead » 03-03-14 4:17 pm

Have any bugs occurred, with the length of some notes not being shown accurately? Was playing a MIDI with a simple arpeggio exercise, where three notes are shown as dotted quarter notes, but I'm pretty sure I entered them as eight notes. The dotted quarter notes are shown both in the sheet music display and the falling bars.

The strange thing is, it's always the same note, B below middle C, and always the last note of the measure. It happens in measures 14, 29 and 31, in the latest development version as well as in the public release. MIDI Sheet Music shows the same notes as dotted quarter notes, but Notation Composer shows them as eight notes. The MIDI file was made in Composer.

Will send you the MIDI file in a private message, as well as the corresponding MusicXML file, which is also generated in Composer.
(116.51 KiB) Downloaded 92 times
(2.04 KiB) Downloaded 124 times

Posts: 12401

Post by Nicholas » 03-03-14 6:03 pm

I can't speak to the MusicXML file (I haven't had a chance to build up a set of tools yet to inspect them), but Synthesia is correctly showing the duration of those three notes according to what's stored in the MIDI file. Here is some text output of the events near the end of measure 14:

Code: Select all

Time  Evt Chan Note
19920 On  ch=1 n=59
20160 On  ch=1 n=55
20393 Off ch=1 n=55
20400 On  ch=1 n=60
20633 Off ch=1 n=59
20633 Off ch=1 n=60
The B is note 59. (Middle C is always 60.)

So the first event is the B starting. After that we have an On/Off pair for the G, an On/Off pair for the C, and finally the B is turned off at the same time as the C.

There are 233 ticks between the On/Off for the G. The same 233 for the C. The time between the B's On and Off is ~3x as long at 713 ticks.

Posts: 321

Post by Pianotehead » 03-03-14 6:40 pm

Thank you Nicholas, then it must be a bug in Composer. I just ran the MusicXML through Notepad++ and it showed an eight note B in the measures I talked about, but then of course the file was created in Composer, probably just reproducing it's own errors. How did you view the MIDI events? Just curious, because it could be convenient to have a MIDI event viewer, if there is one free for download.

Posts: 12401

Post by Nicholas » 03-03-14 6:57 pm

There is an old bit of code running around the Internet that will convert a MIDI file into an "MTX" file (which is the text format that I just pasted in my response above). I think it might have originally been written for Tim Thompson's KeyKit. Anyway, I found a version of the code that someone else had wrapped into an installer that would add a right-click shortcut in Windows, which sounded very useful... except it didn't work. :lol: It was old'ish and the registry locations for the shortcuts in question have shimmied around a little over the years.

Long story short: I adopted the code, rebuilt it, and packaged it into a new installer that uses the correct registry keys (for Vista, 7, and 8 at least).

This is so not-supported it's not even funny, but if you're interested in trying out a weird tool I found someplace, go for it. ;)
(113.04 KiB) Downloaded 79 times
You can turn MIDI files into MTX with a right-click shortcut. And vice-versus: after editing the MTX, you can convert it back to a MIDI the same way. Just don't hold me responsible when your computer blows up. (I do know one of its limits is that it cannot open RIFF-wrapped MIDI files. You'll need a RIFF viewer to pull just the MIDI part out if you want to convert it to MTX. If Synthesia can play something that this tool can't convert, that's probably the reason.)

Even if it doesn't blow up your computer, the output does rely on knowing quite a bit about MIDI. For example, knowing that time "19920" was "near the end of measure 14" meant I had to know what the "480" in the very first line of the MTX file meant, and how that 480 interacted with the 6/8 time signature event a few lines below it. I actually have another small tool I wrote in C# that can interpret MTX lines to calculate where measures start/end given those values, which I used in this case.

Still, if you're feeling adventurous, this page is still the gold standard for understanding all that stuff. The spec and file format links there are what Synthesia's entire MIDI foundation is based on. That site took me from zero knowledge to about Synthesia 0.7.0 completely on its own!

An alternative: Midi File Disassembler. The output from this is a little friendlier (it shows measure/beat numbers and human-readable event types) and it even includes event filtering, but the installation is a little convoluted and it's got a few bugs in it. (One I've run into a few times: if a MIDI file's PPQN is very high, the pretty formatting cuts off the larger pulse numbers which means it cannot be reassembled anymore.) Still, it might be something worth checking out.

I would describe this second disassembler as "easy to use" while the MTX stuff is more "industrial strength", hehe.

Posts: 321

Post by Pianotehead » 03-03-14 9:20 pm

Thank you, looks like a long road, which I probably won't start going down! What matters is, that Composer can produce faulty MIDI files, though three notes is something I can easily watch out for, if I remember where they are.

Post Reply