Cueing sounds in a non-quantized way with Quartz

Hello all,

in the Quartz docs (Quartz Overview | Unreal Engine Documentation), you can read: “Instead of rendering a sound at the beginning of an audio buffer, Quartz cues the sound to play on the desired musical value (bars or beats) or time value (seconds), independent of the buffer size, game-thread timing, or other sources of variable latency.”.

This seems to imply that there is a way to cue a sound using Quartz in a non-quantized way, at a time in seconds from a specific quantize marker (e.g. 2.5 sec from the next bar or beat). Is that possible?

An obvious solution would be to use Play instead of PlayQuantized on an AudioComponent, but that wouldn’t cue the sound in seconds from a precise quantize marker, which is what I need.

Here’s one way I think should work. I put together a quick test BP:

I’m using the “On Tick” Quartz quantization boundary, and setting the boundary multiplier to the result of the time delay (2.5 seconds in your example) divided by the output of Get Seconds Per Tick of the Quartz clock.

This seems to work but I don’t have an easy way to make sure it is sample-accurate. I think it’s at least a step in the right direction. Hope it helps! :sparkles:

2 Likes

Thanks a ton for your reply ! Yes, using Quartz ticks is probably the closest substitute to a continuous (float) delay based on a quantized marker. At least, it is predictable.

Actually, the reason why I’m looking for a continuous delay instead of discrete one is that I’m trying to use Quartz to produce audible heartbeats (kind of a ‘bip-bop’ sound) as two consecutive but separate sounds (‘bip’ followed by ‘bop’). What I’m trying to achieve is to always cue the first sound (‘bip’) at the beginning of a bar, and the second one (‘bop’) at a variable delay after that, depending on the number of bpm . For example, in a 4/4 bar at 60 bpm, ‘bip’ would play on beat 1 and ‘bop’ on beat 2, followed by 2 silent beats (bip-bop-silent-silent). But at say 120 bpm, ‘bip’ would still play on beat 1, but ‘bop’ would play closer to the middle of the bar, around beat 3 (bip-silent-bop-silent). Sadly, this is not as simple as adjusting the number of bpm.

In the screenshot below, I’m using a 1-beat bar, and keyboard keys (PageUp and PageDown) to adjust directly the delay in ticks for cueing the second sound. In that context, at 60 bpm, Quartz only has 8 ticks per second to offer, which seems rather limited. This leads to noticeable jumps when moving ‘bop’ from tick 3 (one-fourth of the bar) to tick 5 (middle of the bar). This is where a continuous delay would prove really useful.

Any other solution I’ve come up with was depending on the number of FPS, which is not acceptable considering the regularity of heartbeats. Maybe I’m overlooking some Quartz functionalities?

Oh! In that case I think the easiest method would be to implement the delay in the heartbeat’s MetaSound.

The MetaSound would have both bip-bop sounds in it. The bip would play immediately on play, and then you can play the bop after adding a delay, the length of which you can modify using a float input for BPM.

This way you are only scheduling one sound to play using Quartz, and MetaSounds handles the rest.

1 Like

ebuch, thanks so much for your suggestion, it does work! I had never looked into MetaSound before, so little did I know it had trigger delay functionalities that could be coupled with Quartz! Here is the result where the delay for the second “beep” can be controlled by pressing PageUp and PageDown:

Again, thanks so much for your help, very much appreciated! Hope this will help others struggling with the same kind of issues.

1 Like

Excellent, glad I could help!