Name transferred files based on a script

The built in naming scheme allows for building a quite diverse naming scheme. You can drop spaces from a field (:ns), remove vowels except from the start of words (:nv), and choose the field naming order, and priorities for truncation to fit within a certain length.

But there will still be those that need a bit more customization… For that, there is the ability to change your filenaming scheme to something like ‘filename.lua’. When Soundminer comes across this string when its building the new filename for transferred files, it’ll look inside the Soundminer Support folder for a specific folder. (Typically this is in ~/Library/Application Support/Soundminer, but you can reveal it by going to the hammer and the wrench icon and choosing to reveal the support folder.) This folder is called FilenamingScripts and it’ll look for a file called whatever you specified in the naming scheme.

The script it pretty simple, it’s a function that is sent in the metadata, and also any extra parameters that might be useful, and returns a string to use as a base name. The base name is the filename without extensions(.wav,.aif, etc) and without any type of multi-mono extension (.A1, .L, .R, etc). You can call into the regular naming scheme code by using smname.make(‘<Description:1>_<Source:2>’), some examples will follow below.

So let’s take this file as an example pitchnaming.lua. After putting it into a folder called FilenamingScripts in the Soundminer Support folder, you can now use this as a naming scheme…

Naming Setup

Let’s look at this script…

Naming Script

This function (makeName) will be called once per file. The first thing it does(on line 4), is uses the smname.make function to generate a name. At this point it doesn’t matter if the filename exists already, Soundminer will append 1, 2, etc to the basename to generate a unique name. The 31 in this function is what would be the filename limit for this portion of the script.

The next bit (lines 5-7), see if the sound has been modified Pitch wise. If it is not 1.0 (which is unchanged pitch), it then appends the pitch * 100 with a p at the end. ex. 20p for a file that was 20% of its original speed.

Doing it this way allows for very customizable and advanced filenaming based on the operations you are doing. The extraParams is a lua table, and has a number of extra parameters you can use. These are…

extraParams['sumToMono'] – Whether you had sum to mono checked
extraParams['midSide'] – whether the sound was decoded from M/S (in the ChannelLayout, which happens automatically)
extraParams['legPicker'] – if not nil then the leg picker was used on a sound
extraParams['plugins'] – if not nil then some plugins were used to process the sound
extraParams['pitch'] – Just a duplicate of the pitch that is in with the regular metadata

A little debugging trick I like to do is to push line 8 (return builtString) down, and insert… error(builtString)

When you execute the script, you should now get an error dialogbox come up and you can see the name. You can then modify the script, save, and without relaunching Soundminer, retransfer until you get what you want.




We don't actively monitor comments. Always best to email us for proper support.