COMMENT-tag (Energy-rating) to POPULARIMETER-tag (Star-rating) - How?

I want to get the Energy-rating of Mixed In Key converted into the Star-rating system of Traktor.

Mixed In Key's Energy-rating is being analyzed and written into the COMMENT tag-field as text (together with Key-result).
Traktor's Star-rating is making use of the POPULARIMETER tag-field to display the amount of stars.

See picture below:

Traktor's code for Star-rating I digged up here:|xxx|yyy

xxx is for the rating and yyy for a playcount.
The values of xxx are fixed to:
0 = no value
51 = 1 star
102= 2 stars
153= 3 stars
204= 4 stars
255= 5 stars

I would like an action like:
if COMMENT contains 'Energy 9'; than write|255|000,
so it shows 5 stars (with zero playcounts)

See pic below for desired outcome:

Does anyone have any ideas?
Thanks in advance.

How do you map the 9 energy values to 5 star values?

By dividing them over the stars based on percentage, in my case, I would like to go this way:
My collection of tracks is 11469 = 100 %
1% = 114,69 tracks

Genres = 2-Step/Garage, Breakbeat, Bubbling, Dance, Dirty Dutch, Drum & Bass, Dub, Dubstep, Electro Pop, French Tek, Hardcore, Hardstyle, Hiphop, House, Jungle, Mashups, Minimal, Dutch, Old School, Other, Pop, R&B, Rave, Reggae, Rock, Techno, Themes, Top40, Trance, Trap

0 stars

Energy 1 = 1 track = circa 0,0%
Energy 2 = 96 tracks = circa 1%
Energy 3 = 251 tracks = circa 2%

1 star

Energy 4 = 588 tracks = circa 5%

2 stars

Energy 5 = 1138 tracks = circa 10%

3 stars

Energy 6 = 3169 tracks = circa 28%

4 stars

Energy 7 = 4394 tracks = circa 38%

5 stars

Energy 8 = 1683 tracks = circa 15%
Energy 9 = 149 tracks = circa 1%

ENERGY <== $regexp(%COMMENT%,'.\bEnergy\s(\d)\b.','$1')

STARS <== $replace(%ENERGY%,'1','0','2','0','3','0','4','1','5','2','6','3','7','4','8','5','9','5')
... or ...
STARS <== $replace(%ENERGY%,1,0,2,0,3,0,4,1,5,2,6,3,7,4,8,5,9,5)

POPM <== $replace(%STARS%,'5','255','4','204','3','153','2','102','1','51','0',)
... or ...
POPM <== $replace(%STARS%,5,255,4,204,3,153,2,102,1,51,0,)

... or probably ...
POPM <== $replace(%STARS%,5,255,4,204,3,153,2,102,1,51,0,0)

For POPM see there ...
COMMENT-tag (Energy-rating) to POPULARIMETER-tag (Star-rating) - How?

DD.20161110.1915.CET, DD.20161111.1510.CET, DD.20161111.1827.CET

I am sorry, I could not check the erroneous proposals yesterday, ...
they have to be revised, see above.


Do check the content of the created helper tagfields ENERGY, STARS, POPM within the Mp3tag Extended Tag View.
If the values are allright, then create the target tagfield POPULARIMETER, ...
afterwards remove the helper tagfields.

At first apply the algorithm manually to some test file step by step.
When all steps are working good, then build up an actionsgroup.


Thanks alot!

Call me a newbie, but where do I put this info in Mp3tag?

Three actions (/t/967/1 of the type "Format value"
One for the field ENERGY,
one for the field STARS
one for the field POPULARIMETER (the internal name is POPM).
Copy and paste the the string for each field and action, starting with the $-character.

Somehow the Stars arent showing up.

I made a new action as described, see pic below:

Before I ran this action I made sure all the stars were empty by selection a part of my Collection and made them 0 stars.

Then I ran the action with Mp3tag on the selection.
When I opened up Traktor, no stars yet, so I did a re-Analyze on them.
Still nothing:

So I did a Consistency check. Didnt do the trick either:

Finally, I tried to Import the whole collection again, by using Import Another Collection, and selecting the default Collection.nml, but no stars present:

Any idea why it's not working?

Please check my edited post from above and try again.


I tried your edited versions; v2 and v3.
See pics below:



I think there's something else wrong, when I check the Extended tags, shouldnt I use POPULARIMETER instead of POPM?
Also, the outcome-results of v2 and v3 of the scripts look exactly the same.
See pics below:

Outcome of v2 script:

Outcome of v3 script:

Within my proposal I made use of temporary helper tagfields ENERGY, STARS, POPM to see and check the result from each step while development goes on.
To create the tag field POPULARIMETER for Traktor you have to assemble a valid text string using the value from the helper tagfield POPM.

When all works fine, you can remove the helper tag-fields by the last action within the actionsgroup.

See your pictures: the created value '5153' for POPM is a bad value, there might be a writing error in the formatstring of one of the actions, there is a missing colon or such.

Because my main computer is broken down, and I do not have any test data to play with, I cannot create a working actionsgroup for you, nevertheless I see that you are on the right way to solve the entire task for yourself.


For POPM see there ...
COMMENT-tag (Energy-rating) to POPULARIMETER-tag (Star-rating) - How?


Perhaps the POPM action is not quite right.
I would say that you actually may use an action of the type "Format value" for POPULARIMETER

That fails because the replacements happen one after the other, not all at once.
But this format string works:|$add($mul(%STARS%,50),%STARS%)|0

Works! :smiley:
Thanks to you guys.

I've added that last Format String mentioned by ryerman, to version 3, and voila:
:sunglasses: :

You no longer need to format the user-defined POPM field, so that action can be removed from the Action Group.
As DetlevD suggested, you can add a "Remove fields" action to remove STARS and ENERGY.

As described, I deleted the POPM field-tag, and all works indeed, see pic below:

I also made a new Action to remove the fields STARS and ENERGY, see pic below:

Can I just put those 2 fields to remove, into the v5 Action as latest 2 actions?
Or do I need to use it separate?

Why not experiment and teach yourself? :smiley:
And pay attention to the hint: "semicolon-separated"

Why isn't it working anymore?

I've changed to Windows 10 x64 + MP3tag v2.83 and now I get this error:

I used the same values, i.e.:

Format String: $regexp(%COMMENT%,'\bEnergy\s(\d)\b.','$1')

Format String: $replace(%ENERGY%,1,0,2,0,3,0,4,1,5,2,6,3,7,4,8,5,9,5)

Format String:|$add($mul(%STARS%,50),%STARS%)|0

See proof:

After replacing the 1st value on ENERGY with the initial proposal, it works!

After doing a Consistency Check in Traktor, the results:

So values should be like this:

Format String: $regexp(%COMMENT%,'.\bEnergy\s(\d)\b.','$1')

Format String: $replace(%ENERGY%,1,0,2,0,3,0,4,1,5,2,6,3,7,4,8,5,9,5)

Format String:|$add($mul(%STARS%,50),%STARS%)|0

See proof:


Can I resurrect this just to promote some discussion? Is the original poster still around? I've got some Ideas that I'd love to discuss...