Running Tasks via Multiple Application Pipelines

Man, the usability of Youlean Loudness Meter 2 as an app fails to impress...

The fact it doesn't support drag and drop from the Finder onto the Finder-icon or the Dock icon is something I'd take up with the dev.

You can't use open from the shell either...

1 Like

Bounce and Process Audio File.kmmacros (2.1 KB)

So my first post to the forum was dealing with this same task I'm trying to accomplish but a saw no way to use the recommended "Share" option when posting while targeting an already existing post. Apologies.

I've taken a stab at this and have began a macro trigger that monitors a folder for audio files created in the directory. I selected to ignore partial or changing files but I think I should probably change it to ignore partial files only so the trigger doesn't engage until writing to the audio file has completed.

Next I selected the action to open an application. So far looks good but the next step I need to happen is a drag of the audio file to the opened app and I don't see a drag/drop action.

How might I do that?

Actually you might not need to drag and drop. I don't have that app, but maybe you can open the file via its path, using the %TriggerValue% token...?

Bounce and Process Audio File.kmmacros (20 KB)

Macro screenshot

If that's not an option, you can try using the menu system to open the file:

Bounce and Process Audio File.kmmacros (24 KB)

Macro screenshot

I downloaded the free demo version for this, so I don't know if things work differently in the pro version. Hopefully it will give you an idea though.

Thanks for this! I'd already considered opening the file via the app as you'd initially suggested but unfortunately the targeted app won't open audio files. But I'll get that one a shot to see what happens.

Your 2nd macro I follow until it gets to the Type Keystroke step and below. I don't fully understand what those steps are supposed to be doing though I can make out a couple of them.

I'll try both and see where things go. Thanks!

  • ⇧⌘G opens the Go To... file navigation pop-over window.
  • We use this to navigate to the file you're trying to open by literally typing in its path, stored as a %TriggerValue% and then hitting ↵.
  • Lastly, we hit the Open button to load the file into YouLean.

Ah okay. I get that. Well that said and with the noted inability of the app to actually open the audio file; gets me a few steps closer but since it appears there is no actual drag/drop capability in KM.... I'll still have to figure some alternative method of getting this to work end to end.

I know recording a macro isn't ideal per comments from my previous post but I think that would be the only option I have. Which really isn't very intuitive for this type of task b/c it seems to only work if the source and target items and windows are unchanged being based off x/y co-ordinates.

Been looking into Hazel as well but seems it lacks the ability to assess a completed file from one being written. :face_with_diagonal_mouth:

Can you open a file from YouLean's menu system? If you can, you can automate it with KM. That's what my second idea attempts to do.

There absolutely is, but it's what I'd call a 'brute force' method, and wouldn't be my first port of call. We can get to that if the menu idea is a non-starter.

Hazel will work, but you'll still have to solve how to open the file once you have its path.

Don't worry, this is all doable.

So your macro appears to work up until opening YLM but for some reason the File -> Analyze File operation never fires. Also noted that even if I manually open that menu the next condition of the "Open button" being enabled won't happen until navigation to the actual file and its selection is made.

Any suggestions?

Btw, I also acknowledged and enabled safe execution via KM popup for imported macros

Is YouLean selected in the Pause Until action?
Also check the Menu action. I set it up to reference the free version so I'm not sure if it needs adjustment.

Try changing it to "exists" rather than "enabled".

Yes. But I did try changing to "exists" which appears to have fixed the problem. So now any time a new file is dropped in the folder it launches YLM, opens the file analyze and loads the file correctly.

There are still a couple of steps I'd like to figure out how to accomplish but this is definitely a very good start.

I don't suppose there is a way to read the values on specific areas of the YLM UI and run additional macros based on the values is there? Or any UI for that matter.

My initial thought was to export the readings and then run a script that would execute additional steps based on if then else.... but the YLM app only exports graphical content in PDF, PNG and etc. Reading through the forum it appears there is a way to extract content from a PDF file but it seems creating a macro for that type of task is a bit more advanced than I'm ready to tackle w/o being more familiar with the basics.

Did you change the pause action to "is running"?

"Is at the front" will likely be more reliable.

Yes, there is but it's not straightforward unless you have UI Browser.

What is it you want to do to the files?

I did change it trying to figure out why the open dialog wouldn't pop but I changed it back to "Is at the front".

The YLM produces these readings on the UI which I'm most interested in. The INTEGRATED and AVG. DYNAMICS (PLR) values are my targets. In this screenshot they're within the target I need. So I'd want to evalute the numbers -16.0 LUFS and 14.2 LU and given this example I'd want to move the files to another location for permanent storage otherwise they'd be deleted from the processing folder.

Screen Shot 2023-04-12 at 4.06.00 PM

I looked at the UI Browser option but I think its more money than I'd be willing to spend when I have no other applicable use cases to justify the investment.

"Not straightforward" suggesting it as a bit complicated I'd imagine?

It can be done and I'd be happy to do it for you, but unfortunately I don't have the pro version of the app, so I can't even analyse a file, which makes it hard for me to test.

There are other ways beside UI Browser to figure out the AppleScript requirements, but they're certainly more longwinded. Are you au fait with AS or would you need someone to help you with it?

If you have more than one licence, you could loan me one while I figure it out for you and then take me off when I'm done. Just a thought.

I am a developer but AS isn't a language I'm very familiar with and I have too much on my plate right now to take on the venture :slightly_smiling_face:

Please check your PM's though.

1 Like

I'll have a go in the morning. :+1:t3:

Does the Excel (actually CSV) export format not give you the information you need to calculate your own target values?

You would think so but no. It gives point in time readings, oddly not the final LUFS and LU readings shown within the UI. For the screenshot I'd previously provided, here is the CSV output.

Transport Time,System Time,Momentary Loudness,Short Term Loudness,Dynamic Range,True Peak,
00:00:00,18:44:32,-11.04,-12.20,17.68,-2.02,
00:01:00,18:45:32,-10.63,-12.34,12.84,-2.43,
00:02:00,18:46:32,-10.10,-11.88,14.58,-1.84,
00:03:00,18:47:32,-13.56,-14.16,15.18,-1.77,
00:04:00,18:48:32,-12.89,-14.55,16.62,-3.30,
00:05:00,18:49:32,-23.80,-22.38,15.17,-21.16,

Similiarly the other available outputs output an image file.

It does -- you can derive LUFS and LU from those point readings. I had a quick look at ITU-R BS.1770-4 and the algorithm on MathWorks, but really don't have the domain knowledge to make sense of them.

You might be able to get the values from the PDF export, without resorting to OCR. From the demo version and with a quick ⌘A-Copy and Paste into BBEdit you can see the values are split -- but if they are consistently split you should be able to extract them. I've commented out the non-relevant lines:

Summary

Relevant part of PDF as screen shot:

Text extracted:

-- DEMO DEMO DEMO DEMO DEM
-- 0 -3 -6 -9
-- -18
-- -23
-- -27 -36 -45 -54
-- 24 21 18 15 12
-- 9 6 3
-- 0
-- 3 6 9
-- 12 15
-- INTEGRATED
--  Youlean Loudness Meter Export
-- DEMO DEMO DEMO DEMO DEM
-- LU
-- DEMO DEMO DEMO DEMO DEM
-- 0s 1s 3s 4s 6s 7s 9s 10s 11s 13s 14s 16s 17s 19s 20s 21s 23s 24s 26s 27s 29s
-- DEMO DEMO DEMO DEMO DEM
2.3 18ODEODE -- first word of this line is second part of INTEGRATED
-- DEM
-- MO
-- DEM
-- MO
-- DEM
-- 21 24
-4 -- first part of INTEGRATED
2 -- first part of LOUDNESS
17.6 -- PLR
- -- first part of SHORT TERM
0.6 -- second part of LOUDNESS
-- LOUDNESS RANGE AVERAGE DYNAMICS (PLR) MOMENTARY MAX SHORT TERM MAX TRUE PEAK MAX
-3 -- first part of MOMENTARY
-24.7 -- TRUE PEAK
3.8 -- second part of MOMENTARY
42.4 -- SHORT TERM
-- Created With - Youlean Loudness Meter v2.4.4
-- DR

You'll do better if you use a proper PDF->text converter -- for example, the last few lines text from https://www.convertpdftotext.net are:

                -42.3                  20.6                          17.6                       -33.8                       -42.4                              -24.7
            INTEGRATED             LOUDNESS RANGE          AVERAGE DYNAMICS (PLR)           MOMENTARY MAX               SHORT TERM MAX                      TRUE PEAK MAX


                                                                                                                                      Created With - Youlean Loudness Meter v2.4.4

...and it should be relatively easy to parse out what you want. And as a developer you may already have pdftotext installed, eg via Homebrew's poppler formula.

If @Nige_S' suggestion is workable, it sounds like it might be neater.

However, I'd already done this before I saw that suggestion and it reliably returns the two values you're after, ready for conditional processing:

Bounce and Process Audio File.kmmacros (48 KB)

Macro screenshot

It uses THIS SHORTCUT to make use of Apple's native OCR (far superior to KM's own).

1 Like

Yours is probably better, since you've got reliable results from the OCR -- it avoids having to UI-script the export and messing around with temp files.

1 Like