Here is (supposed to be) a screen capture of the Tools menu. Shown are two Powershell tools.
Add Samples Tag requires the following (Windows):
Name: Add Samples Tag
Parameter: -ExecutionPolicy Bypass -NoProfile -File "[path\to]\samples.ps1" -Path "%_folderpath%\"
Do not tick "for all selected files", as it’s unhealthy.
MP3s contained in the same folder and subfolders of the folder are simultaneously opened for tagging. That happens automatically when you right-click on a file that opens the context menu and click the
Add Samples Tag tool.
Add Samples Tag (1 file only):
Name: Add Samples Tag (1 file only)
Parameter: -ExecutionPolicy Bypass -NoProfile -File "[path\to]\samples-for-one.ps1" -Path "%_folderpath%\" -filename "%_filename_ext%"
You can optionally tick "for all selected files". If you do so at your own peril, selected MP3s are tagged consecutively; a new window opens each time.
Download from ffmpeg.org. Extract to a location of your choice.
Visit GitHub - illearth/powershell-taglib: A PowerShell module for manipulating metadata in media files with TagLibSharp. Clone or download the Zip.
Edit the scripts
samples-for-one.ps1 in a text editor.
Delete the signature blocks. I left them in place to illustrate what a signature will look like when you generate your own.
Input a valid default working folder. In
samples-for-one.ps1, provide a default file. Default parameters serve as placeholders in the event that you wish to test run the scripts without a commandline, for example, so don't worry. Default MP3s won't be tagged while launching from Mp3tag, as long as the commandline includes the parameters that are processed.
You must provide the full path locations of
taglib-sharp.dll in your editor.
Once you finish editing, save the scripts.
Signing requires a code-signing certificate.
I utilize a small code for signing.
param([string] $file=$(throw "Please specify a filename."))
$cert = @(Get-ChildItem cert:\CurrentUser\TrustedPublisher -codesigning)
Set-AuthenticodeSignature $file $cert
Run in Powershell:
PS [path\to\code]> .\add-signature.ps1 [path\to]\script.ps1
This adds the signature block authorizing Windows to execute a script.
Successful mp3tagging to all.
If you already wrote a tag, a new tag is appended, the existing tag not overwritten. You'll end up with two (or three) tags. Mp3tag may show just one tag, but, trust me, there are two of the same name.
Deleting in Mp3tag removes both thankfully.
Do not attempt to remove redundant tags in a PS script requiring a library.
Metatags often reside inside category frames. Typically
taglib-sharp.dll empties the frame, the entire category vanishes. Assuming you want to delete a specific tag, you should use Mp3tag for that purpose. It's designed for such tasks and has many additional beneficial traits as well.
The number of samples can be easily calculated as milliseconds and the value written to a *.xspf playlist (Duration) created with a *.mte script. Try it.
samples.zip (4.9 KB)
What is a *.xspf (spiff, for short) playlist? A playlist in Xml format. My Android gobbles them up.
Take a peek.
mp3tag-s7.zip (1.3 KB)