Cabbage Logo
Back to Cabbage Site

Why doesn't this work. I'm trying to do something based on whether it is the nth beat, but it does not update unless playing from the beat

Trying to make a simple ducker plugin. I have a UDO that checks whether or not it’s the first beat of a bar, to prevent misalignment in cases where I want to play from somewhere in the project other than the first beat. Now this updates when I’m hitting play from the first beat. however when I hit play from somewhere other than the first beat it doesn’t update correctly. I have no clue why. Maybe I’m overthinking it? Is there an easier way?

duck.csd (2.6 KB)

Just mentioning that I made an edit in case someone saw this before the edit. Added wrong file first time.

I suppose it doesn’t update often enough? Anyways here’s a solution.

duck.csd (2.6 KB)

This will only work for 120 bpm, I’m way too tired to bother with the math right now. but the idea works.

edit: forgot to take out a rudely named slider I used for testing purposes :rofl:

You’re on the right path. Using a UDO with ksmps set to 1 is the key. :+1:

Is " TIME_IN_SAMPLES" able to update at a rate? It doesn’t work even when ksmps is set to 1.

This is a tricky one. TIME_IN_SAMPLES will only ever be updated on each process block. So if your host is using a buffer of 64 samples, it will be updated on every 64 samples. With a SR of 44100, this means it updates every 1ms or so. With ksmps set to 1, you should check if time has passed a particular point rather than look for a specific time. What I mean is something like if TIME_IN_SAMPLES > 1, rather than if TIME_IN_SAMPLES == 1. Does this make sense? I"m not sure I’m explaining it well :grimacing:

Clever, I got it to work!

duck.csd (2.7 KB)

1 Like