Hi,
I’ve been trying to get a stable timing system to use to trigger musical transitions between one piece of music and another. Obviously these transitions need to be accurately timed - but I am finding this impossible at the moment.
Basically what I need is a reliable and consistent ‘metronome’ so that I can trigger different musical events on defined beat points.
I’ve tried setting up a looping retriggerable delay node which then triggers a music cue, but the timing of the delay loops are off so there are inconsistent gaps between the musical events.
My next step was to build a blueprint system using the event tick node and the deltatime value to calculate the timing intervals, but I’m getting widely inconsistent timings between ticks (this is based on a custom Kismet object that I created in UDK that works fairly reliably).
Just in case I’m doing something wrong, here’s a description of my tick-based system along with screenshots…
When the system is activated it stores the current time using the Get Real Time Seconds node and uses a pre-defined bpm value to calculate the various different beat division intervals (ie. 120bpm = 2bps = 500ms for a 1/4 beat, 250ms for a 1/8 beat, etc…), and then calculates what the time point for each of these intervals. So, if the current time is 5.385secs and the beat interval time for a 1/4 beat is 500ms, the next time point for a 1/4 beat is 5.885secs (5.385 + 0.5). Then every tick the system checks the Get Real Time Seconds node and compares this to the ‘ideal’ beat time. If the actual time falls within a window (half the deltatime) of the ‘ideal’ time then an event is fired off to trigger the musical event and the next ‘ideal’ beat time is calculated. So, if the deltatime is 0.03secs and the ‘ideal’ time for a 1/4 beat is 5.885secs then an ‘actual’ time of 5.885+/- 0.015 would trigger an event.
Even if the ticks were consistent, the likelihood is that the ‘actual’ (accurate) time point of a musical cue might be inbetween ticks and so using a frame-based timing system is going to be problematic as we are very sensitive to timing issues within music.
Does anyone have any suggestions on how to get either a reliable and consistent timing system within UE4, or more ideally how to use the sample accurate timings from the audio soundcard through the creation of a custom C++ based object/actor.