OSC message from ardour when playhead reaches marker position

Hi!
Is it possible to send OSC message from ardour when playhead reaches marker position?
Lua scripting maybe?

Sending OSC is not realtime safe, so the best you can currently do is periodically check if Ardour played through a marker.

An example Lua script to do so: https://gist.github.com/x42/5099bbd0a104b4ccc265301bad280172

Save the the file to ~/.config/ardour5/scripts/ – or alternatively paste it into use Window > Scripting, and save it there.
Then load the script using Edit > Lua Scripts > Script Manager > Action Hooks.

The OSC code itself does not have this particular facility, it does allow sending position as time, timecode, beat/bar, or sample and the receiving code could then look for a position in this way. I do not know if position markers (or positions) give off a signal that internal code or an LUA script could watch for. So an LUA script might find itself doing the same thing anyway, watching the position as part of a loop and sending the OSC message when it was there or slightly past. Markers are a part of the GUI rather than the Ardour’s audio machine. The GUI uses those markers to tell the audio machine to do something at a position or between two positions.

OSC is like a second UI and could have it’s own markers in different places than the GUI, though it is possible also through menu actions for OSC to set GUI markers and have them show up in both places.

Someone will probably correct me on this :slight_smile: I know what OSC can do quite well, I know that LUA can send an OSC message and that LUA can access the same bits that OSC can. I am not so sure exactly what that dividing line is (it is a moving target after all).

I was a few seconds too late, x42’s answer is more exact. It sends a message for all markers as they are past.

Wow! x42, big thanks for this!