Setting a delay to the MIDI Output?

Started by elPatrixF, November 17, 2013, 05:31:52

Previous topic - Next topic

elPatrixF

I'm using the MIDI Input/Output plugin, setting a Casio piano connected via USB as the output for one of the instruments, just for the sake of hearing one of the instruments of the song in the actual thing while having the rest of the instruments being played normally from software.

To my surprise, the piano was out of sync, playing the notes just a little bit earlier than it should. I guess It has something to do with the fact that logically the piano gets the midi information first and plays it instantly, before openmpt gets to process the sound of everything and play it or something like that... or the latency-

Anyways, I know that I could partially fix this problem by pushing one row forward all the channels where the piano is used, so that every piano note would be played right after the next row is reached, thus getting an almost perfect sync; but that would mean editing ALL the patterns, potentially losing the last row of the piano part in every time that I push a whole column forward. Too much of a job for something that I'm doing just for personal fun  ::)

So the question is, is there a simple way of intentionally delaying this midi output so that it plays in sync with the rest of the music? Or do you know of any VST plugin that lets me do so with a MIDI output?


EDIT: Just in case, the solution is here!
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!

Diamond

This pack of MIDI plugins
http://code.google.com/p/pizmidi/downloads/list
has a plugin called midiDelay which might do what you are looking for.

LPChip

It could work. Do you have ASIO on your soundcard? If not, download ASIO4ALL and use that. This allows you to lower the latency. A really low latency should fix the problem. In practice, the piano might still play earlier than the rest, but the timing difference should be so little that it is barely to not noticable.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Saga Musix

In fact, you no longer need ASIO4All - just use the WDM-KS driver in the latest OpenMPT versions - this will give you just the same low-latency output as ASIO4All. WASAPI could also be sufficient as well. ASIO4All is no longer the go-to choice for low-latency audio in OpenMPT, because it requires additional software to be installed, while WDM-KS and WASAPI are always available.
Having a low latency of about 10ms or less is essential for both MIDI input and output.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

elPatrixF

I actually don't want to reduce the latency of openMPT (My netbook isn't powerful enough and trying to get even below 120ms of latency would just slow down the whole thing) but rather "increase the latency" on the piano so that it goes in sync with the music.
Basically, I want to forcibly make the piano lag behind so that it matches the latency of the sound card.

I've been toying around with the midiDelay.dll from here ( https://code.google.com/p/pizmidi/downloads/list ) but I still can't figure out how to make it work.

I've already routed the output of this plugin to the MIDI Input/Output (It shows as "Input -> FX01: midiDelay" in FX04: MIDI Input/Output) but I still can't hear a thing.

Do you know of any other alternative plugin that might work better? Like an "Advanced midi output VST" or something like that?
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!

Saga Musix

Just look at the plugin's parameters, it should be clear that it doesn't do what you want. A delay plugin with a "feedback" parameter is clearly an audio delay.
Have you actually tried using WDM-KS drivers in OpenMPT? If you haven't, you should give them a try, since it's not possible to achieve a low latency with DSound/Waveout anyway, so if you have been using those before, it's only natural that they didn't work at a lower latency.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

elPatrixF

Quote from: Saga Musix on November 17, 2013, 20:25:13
Just look at the plugin's parameters, it should be clear that it doesn't do what you want. A delay plugin with a "feedback" parameter is clearly an audio delay.
Have you actually tried using WDM-KS drivers in OpenMPT? If you haven't, you should give them a try, since it's not possible to achieve a low latency with DSound/Waveout anyway, so if you have been using those before, it's only natural that they didn't work at a lower latency.
Yeah, I was thinking that from the start but I was hoping that it would be bypassed or something...
But how would using WDM-KS drivers help me delay the piano?

I know I haven't tried it them yet but I think that all that this would do is just reduce the latency from the sound card, and I wouldn't want to do that since I'm well aware that I cannot get a lower latency without getting a HUGE slowdown, and I'm actually seeking to increase the latency of the midi output (Or whatever it is called, I'm not very familiar with these terms :/ ).

Am I missing a point somewhere? *~*
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!

Saga Musix

The point is that you should be able to get low-latency audio with WDM-KS, which is not possible with e.g. WaveOut or DirectSound. It should even help on a netbook, but of course I don't know how much, so it's up to you to try it out.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

elPatrixF

Quote from: Saga Musix on November 17, 2013, 21:29:07
The point is that you should be able to get low-latency audio with WDM-KS, which is not possible with e.g. WaveOut or DirectSound. It should even help on a netbook, but of course I don't know how much, so it's up to you to try it out.
Yyeah- but that's not what I'm looking for! *3*
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!

LPChip

You may not have a choice.

Midi is like a programming language, and because it is designed to be as fast as possible and everyone normally want that, I doubt you'll find a plugin that will temporarily store the midi messages and transmit them (aka delay) later.

If your piano's audio goes back into your pc, you might be able to capture that, and delay that part from being played. Or rather, if it is being routed to OpenMPT, it might actually use the same audio delay as the buffer, so it is in sync again.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Saga Musix

QuoteMidi is like a programming language, and because it is designed to be as fast as possible and everyone normally want that, I doubt you'll find a plugin that will temporarily store the midi messages and transmit them (aka delay) later.
Err, what kind of nonsense is this? I'm pretty sure there is such a plugin among the hundreds of MIDI plugins, and it would even be possible to implement this into OpenMPT's own plugin. Manx is currently experimenting with the latency-related code, so we might see some results on that soon. But until then, please try using low-latency WDM-KS drivers.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

elPatrixF

#11
No, the piano plays on its own; if it was routed back to openmpt there would probably be no problem at all with the latency ::)

*sigh* I guess right now the best option is to just manually push all the piano parts one row forward so that it syncs perfectly.
Either that or trying with the WDM-KS or ASIO drivers to reduce the latency to a minimum, but then again the slowdown is almost unbearable <w<

Anyways, I'll keep searching, there has to be an obscure way of delaying the midi output; like, simulating a midi buffer or something like that--- there has to be at least ONE plugin that does that in an elegant way!
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!

manx

I modified the midi plugin so that it does latency-compensated midi output. Could you please try if http://manx.datengang.de/openmpt/temp/midiplugin-r3255-latency-v1.zip works better for you?
Please note that, although it tries to accurately compensate for the total sound output latency, it currently cannot accurately send out midi if you are using OpenMPT with a too big update interval setting, i.e. your midi output will have jitter of that duration.
For your netbook setup, I would recommend using a waveout device with your 120ms latency setting. For now, you should try setting update interval as low as you can to avoid midi jitter. There is currently a trade-off of CPU usage and midi jitter for you.
This is fixable but requires a bunch of related bug fixing in OpenMPT. It will propably happen in the somewhat near future but not as a quick fix right now.

elPatrixF

It works like a charm! Tried it out setting different latency values in the setup screen and it all goes in sync!
Thanks! :D
Check out https://soundcloud.com/elpatrixf/ or http://www.youtube.com/elpatrixf for more music!
Thanks for listening!