Measuring the number of samples between two points in a Logic Pro project

I have split off this new topic from:

So, @noisneil, here is an outline of how I would approach this.

Before running the macro:

  1. Open the Project Settings for the current project and make sure that “Use musical grid” is set “off”. This is to make sure that we will have the right format in the marker list.
  2. Save the project. This first version of the macro would clear all the project’s markers and you might want to be able to return to them easily.
  3. Select the desired range with the marquee tool.

The macro would do this:

  1. Select the “Open Marker List” menu item.
  2. Select all, delete and then close the window.
  3. Select the menu item ‘Create Marker for Region/Marquee Selection’.
  4. Select all (just one item!) and copy.
  5. The clipboard now contains the start time (ending in three digits after the decimal point—those are the samples, right?), the text “Marker 1” and the length of the sample, so use search regular expression to extract the start time and the length into variables.
  6. Mathematics!

Does that seem worth a try, or provide any inspiration?

I'm off to watch Chelsea vs Aston Villa now, but will get stuck into this when I get back. Thanks!

1 Like

:confused: Consults notes. Chelsea? You’re havin' a laugh, aintcha?

1 Like

Ha! My missus is the Chelsea fan. I'm just there to do my Partridge impression.

Managed to squeeze in a quick peak at Logic before I have to leave, and realised I'm an idiot!

All I have to do is select a region and double-click it to separate it and show the Audio File Editor. The length in samples is right there.

Then all I have to do is close that pane and undo the marquee cut. Doing this programatically doesn't seem worth it, due to Logic's AppleScript pernicketiness. I know what you're thinking; I could open the Audio File Editor window, right? Well, oddly enough, the sample length field is often blank there. No idea why!

So I appreciate the effort, and I'm sure it will be very helpful for other use-cases, but I think this little workaround will do the job for me without having to deal with Markers etc.

Cheers!

1 Like

Gooooooooal! That’s liquid Logic.

I was, by the way, surely wrong when I wrote:

Those are milliseconds, aren’t they.

1 Like