Author Topic: Useful virtual tag formulas  (Read 75426 times)

redwing

  • Guest
How to Bulk-adjust Target Loudness Level of RG tags without Re-analyzing Tracks

When you want to adjust target loudness level of existing ReplayGain tags, you don't have to re-analyze tracks using the slider, which will take considerable amount of time. Instead you could create a virtual tag that shows the adjusted values and then bulk copy them to the existing ReplayGain tags.

These virtual tags require latest version (2018-02-03 or later) of Additional Tagging Tools plugin (https://getmusicbee.com/addons/plugins/49/additional-tagging-and-reporting-tools/) installed and enabled.

For instance, if you want to lower 7 dB for all your ReplayGain tags then use the following virtual tags, which will have the exactly same effect as re-analyzing tracks using the slider:

New Album Gain
Code
$IsNull(<Album Gain>,,$Sub($Split(<Album Gain>," ",1),7)" dB")
New Track Gain
Code
$IsNull(<Track Gain>,,$Sub($Split(<Track Gain>," ",1),7)" dB")
Then you can use "copy tag" command of Additional Tagging Tools plugin to bulk copy the virtual tags to the RG tags.

(Personally I don't take this approach to tackle the clipping issue but it seems many people prefer this way)

Note on sorting of negative numbers in virtual tags:

To sort negative numbers correctly in virtual tags, you need to change the virtual tag's type to "number" in configure fields setting. But if the numbers are appended by some characters (like "dB" in this case), they won't sort correctly even if it's set to numeral type. If you really want to sort them correctly then create another virtual tag just for sorting purpose without appending any characters to the number.
Last Edit: February 08, 2018, 01:46:29 AM by redwing

redwing

  • Guest
How to Check Filename Length

Now it's easy to check the length of filename (+paths) if you install latest version (2018-02-05 or later) of Additional Tagging Tools plugin (https://getmusicbee.com/addons/plugins/49/additional-tagging-and-reporting-tools/).
Use the following formula to create a virtual tag.

Length
Code
$Len(<URL>)
Then add the field to the main panel or create an auto-playlist using the field. To make the field sorting correctly you need to change the virtual field's type to "Number" in Configure Fields setting.
Last Edit: February 08, 2018, 01:45:58 AM by redwing

redwing

  • Guest
How to Create "Filename Only" Field

Sometimes you want to use just filename in a template, but currently <Filename> field returns filename plus file extension.
Now this can be easily achieved if you install latest version (2018-02-06 or later) of Additional Tagging Tools plugin (https://getmusicbee.com/addons/plugins/49/additional-tagging-and-reporting-tools/).

Create a virtual tag called <Name> with the following formula.
Code
$Name(<Filename>)
Then you can put just <Name> in a template when you want to use filename without extension.

redwing

  • Guest
Play count per 100 days

A highest play count doesn't necessarily mean that you liked the song most in your library. You also need to take into account how many days each track has stayed in your library since tracks you had imported earlier are likely to have played more times than recently imported ones.
Now you can calculate this kind of figures if you install latest version (2018-02-15 or later) of Additional Tagging Tools plugin.
Create a virtual tag with the following formula:

Play count per 100 days
Code
$Round($Mul($Div(<Play Count>,$NumberOfDays($Now(),<Date Added>)),100),1)
The reason it's using per 100 days rather than per day is simply to avoid small numbers. If you have rather big (or small) play counts, adjust the formula accordingly. To sort the field correctly, you need to change the virtual field's type to "Number" in Configure Fields setting.
Last Edit: September 27, 2018, 11:21:37 PM by redwing

Freddy Barker

  • Sr. Member
  • ****
  • Posts: 751
  • 🎧 MB 3.4.7628P
Quote
Now you can calculate this kind of figures if you install latest version (2018-02-06 or later) of Additional Tagging Tools plugin

@redwing

Does all of that awesomeness now mean I can show "Last played was NNN days ago" now?

Kind regards: Freddy  ;)

redwing

  • Guest
I can show "Last played was NNN days ago" now?

Yes, use this:

$If(<Last Played>="Unknown",,$RoundDown($NumberOfDays(<Last Played>),0))

I'll ask boroda74 to return integers with the $NumberOfDays function, then you could remove $RoundDown part (I'll edit the formula if it's fixed).
And if you have further questions, please use Questions forum.

--------

<edit>
Code
$If(<Last Played>="Unknown",,$NumberOfDays($Now(),<Last Played>))
Last Edit: March 15, 2018, 04:14:01 PM by redwing

Freddy Barker

  • Sr. Member
  • ****
  • Posts: 751
  • 🎧 MB 3.4.7628P
I can show "Last played was NNN days ago"?

Yes, use this:
Code
$If(<Last Played>="Unknown",,$RoundDown($NumberOfDays(<Last Played>),0))
I'll ask boroda74 to return integers with the $NumberOfDays function, then you could remove $RoundDown part

Wow! ;)
I was assuming that the Tagging Tool Plugin would need some configuring but it worked like a dream by just installing it!
As usual - excellent work and quick fix! 
Thanks @boroda74 for the Plugin and thanks @redwing for the Code - I would never had figured it out on my own!

Best Regards: Freddy

doodlepapers

  • Jr. Member
  • **
  • Posts: 79
How to Identify Tracks with a Cue Sheet File

To identify tracks with a cue sheet file, you can use the following virtual tag using MB's internal tag <FileCueSheet>:

Cue = $IsNull(<FileCueSheet>,,<FileCueSheet>)

If you add the "CUE" field to the main panel, the column will show the entire content of the cue sheet just like when using Edit Cuesheet button on Tag Editor.
 
Then create an auto-playlist using the rule of "CUE" field "has a value".
The auto-playlist will only contain tracks with a cue sheet.

Also you can make file extension column of tracks with a cuesheet file displayed in the main panel as something like "flac/cue" with the following virtual tag:

$IsNull(<FileCueSheet>,<.Ext>,<.Ext>/cue)


Does this still work?

When I add the virtual track to track details and then sort, they show up fine.

But when added to an auto playlist, all tracks in my library show up, and not just the ones with .cue.

redwing

  • Guest
Then check what the virtual field shows for tracks with no cuesheet in your auto-playlist.
Make sure you didn't include "Cue =" part too to the formula.

redwing

  • Guest
How to find albums with the same value for both album gain and track gain

Sometimes you forget to re-run volume analysis for a single FLAC (or APE) file album after splitting them to individual tracks. Then the album gets left with the same album/track gain for every track in it. Because they already have the both RG tags, they get excluded even if you select the entire library (unless you tick the tickbox again for all selected tracks to re-run it for every selected album).

Create a virtual tag with the following formula:
 
Code
$IsNull(<Album Gain><Track Gain>,,$If($Split(<Album Gain>," ",1)=$Split(<Track Gain>," ",1),$Split(<Album Gain>," ",1),))
And use "that virtual tag" "has a value" rule for either an auto-playlist or highlighting rule.
Then it will show all tracks that have the exactly same value for both album and track gain. Some tracks could have the same values at random. So ignore such a single track in an album and try to find albums with full of such tracks.

And this code is for locating tracks with no RG tags or with track gain tags only:
Code
$IsNull(<Album Gain>,$IsNull(<Track Gain>,,T),T+A)
For this tag, if you use "that virtual tag" "has no value" rule, it will show tracks with no RG tags.
And "that virtual tag" "is" "T" rule will list tracks with track gain tags only.
Last Edit: July 26, 2018, 04:00:10 PM by redwing

redwing

  • Guest
How to display the number of values tagged for a multi-value tag

I'd like to share tangotoynb's contributions: see the original thread https://getmusicbee.com/forum/index.php?topic=26688.0

This code will display the number of values tagged for a multi-value tag like Artist or Genre.

Code
$Add($Len($RxReplace(<Artist>,"[^;]","")),1)
And note that you need to have Additional Tagging Tools plugin (http://musicbee.wikia.com/wiki/Additional_Tagging_and_Reporting_Tools#Links) installed to use those additional functions in your virtual tags.

redwing

  • Guest
How to Add All <Featuring Artist> to Title

This is an opposite task to a previous post "How to Extract All <Featuring Artist> from Title" (https://getmusicbee.com/forum/index.php?topic=9317.msg75544#msg75544).

When you have multiple artists tagged, the following code will generate a virtual tag that adds all featuring artists after title.

Code
<Title>$If($First(<Artist>)=<Artists>,," (feat. "$If($Split(<Artists>,;,2)=$RSplit(<Artists>,;,1),$RSplit(<Artists>,;,1),$Replace($RxReplace(<Artists>,"^[^;]+;\s*(.*);\s*([^;]+)$","$1 & $2"),;,","))")")
e.g. multiple artists "AAA; BBB; CCC; DDD; EEE" > Song Title (feat. BBB, CCC, DDD & EEE)
Last Edit: November 11, 2018, 07:37:03 PM by redwing