First note problem

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.
Post Reply
nnxion
Synthesia Donor
Posts: 43

Post by nnxion »

Hi Nicholas,

I just wanted to ask you if Synthesia sends some kind of reset or some kind of command right before playing the first note?
I get this kind of funky sound on the first note, even when 'rewinding'. It doesn't happen for any other not after, it's not very crucial either but it sounds kind of bad. Maybe you could have a short period between that command and the first note. Maybe playing a rest note? I don't know. Anyway just wanted to let you know for the next version.
Nicholas
Posts: 13135

Post by Nicholas »

Yeah, that's sort of a known issue, although, I think it slipped through the cracks because I don't see it on my list.

You may notice when it happens the first note is usually piano (regardless of what instrument the track is supposed to be). Piano is the default instrument for a channel that hasn't told the audio driver what it's supposed to be.

It's a MIDI event ordering issue. In the file, the "change this channel to use instrument X" message is sandwiched together just before the "play the first note" message. By allowing you to play along interactively and give you a small window before (and after) to hit the note yourself, the user-generated "play the first note" might happen before the in-the-file "change instrument" message happens.

Another place this can happen is in the middle of a song when a channel switches from one instrument to another.

(A little MIDI background: "tracks" are just conveniences for song authors and they can have as many tracks as they like. They're stored in MIDI files, but when those messages finally get down to the hardware level, there is no such thing as a "track" and they're all funneled into the sound card the same way. The way you get more than one instrument playing at the same time is by using "channels". Sound cards have (a rather limiting) 16 channels to work with. Channels are what you set properties on like volume, instrument, pitch bend, etc. Each message in a track can use a different channel, but the usual convention is that every message in track 1 will use channel 1 exclusively, track 2 uses channel 2, etc. But, you can imagine that in a song with more than 16 tracks, there must be some channel reuse.)

That channel reuse is where the problem comes in. There is nothing stopping a channel from switching between instruments each note. (Even instantaneously, for example, 4 messages sandwiched together scheduled to fire at the same time: "use Piano", "play C#", "use clarinet", "play F".)

In those cases, I'm pretty sure there is a way to still have user-played notes always sound correct, but it is a very tricky problem to work out all the little cases and decide which instrument change messages should be delayed and which should be sent out early.

The "first note in the song" case is the simplest form of that problem, so I can tackle it pretty easily. (I just have to pre-send out each tracks messages as soon as possible until I reach the first "play a note" message, and then wait for user input.) Correcting for all the other cases will have to wait until I've really gotten a chance to think about the problem and test various solutions.

In either case, I just added the "first note" problem to my bug list. It'll be in the next release. Bugs are always fixed before new features are added. (I added the bigger problem too, but I'm calling it more of an investigation than a bug.)

Thanks for the report, I'd forgotten about that one.
nnxion
Synthesia Donor
Posts: 43

Post by nnxion »

Nicholas wrote:but it is a very tricky problem to work out all the little cases and decide which instrument change messages should be delayed and which should be sent out early.

The "first note in the song" case is the simplest form of that problem, so I can tackle it pretty easily. (I just have to pre-send out each tracks messages as soon as possible until I reach the first "play a note" message, and then wait for user input.) Correcting for all the other cases will have to wait until I've really gotten a chance to think about the problem and test various solutions.
Uhmm I thought that you actually had your own storing procedure, so that you could do whatever with all the 'channels' and just order them in a non-MIDI way, but just the way you liked it. I mean your program going through the MIDI file and storing the messages that are in there in a way that makes more sense, so switching instruments on a channel would not be a problem, since you might already have more channels added (your program allows for any number of channels you want).

I hope you understand what I mean.
Nicholas
Posts: 13135

Post by Nicholas »

Yeah, I guess you're right that I can sort of act like I have an unlimited number of "virtual" channels. To some extent, when I'm loading files up, I do break apart tracks and even spread instruments that share channels between other channels that aren't being used to alleviate the problem as best I can.

I suppose the stuff I was mentioning was part of that (still incomplete) process. MIDI has a lot of little details (that sometimes act differently on different combinations of hardware and software) so it's hard to pin down what can be done while still preserving the intended sound.
Post Reply