Bar counter display

Hey,

I’d like to achieve a display that shows how many bars are in the beat counter, up to 4, 8 or 16 then reset back to 1. this would be for a visual helper when you play your music to know in what bar count you actually are.

The input value I’m getting from bitwig with the address /beat/str is like 000.0.0:00
standing for measures.quarters.eights:ticks

I would like to be able to treat this data, but I’ve no idea how to exactly…
Maybe something like to count every 4 beat to increase a bar variable and display it, then reset back to 1 when it reached 4, 8 or 16.

Any starting point to get this going would be great !

hi, you will need a custom module. i think using osc listeners is the best approach here. You will find various examples on the forum.
(parse them in the infilter function)

Hi @le_barde,
You can achieve that either with a custom module or using the advanced syntaxes. In both case you’ll rely on the Javascript syntax to parse the timestamp and extract the relevant information.
Here is how it’d look like using the advanced syntaxe: create a text widget and set its value property as follows:

JS{{

var timestamp = OSC{/beat/str} || "000.0.0:00"
var measures = timestamp.split(".")[0]
var cycle = 4

return (measures % cycle) // maybe + 1 here if you want to display 1, 2, 3, 4 instead of 0, 1, 2, 3
 
}}

Doc links:

Thanks for your help guys… Very nice !
My coding skills are a bit rusted but I’ll get that working.

I’m sorry for my beginner’s questions…
Checking the advanced syntax page doesn’t tell me where I should put the JS code you were kind enough to write for me.
Should I use a text indicator widget for this and put the JS code in the value/script parameter ? That’s what I tried but I feel I’m doing all wrong :stuck_out_tongue: Well it didn’t give me any result.

Got it !
Goes in the value box.

Works like a charm ! It would have taken me much time to achieve this by myself, thanks a lot !!
:pray: :pray:

Coolio, works perfect, me happy… Just made this little modification otherwise the count would display 0 instead of 4 (or 0 instead of 16 in my case). The bar count starts at 1 already, so didn’t need to make the +1… but the last bar would display 0.

JS{{

var timestamp = OSC{/beat/str} || “000.0.0:00”
var measures = timestamp.split(".")[0]
var cycle = 16
var barcount = (measures % cycle)
if (barcount == 0) {barcount = 16}
return barcount // maybe + 1 here if you want to display 1, 2, 3, 4 instead of 0, 1, 2, 3

}}

Blockquote

Glad you made it work !