[2.02.04] Quantization bug affected by time signature position


I’m having a weird issue where I put multi-instruments to play synced with the beat and for some reason some of them were not playing at the time, getting delayed and activated only in the next quantization sync.
Playing as it should:

Playing out of sync:

I investigated and discovered that the issue is caused when you have a time signature placed in the middle of the song. Please check the video demonstrating:

The bug is also happening in 2.01 where the original project is being made.


This is working as intended but it does need some clarification.

When you want an instrument to play on the xth bar, you place it on the timeline where you need it.

When you want an instrument to play every x bars, you add a quantization trigger condition to it,

So currently you are placing the instrument on every four bars as you wish for it to play on the fourth bar. But the quantization is telling it to play after four bars.

For this to work in the way you intend, please remove the quantization conditions from your instruments. We will look into how to clarify this behaviour in a future update to our documentation.

I don’t understand how your video demonstrate anything. It has no audio and shows the multi is immediately playing when the playhead goes through.

I might’ve not been clear. the first image is a multi-instrument placed on bar 29, it has quantization on for every four bars. The second image is another multi-instrument placed four bars later after the first one (bar 33) and it has the same kind of quantization.

You can notice that they are both marked to be async and the first image shows the multi-instrument being played when the time marker passes through it. The second multi-instrument at 33, however, doesn’t play when it’s activated (even if it’s marked to play every four bars, which seems to be the case).
You can look that the tiny white bar that shows when a multi-instrument is being played is at the very first beginning of the sample. What will happen in this case is that instrument will only start playing at bar 37.

Basically, what I’m trying to achieve is a way to tell which instruments will play accordingly with the game’s progress, synced with the main music. I’ve chosen asynced multi-instrument to be placed at the beginning of the bar because this way I could render wavs with reverb tails and not worry about the tail being cut after the next instrument plays. If I chose them to be synced, I’d need to have them extended and overlapping each other because of the tail.
I’m using quantization because if the progress parameter changes and the time bar isn’t exactly at the beginning of the bar, this would cause some desynchronization between the instrument and the main song.

Am I missing something?

@Alcibiade Here’s a video with sound, demonstrating what’s seems to be wrong:

My guess is that you think you’ve snapped the instrument on the beat:
but instead it’s snapped on another element slightly offset…

I thought that, but the problem doesn’t happen after I move the time signature to the beginning of the timeline, so it might be on the beat.

Did you check that point anyway by max zooming? It could be a bug l indeed.

I suspect that @Alcibiade is onto something but at a more miniscule factor. Floating point issues can cause things to appear to be “on the dot” when they are actually a tiny tiny amount off.

Select the instrument giving you trouble and open Window > Console and type this command:

inst = studio.window.editorCurrent();
inst.start = 33;

As mentioned, though, setting quantization is best used when triggering instruments in four bar intervals (eg. bar 1, 5, 9) whereas if you need it triggering on a beat then remove the quantization trigger and place it on the beat needed with async enabled.

1 Like

@richard_simms Hi, it seems that the console command gets a wrong output when I do this, even if I position the time signature at the beginning of the song. Check the gif:
fmod console bug

It looks like a bug to me! I hope that’s part of the problem of the multi-instruments doesn’t playing at the beat

Well, I certainly wasn’t expecting that. It seems having more than one tempo marker will cause unexpected behaviour with setting instruments via the console.

In the meantime, try to zoom in as close as possible like Alcibiade has suggested and make sure the instruments are on the line.

I’m already zooming in as close as I can and I’m pretty sure it’s on the grid.
fmod grid bug
Is there anything else I can do or test?

I’m noticing some tiny snapping to something else when you move those instruments around. Is there anything else on the other tracks that could be doing this?

Perhaps just for this one instrument you can set it to synchronous and see if that helps?

If this isn’t working still, are you able to send this event over to us to investigate further? Copy and paste this event into a blank project and send the project over.

I tried to move every other instrument in this bar to different places so it won’t snap, but unfortunately, the result is the same.
Setting it to synchronous didn’t make any difference to the instrument activation.

I’ll DM the project to you. Thanks for helping me!

This issue was due to a floating point error. When the graphical interface is rounding up/down floating points it can sometimes cause an instrument to be off the beat just so slightly enough to cause it to not trigger as expected.

The following script helped to move all instruments with conditions back slightly enough to allow them to trigger on the beat properly.

var event = studio.window.browserCurrent(); // Select the event in the Events browser first

// Gather all instrument types
var allSingleInst = studio.project.model.SingleSound.findInstances(event);
var allMultiInst = studio.project.model.MultiSound.findInstances(event);
var allScattererInst = studio.project.model.SoundScatterer.findInstances(event);

var allInstruments = [];

// Push all instruments with trigger conditions into an array
allSingleInst.forEach(function(inst) {
    if(inst.triggerConditions.length > 0) {

allMultiInst.forEach(function(inst) {
    if(inst.triggerConditions.length > 0) {

allScattererInst.forEach(function(inst) {
    if(inst.triggerConditions.length > 0) {

// Rounds down floating point to 2 decimal places
    inst.start = Math.floor(inst.start * 100) / 100; 
1 Like

Thank you so much! That solved the issue :slight_smile: