How to convert value ranges to a description?

I want to convert values to descriptions.

Example of values:

Example of descriptions:
image

The value range is always 0-100.
Right now, the descriptions are based on 1/3's (33%).
So for example, 0-33 for 1T_DANCEABILITY = #dance-low
and 34-66 for for 1T_ENERGY = #energy-med

What I want to achieve is dividing them into 1/5's (20%) instead.
So for example, 0-20 for 1T_DANCEABILITY = #dance-lowest
and 21-40 for 1T_DANCEABILITY = #dance-lower

Something like if 1T_DANCEABILITY is between 0-20, then write/add #dance-lowest to {user-defined tag}.
If 1T_VALENCE is between 80-100, then write/add #happiest to {user-defined tag}.

This way you end up with the example of the Album tag in example screenshot, but instead of thirds, it's more detailed, based on fifths.
How would I do this in Mp3tag, based on the existing values?

How do you achieve it currently with your 1/3's (33%)?

Using https://onetagger.github.io

You could use the $DIV() and $replace() function:

$replace($div(%1T_DANCEABILITY%,20),1,#dance-lowest,2,#dance-lower,3,#dance-med,5,#dance-high)

1 Like

Yay! That works, thank you very much :slightly_smiling_face:

Example outcome (based on OP values):

Now how would I add these to one tag, like for ex. the COMMENT tag?
If I simply use the formula mentioned, it overwrites the existing.

My action:
image

DANCEABILITY
$replace($div(%1T_DANCEABILITY%,20),0,#dance-min,1,#dance-low,2,#dance-med,3,#dance-high,4,#dance-max)

ENERGY
$replace($div(%1T_ENERGY%,20),0,#energy-min,1,#energy-low,2,#energy-med,3,#energy-high,4,#energy-max)

ACOUSTICNESS
$replace($div(%1T_ACOUSTICNESS%,20),0,#electronic,1,#acoustic-low,2,#acoustic-med,3,#acoustic-high,4,#acoustic-max)

INSTRUMENTALNESS
$replace($div(%1T_INSTRUMENTALNESS%,20),0,#vocal-max,1,#vocal-high,2,#vocal-med,3,#vocal-low,4,#instrumental)

LIVENESS
$replace($div(%1T_LIVENESS%,20),0,#recorded,1,#live-low,2,#live-med,3,#live-high,4,#live-max)

SPEECHINESS
$replace($div(%1T_SPEECHINESS%,20),0,#music,1,#speech-low,2,#speech-med,3,#speech-high,4,#speech-max)

VALENCE
$replace($div(%1T_VALENCE%,20),0,#sad-max,1,#sad-low,2,#balanced,3,#happy-high,4,#happy-max)

POPULARITY
$replace($div(%1T_POPULARITY%,20),0,#unpopular-max,1,#unpopular-low,2,#popular-med,3,#popular-high,4,#popular-max)

Action: Format Value
Field. COMMENT
Format string: every other field you want to copy the content from, like
%COMMENT% - %DANCEABILITY% - %ENERGY%
and so on. If you don't want to separate the values with a -, just use a space or nothing at all between the field names.

1 Like

Works - Thanks! :slightly_smiling_face:

I've added the comment itself, so it preserves what was written before:
%COMMENT% - %DANCEABILITY% - %ENERGY% - %ACOUSTICNESS% - %INSTRUMENTALNESS% - %LIVENESS% - %SPEECHINESS% - %VALENCE% - %POPULARITY%

For those who don't want to write the formula from scratch, hereby the action.
Copy into C:\Users\YourUserName\AppData\Roaming\Mp3tag\data\actions
Value ranges to 5ths.mta (1.2 KB)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.