Is it possible to print the name of a locator as the playhead passes by in max?

atmosonic's icon

Hello,

I'm working with video in Ableton. I'm setting locators in specific places where something important occurs in the video. I'm also naming the locators related to the occurrence in the video (i.e: explosion, gun fight, leaps off building). Is there a way in Max to retrieve each locators name as the playhead passes over the locator and pass that information to the "print" function so that it appears in the Max Window?

Thanks for your help,
k

kyle@moontechstudios.com
www.moontechstudios.com
kjohnson@neversoft.com
www.neversoft.com

Bjorn Vayner's icon

I don't think you can access the locator info.
You may want to look into the [timepoint] object. They're essentially locators for the Max transport, which in M4L is locked to Live's transport.
Probably a lot easier than any API method could offer.

xanadu's icon

Locators in the Arrangement view of Live are in the Live Object Model as cue_points. They form the array at the path 'live_set cue_points'. The properties are 'name' and 'time'. I think it should be possible to collect the time-and-name pairs, order them by time and theck when the time of the next cue_point is passed. At that time some action should be taken.

Cue_points can be observed, but I don't think they will report when song-time passes them.

Bjorn Vayner's icon

Ah yes. Xanadu is right.
RTFLOM to me ;)

That will actually be a very handy device. Nice idea Kyle!

atmosonic's icon

Hi guys, thanks for your help. I'm going to try your suggestions next but I have a feeling the "observe" function will work to do what I need it to do. So far I've only been able to get the Marker/Locator/Cue Point name via a button push or a number selector. Unfortunately, being new to Max I am unsure how to build an array of locators, but i'm gonna give it a shot. Here is a link to a screenshot of what I have so far (just incase the file doesn't come through):

Thx for your help.
k

342.CaptureLocators.jpg
jpg
xanadu's icon

I like this challenge!

Max Patch
Copy patch and select New From Clipboard in Max.

This pather will print all cue_points of the song and their beats.

The live.observer only observates changes in the name or the position of the cue_points, so we have to check the playhead (in beats) against the time of the cue_points.

For me it's bed time now (living in Holland).

I hope I will get some progress on sorting and matching beats tomorrow. For me this is quite easy in Javascript, but I want to do this thing in Max/MSP/Jitter only.

atmosonic's icon

Xanadu,

Thanks for your help. I can't thank you enough. As a test I have placed two locators as such:

CuePoint0: "Marker 01" @ 3.875
CuePoint1: "Marker 02" @ 8

I have created this little function to return the playhead location info:

Max Patch
Copy patch and select New From Clipboard in Max.

I'd like to use your pather to store all of the CuePoint names and locations (as you have already supplied) into an array as soon as the play button is pressed then maybe I can build upon my object to cross reference the array by timestamp/beat. If it finds a marker in the array at that same beat then have it print the name of the CuePoint to the Max window.

Thanks again for your help,
k

xanadu's icon

Hi Kyle,

Max Patch
Copy patch and select New From Clipboard in Max.

Your songtimer does not repond to loops. Perhaps there are no loops when synchronizing with video. I came up with this timer some time ago.

Tomorrow I'll try to couple this patcher with the cue_points and get a signal when songtime passes a cue_point.

xanadu's icon

I RTFM, but did not find any sorting function in Max or MSP. Which is not very surprising because you don't need it for th ekind of tasks these languages are designed for. I think I do have to use javascript after all.

There are 3 scenarios (I know of) to respond to songtime passing a cue_point.
1. Call a javascript function on every beat, part of a beat or tick. Then report any cue_point between the last call and this one. When the cue-points are ordered the lookup of relevant cue_points can be quite cpu-friendly.
2. Javascript is capable of creating the wiring of a Max patcher on the fly. One can create a comparator of the cue_point time and songtime, for every cue_point. When the output changes from before to after the cue_point, a message with the name of the cue_point is sent. When there are many cue_points this will use some cpu.
3. The scenario of 2 can also be realised with MSP components. Signaling songtime passing a cue_point will become sample precise, at the cost of cpu usage.

I think scenario 3 is overkill for movie synchronization, but for some other application it can be the right way to go.

atmosonic's icon

Heya Xanadu,

Here's what I have so far. With the help of a friend I was able to cross reference a collection and now the patcher spits out a match. We ran into an issue when we found that the Pack didn't like to have a floating point variable as the first parameter but we got around that and now...voila.

Max Patch
Copy patch and select New From Clipboard in Max.

This is only the tip of the iceberg, though. The next step I have to resolve is to be able to name the markers with specific shorthands texts that will visit a Lua dictionary, be converted into Lua syntax and then be passed onto a 3rd party AU as Lua script. It's gonna be rough, but I'm positive it can be done.

k

xanadu's icon

Hello Kyle,

Max Patch
Copy patch and select New From Clipboard in Max.

It's working now. Thanks for showing how a coll object cab be used for deecting the collisions. I's put the code into a patcher, so it can be reused in several songs. Here's the code.

atmosonic's icon

Xanadu,

Wow, thanks so much, this is awesome. I love the name too; "Cue Point Detector". In an earlier post you wrote; "Your songtimer does not repond to loops. Perhaps there are no loops when synchronizing with video. I came up with this timer some time ago". I didn't envision the need for looping when I originally thought about creating this patcher, but I make sense to include that kind of functionality just incase someone using the tool has a need for it. I was wondering if you would mind if I added your looping functionality to the Cue Point Detector. Also, if you don't mind, send me an email with your info to kyle at moontechstudios dot com. I'd like to credit you once the object is complete.

thx,
k

xanadu's icon

Hi Kyle,

Thanks for your kind words.

The patcher in my previous post is already responding to loops. I envision to use this device to automate playing parts of songs by sending the cue_point names to a route patcher and then triggering scenes or take other actions. An e-mail was send to you.

DRKOSS's icon

Thanks to both of you for posting - very helpful in steering me in the right direction on a project i am working on.

cheers and if you are ever in NYC - beers on me.

shane

nilzie's icon

Yep - just want to chime in - great work, Xanadu and Atmosonic, thanks for sharing!