Ratings in MP3Tag - Where stored & how to display 1-5 Star values

Sharing my trial and error learnings here in case it helps others in the future. I'll also share what I finally worked out to solve my issue in hopes it helps others and in case someone else has a better way.

I wanted to see music/file Ratings in MP3Tag. I'm currently using Strawberry Music Player (SMP is based on Clementine). I used iTunes for years, but one of the downsides is it didn't store ratings in ID tags. One of the things I like about SMP is it can store ratings and playcounts in tags and therefore those are maintained across devices, players and such.

I'm a long-time MP3Tag user, pretty versed in coding and tagging, but I found that (it seems) there are few if any standards for how ratings are handled. They can be stored in a number of different fields by different players and the values stored can vary widely too.

After lots of web searches, reading many MP3Tag community posts, help documentation as well as similar things on various MP3 player sites, Here's a few things I learned.

  1. Strawberry Music Player stores Rating values in the FMPS_Rating field.
  2. SMP supports 1-5 stars and allows half star ratings - it stores those values as numeric fractional values (e.g. 1 star = 0.2, 4 stars = 0.8, 5 stars = 1) Unrated = no value entered. Change a Rated song to no rating...the value in the tag field changes to "0".
  3. MP3Tag math functions only do integer math.
  4. MP3Tag MATH FUNCTIONS ONLY DO INTEGER MATH.
  5. MP3Tag MATH FUNCTIONS ONLY DO INTEGER MATH...no floating point math here.
  6. Using Math Functions like $num, $div, $mul, $add will IGNORE EVERTHING AFTERN THE DECIMAL POINT (e.g. $num will only return 1 or 0 if the values are all less than or equal to 1).
  7. The documentation for the arithmetic functions could make the "integer only" thing more visible and explain what it means (and make it easier to find when searching). If you're trying to work with decimals, you don't search for the word "integer". Also, people scan text and look at the description of $mul... Note also that the $num string function description says "It ignores anything from the first non-numeric character"...but it doesn't add that "." is considered "non-numeric" or that it will only return integers. Lots of numbers include a decimal point...

So, here's how I ultimately solved my challenge:

For tracks rated 1-5 stars with values stored as 0.2; 0.4; 0.6; 0.8, and 1:
$if($eql(%fmps_rating%,0.8),4,$if($eql(%fmps_rating%,0.6),3,$if($eql(%fmps_rating%,0.4),2,$if($eql(%fmps_rating%,0.2),1,$if($eql(%fmps_rating%,1),5,$if($eql(%fmps_rating%,),NULL, XXXXXXXX ))))))

For non-coders, this is basically a set of nested "if" statements looking for values like "0.8" and displaying the desired value (like "4" for 0.8). An empty value shows the string "NULL" and if any other value is seen, it shows "XXXXXXX".

Here's the final version I came up with that handles half-stars and a "0" for if the rating is overwritten to "less than a half star" (looking unrated in my player).

$if($eql(%fmps_rating%,0.8),4,$if($eql(%fmps_rating%,0.6),3,$if($eql(%fmps_rating%,0.4),2,$if($eql(%fmps_rating%,0.2),1,$if($eql(%fmps_rating%,1),5,$if($eql(%fmps_rating%,),NULL,$if($eql(%fmps_rating%,0.1),0.5,$if($eql(%fmps_rating%,0.3),1.5,$if($eql(%fmps_rating%,0.5),2.5,$if($eql(%fmps_rating%,0.7),3.5,$if($eql(%fmps_rating%,0.9),4.5,$if($eql(%fmps_rating%,0),0,ERROR))))))))))))

If your player doesn't use the fmps_rating field, it could use one of these fields:

  • rating
  • rating mm
  • rating winamp
  • rating wmp
  • popularimeter

Hope that helps some folks. Also, +1 to the idea of MP3Tag (which has always been amazing) supporting ratings more simply.

Evidently I've also taken up novel writing for a very niche community of readers. Regards. :smile:

I wonder why this player chooses a custom field instead of the ID3 standard field POPM (POPULARIMETER).
AFAIK from the list

MP3tag only has fields for

I think you could also use:
$replace(%fmps_rating%,0.8,4,0.6,3,0.4,2,0.2,1,1,5,NULL,0.1)

Hmm. Very interesting. So that just replaces the value to be displayed in the column...not overwriting the tag data itself, correct? (Haven't had a chance to test it out yet, and it's late...).

Thanks! This community is great for sharing ideas.

The result should not differ from the nested if-statements.
If you do not fill "Field" for that column, then the transformed values are only displayed but not written back.

The list I included of fields actually came directly from MP3Tag's list of "Extended Fields" in the user interface (Customize Columns > Field drop down > Extended Fields).

I'm not sure it's accurate to say the POPULARIMETER field is "standard", since the support for said "standard" is basically non-existent across players and tag editors. :frowning: Searching Google for "POPULARIMETER id3 tag field" and "what mp3 players use "POPM"" and similar yields almost no useful references other that people discussing their confusion/frustration with trying to sort through this issue. Also, even if you consider the field a "standard", the way players do rating and store the ratings varies widely...which means the "standard" really isn't much of a standard. Note also that some players store stuff other than the rating (e.g. evidently MM with a rating of 5 stars, writes "no@email|255|0"). What a mess. :slight_smile:

:bulb: It would be great to put together a table showing various players/MP3 tools and which field(s) they store/read ratings from and the format the ratings are written in and/or expected to be read in.

:bulb: Ideally, MP3Tag could detect which field(s) are in use and display the rating as a number or star rating.

:question: There's currently an option in MP3Tag under Options > Tag > Advanced that you can turn on/off called "Always display POPULARIMETER values for ID3V2 ratings. I've no idea what that REALLY does since the help documentation is vague about what happens if it's turned off... It also doesn't explain where or when the value would be displayed. Can anyone shed light on that? I'm gonna experiment a bit more.

See Also:

I am too lazy to search for all the various threads that deal with ratings.
The basic story is:
The only id3 field for rating is POPM.
And it is an ID3 tag field - other tag formats may have other fields for that.
The underlying format for POPM is always, as stated in the documentation

This description is for only ID3v2 tags. The playcounter is an optional value. The Rating is an integer between 1 (worst) and 255 (best). Syntax: Email|Rating|Playcounter

The email part may vary e.g. for WMP it is Windows Media Player 9 Series and the Media player then interprets the following value , e.g. 128 as 3 stars.
Similar things happen for the other translated ratings, e.g. Rating MM.
The complete string could look like that: Windows Media Player 9 Series|128 - and you see that if you switch on the option to always display the (raw) values in POPULARIMETER and not the translated ones, which would be the off-setting.

If you only write the value e.g. |128| then each player, as long as it reads the rating at all, has the task to translate the rating into its own way of showing it.

A problem that has been discussed many times in this forum: does the player read the field at all? At least iTunes does not. And so it boils down to trial and error to find out whether the preferred player interprets data in that field or not.
You seem to have found a way for your player - even though that uses a user-defined and not even a standard field - but that is probably as good as it will get.
Besides the lack of using the standard field for rating, even more players have problems with user-defined fields.
It would be interesting, though, to see whether your player can cope with POPM (or POPULARIMETER).

If 0.2 is 1 star and 1.0 is 5 stars, just multiply by 50. So 0.2 becomes 10 and 1.0 becomes 50. Then use the string functions to easily pop a decimal point between the two digits, and you'll get a fake floating point number. Will that work?

The multiplication would have to be done in a different program as MP3tag has mathematical functions for integer numbers only.