Extracting Data From an Audio File and Its File Name

Hello!

I'm a music producer and I have a ton of songs that I need to extract data from and upload into a sheet online that looks like this:

My problem is getting the bpm, duration, and song title into variables in KM.

Here are 3 random examples of my song titles: (they are long because my label requires me to name the files like this)

21 - Queen Of Quietude_Maximilian Dalla-Santa_77BPM_Stereo Out

Somber Luck_Maximilian Dalla-Santa_85BPM_Stereo Out

15 - Go To Sleep_MaximilianDallaSanta_76BPM_Stereo Out

Most of my songs start with a number like example 1 & 3, but some of them are like example 2 (starting straight with the song title.

This is what I've got so far. Basically I select my file in Finder and activate this macro:
Mini Extensions 1.kmmacros (15.6 KB)

It grabs the file name and displays it
I need to set the file name to a variable and then search that variable for keyword or strings or something.
I need the number before BPM. and the songtitle before my name Maximilian Dalla-Santa without the number.

Finder Selection -- Audio File Info v1.00.kmmacros (7.2 KB)

I found this macro online that displays all information of the audio file.
I want KM to set my red highlight as my duration variable.

2

I started with KM two months ago so I'm very much a beginner.

All help appreciated!

You can segment on the underscore character.

See the section on custom array delimiters in the Wiki page on using variables:

manual:Variables [Keyboard Maestro Wiki]

Segmenting on underscore.kmmacros (6.7 KB)

2 Likes

@ComplexPoint beat me to it. I went a similar route and included the track length in minutes and seconds.

Get Song Data.kmmacros (27 KB)

Macro screenshot

5 Likes

Wow thanks guys!

Neil your script is absolutely perfect! thank you so much.

2 Likes