Geromatic / Midi-Unreal

Midi for Unreal Engine
129 stars 31 forks source link

How to play drum roll properly? #5

Open stani opened 7 years ago

stani commented 7 years ago

Drum roll or any other case of very short notes. For example, with MPQN of 454545 and resolution of 120, note can be as short as about 3 millisec, which is way shorter than the unreal tick (time per frame). As consequence, successive notes are processed at the same time. As a result my drum roll have "holes": instead of tatatatatatatatatatata it does tatata...ta..tata...tatata.

I don't know how sendMidiMessage() works. Is there a way to say "play the note after a delay"?

Geromatic commented 7 years ago

I am considering creating a separate thread for the midi playback. Also can you test in Windows Media Player to see if same effect.

stani commented 7 years ago

In Windows media player drumroll is playing correctly. As I see it, the problem comes from the frequency of the Unreal tick, which is not only too long, but also variable and unpredictable (FPS drop etc). I can imagine only two ways to do it: run midi processor in a separate thread or pre-fetch upcoming events and somehow send them to midi output with a delay. But I don't know if any of those are feasible.

Geromatic commented 7 years ago

I added a option to have a separate thread so FPS drop wont be affected

echolevel commented 7 years ago

Hi @Geromatic - where is this option and how can I enable it? I'm struggling to get MIDI to run in time. Thanks!

Geromatic commented 6 years ago

there is a option [enabled by default] on the start node to allow background processing..it is located in the Midi Processor Component

echolevel commented 6 years ago

Thanks @Geromatic, but I can't see this in 4.17 after updating Midi Asset to FileVersion 3, VersionName 2.46. The start node doesn't show any options and the processor component has nothing background-related in its settings. Have I updated correctly?

Cheers!