Author Topic: How to retrieve good quality genre tags using Picard  (Read 24574 times)

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
(Even though this Tip & Trick is not pertaining to MusicBee solely but needs an external tool (MusicBrainz' Picard), I feel that the results are so nice that it's worthwhile to post it here.)

The goal of this system is to get your music tagged with as many genres as possible, but restricted to appropriate and sensible ones.

It will also make sure the genre names (and their spelling) conform to, and line up with how MusicBee knows and recognises them.
Which is important if you for example use MusicBee's Tag Hierarchy browser.

The second post after this one provides additional background info and details on the workings.

This start post will explain how to set things up:

- Download and install MusicBrainz' Picard.
   I strongly suggest the portable version, if only for the benefit of this making it possible to have more than one Picard installation for different purposes.

- Navigate to: Options > Metadata
   Make sure these two are checked:





- Navigate to: Options > Tags > ID3
   set it to use ID3v2.4
   (Well, I strongly suggest this. If you have reasons to stick to v2.3 so be it.)

- Navigate to: Options > Plugins.
   In the right panel scroll down to Wikidata Genre, and click the green arrow icon. (download and install)
- Apply [Make it So!], and restart Picard.
- Under Options > Plugins there should now be an options tab for Wikidata Genre. (you can leave everything there as is)
- Check the other Option tabs to set other personal preferences if so desired.
- Important suggestion: You will probably want to uncheck everything under Albumart to prevent downloading and writing of artwork! (Options > Cover Art)

Stricken-through since I have changed my opinion about using the Wikidata plugin (Because of its very bad results I don't use it anymore)



- Navigate to: Options > Genres

  Set the checkboxes and values as in below screenshot, and copy the genre whitelist into the include/exclude box.





Over time the whitelist and the scripts have grown to such lengths that the forum engine doesn't allow including them in this post as code anymore.
(exceeding maximum length)

So the whitelist and the scripts are now available as a download
here

Next, another essential part: adding scripts.
I have provided two of them that are needed for this to work well.

- The first one makes it so that the retrieved genres are named and written in a uniform way, so that they will align well with MusicBee and the (optional) Enhanced Genre Hierarchy List.

- The second one is very important, since it will make sure only the Genre tag gets written, and all other tags will remain unchanged.
   (experienced Picard users can probably ignore this one since they will likely already have their own 'unset' scripts in place)

How to add the scripts:

- Navigate to: Options > Scripting
- Check the checkbox at the top next to:'Tagger script(s)'
- Paste script #1 in the blank pane on the right.
- On the left, rename 'My script 1' to your liking, e.g. 'Genres'.
- Click [Add new script]
- Paste script #2 in the blank pane on the right.
- On the left, rename 'My script 2' to your liking, e.g. 'Unset tags'.
- Make sure the checkboxes for both scripts are checked.

You then should have something like this:





- Apply and close.

That's pretty much it.

If you don't want the original 'Genre' tag to get written/updated, but have another tag set up for this purpose (e.g. a 'Subgenre' tag), see post #2 for how to do that.


______________________________________________________________________________________________


Detailed explanations on the actual use and workings of Picard are beyond the scope of this topic.
There are very good tutorials on that to be found (like the
quick-start and the full documentation), so here is only a quick-and-dirty to at least help to get started a bit:

- Drag an album folder to the left panel.
- Press 'Cluster'.
   All album tracks should now get gathered as an album.
- Select the album and click 'Lookup'.
   It then will usually get matched and moved to the right panel.
   (if that failed try 'Scan' instead of 'Lookup')
   When next, you select the album in the right panel, you will see all present tags, and the suggested genre tag changes in the bottom panel.

Only the 'Genre' tag should be written in either green or light brown. (which indicates that a tag has new or altered content and will get updated and written to the file if you press 'Save')

- If the info displayed in the bottom panel is to your satisfaction, press 'Save'.

Now if you (re)scan the tracks in MusicBee you should see the newly added genres.

I also strongly suggest to check out the
Enhanced Genre Hierarchy List, since it will allow you to get the most out of navigating through your genres, and is fully compatible with the above scripts, the whitelist and the genre names this workflow produces.


______________________________________________________________________________________________


As always!!! :

Do your first (and second, and third) tests on copies of your music files!
Especially if you are new to Picard.
It is a very powerful tagging tool that can easily be configured to do things you did not intend or may not like.



______________________________________________________________________________________________
Last Edit: March 21, 2023, 06:22:47 PM by hiccup

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
 
Some further information and more details on the workings.


This system will retrieve genre information from MusicBrainz.
I would have liked it to additionally retrieve genres from RYM/Sonemic since they have a very good genre database, but regrettably they—still—don't have an API available.

I have decided not to use Discogs and LastFM as sources, since personally I am not that impressed with the quality of the genres that they provide.

- - - - -

One advantage of this specific configuration (my opinion, you may have a different one) is that it will try to provide relevant and appropriate genre tags on a track basis.

So if an album contains tracks of different genres, each may get (a) different genre(s).
Which is what I personally prefer and think is 'right'.

Something like this could be a possible result:





- - - - -

The way this system names the genres is optimally aligned with the Enhanced Genre Hierarchy file that can be found here:
Enhanced Genre Hierarchy

But MusicBee's default genre list should also work well, since it has the same fundament as the Enhanced version.
It's just not as complete, and hasn't been updated for a while now.


- - - - -

extra tip:

Users that don't want their original Genre tag altered or (over)written, but have for example set up a 'Subgenre', or another tag for this in MusicBee only need to make a small edit in script #1:

- Navigate to the bottom of script #1
- you'll find these two lines there:




- Change the two instances of 'genre' to the tag name of your choice.
- Add the command: $unset(genre) at the very bottom.

It should then look like this:




Now your 'Genre' tag will remain untouched, and genres will only be written to the tag of your choice.

- - - - -

An important note regarding mp3's:

For mp3 files, both Picard and MusicBee are expected to be configured to use ID3v2.4 for all this.
If you have reasons to use ID3v2.3 instead, I am not sure what the results will be.

- - - - -

If while testing and using this system you find any unclarity or oversight in the how-to write-up, or encounter unexpected or bad results, please report them here.
I can use the input to improve on the how-to or the scripts if needed.


- - - - -

Good luck, and now you have no excuse to be lazy or bored on new-years day ;-)

All the best for 2022 to everybody!


- - - - -
update 14-05-2022

a virtual tag to improve displaying genres in the Track Information panel:


This method of retrieving tags can result in ending up with a lot of genres for a track.
When you have set the Track Information panel to display <Genres>, the two options for that panel are to either show all of them on a single line, or have them split up over several lines.
The first option will only show the first ones and cut off all the othe…
The second option will often result in ending up with a very large amount of rows, wasting a lot of vertical space.

To solve that problem I created a virtual tag that will split up the genres in groups of four for the first three lines.
If a song has more than twelve genres, the rest will will be displayed on line number four.
So this genres display will take up between one and maximum four lines.

As an example how that could turn out:




this is the virtual formula:
Code
$RxReplace($Replace(<Genres>,;, ·),"^((?:.[^·]*·*){0,4})((?:.[^·]*·*){0,4})((?:.[^·]*·*){0,4})((?:.[^·]*·*){0,4})(.*)(.*)(.*)","$1;$2;$3;$4;$5;$6")
Give it a name, and use that virtual tag to display genres in the Track Information panel.
(make sure you tick 'split multi-value tags into rows' for this virtual tag)

tip:
The script will allow for maximum 4 genres per line.
If you prefer to have it show a different maximum number of genres per line:
Change all instances of {0,4} to the number you desire. E.g. change it to {0,3} if you want no more than three genres per line.


edit
I completely forgot/overlooked that you can also simply set the row count to e.g. 3, and disable 'split multi-value tags into rows'.
That gives similar results. Except that then semicolons are displayed instead of commas, and genre names that consist of two words can get broken up to the next line.
So, my solution works better and looks nicer ;-)

 
Last Edit: March 21, 2023, 06:34:37 PM by hiccup

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Fan-freakin-tastic!
HAving the option to write the tags as a subgenre is exactly what I've been looking for - unfortuately I suck ass when I come to writing scripts myself.

I'll be giving it a good going over during the weekend for sure.

Happy New Year!

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Followup…

Is this geared to work with Classical music and the Classical Extras plugin with Picard.
I randomly tried tagging a few Classical albums, and the only subgenre I'd get is Classical <I'd be expecting Baroque, etc>

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
Is this geared to work with Classical music and the Classical Extras plugin with Picard.
A very good question.
Short answer: no yes
I'll elaborate on this next year ;-)
Last Edit: January 02, 2022, 08:51:25 PM by hiccup

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
Quote from: hiccup
Quote from: Mr. Trev
Is this geared to work with Classical music and the Classical Extras plugin with Picard.
Short answer: no

Well, the answer is 'yes' actually.

The reason I answered 'no' so quick, is because for my classical, and non-classical music I have dedicated and separate portable installs for both MusicBee and Picard.
So for me 'the two shall never meet'.
And for my classical Picard I am using dedicated scripts, and I haven't been testing this specific Enhanced Genre list on it for a while.
So that's why I said 'no' without thinking it through.

But it should work fine, because the list contains all genres from MusicBrainz, and that is where Classical Extras also retrieves them.
The only exception (I know of) is that CE sometimes also retrieves 'work type' genres. And those are not in MusicBrainz genre list, and not all of them are probably in my Enhanced Genre list.
So I'll see if I can find all those and add them too.

Two other observations/warnings:

There are some complications and issues with using Picard with both the CE and the Wikidata plugin.
(you would want to use both, since that gives the most and the best results)
But these two (and probably most genre related plugins) do not work perfectly together.
The results sometimes seem a bit unpredictable, and I am trying to make sense out of it.
But that's not easy or straightforward. E.g. 'Period' (and 'year composed', on which it depends) also doesn't seem to function any more when both plugins are active.
Weird.

And secondly,
Perhaps you already know this, but The CE plugin has an 'Allowed genres' list. The idea is that only genres in that list are accepted.
So the plugin has an out-of-the-box genre limitation. There is a checkbox that should disable this filtering so that you should get all available genres.
(I have some slight doubts if it completely disables all filtering under all circumstances, but that also needs some further and specific testing)

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
I haven't really dug too much into CE - Classical is a comparatively small percentage of my library. I did follow your Classical guide somewhat, but again I really don't need to get uber-detailed.

A quick question about your Musicbrainz genre settings: I see in your screenshot that you have 0% minimal genre usage and max. 20 genre. That's waaay of the default settings (90%, max. 5. IIRC) What the deal?

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
A quick question about your Musicbrainz genre settings: I see in your screenshot that you have 0% minimal genre usage and max. 20 genre. That's waaay of the default settings (90%, max. 5. IIRC) What the deal?
That setting is mostly to restrict the garbage tags that you will often get when you have enabled 'folksonomy' tags.
I disable those, and in this way I get as many good quality tags as possible.

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
A quick question about your Musicbrainz genre settings: I see in your screenshot that you have 0% minimal genre usage and max. 20 genre. That's waaay of the default settings (90%, max. 5. IIRC) What the deal?
That setting is mostly to restrict the garbage tags that you will often get when you have enabled 'folksonomy' tags.
I disable those, and in this way I get as many good quality tags as possible.

I see. Never used folksonomy tags - I'm not entirely sure what they even are ;D

Just some feedback on my experience… I just planned on having the tags written to subgenre, but when I added the script amendments to so, it didn't write either genre or subgenre. I wouldn't be surprised if this is user error on my part though, I'm routinely outsmarted by writing scripts.
No biggie. I typically do run my music through Picard anyways for the extra tags Musicbee doesn't fill, so I just skip the "unset" script and made genre a preserved tag

alec.tron

  • Sr. Member
  • ****
  • Posts: 752
extra tip:

Users that don't want their original Genre tag altered or (over)written, and have for example setup a Subgenre tag in MusicBee, only need to make a small edit in the scripts:

Thanks for that info!! I Might finally also be able to look at integrating picard tags in my lib in its' own field ;)
Cheers.
c.

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
update

I have made a significant U-turn in how I previously set up Picard to retrieve genres:
I have abandoned the Wikidata plugin, and now only use Picard's built-in genre retrieval function.

There are two reasons for this:

1. While the results that the Wikidata plugin provided looked very nice at a casual glance, I also did notice a lot of inapropriate, wrong or unfitting genres being supplied.

2. While I never liked using the folksonomy tags option because it would give an enormous amount of completely useless tags, I have now learned how to set up a filter that will make it so that only genres from a specified whitelist are retrieved.

After these new insights I have been doing some extensive and focussed testing, using some 100 releases of various genres and 'difficulties', comparing the results between using my previous method using Wikidata, and the new one without Wikidata, but allowing the use of folksonomy tags, restricted by a whitelist filter.

The latter won hands-down.
The retrieved genres were significantly more appropriate and 'correct'.

So, I've changed my ways, and I have edited the startpost of this Tip & Trick accordingly.
 
Last Edit: January 22, 2022, 09:41:31 PM by hiccup

hiccup

  • Sr. Member
  • ****
  • Posts: 7760
Just some feedback on my experience… I just planned on having the tags written to subgenre, but when I added the script amendments to so, it didn't write either genre or subgenre. I wouldn't be surprised if this is user error on my part though, I'm routinely outsmarted by writing scripts.
Have you been able to resolve this?
Did you perhaps have other scripts or plugins managing 'genre'?

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Just some feedback on my experience… I just planned on having the tags written to subgenre, but when I added the script amendments to so, it didn't write either genre or subgenre. I wouldn't be surprised if this is user error on my part though, I'm routinely outsmarted by writing scripts.
Have you been able to resolve this?
Did you perhaps have other scripts or plugins managing 'genre'?

Just noticed you updated things. I'll check it out later today - I hope this means I don't need to retag all the files I already tagged with the earlier method ;)

I haven't "resolved" it because I have a suitable workaround. I skip using script 2 (unset) and added genre to the preserved tags in Picard. I do run all my files through Picard anyways so the 2nd script isn't necessary and I keep using my default Genre choice. Your method might work out better for parent/main genres, but I'm happily in the rut of my own making on that front - I'd need to do some trials to decide if I'm willing to make a major change or stay set in my ways ;D

Cheers

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Found one issue… your steps for changing the script to have a subgenre tag need an update.

 - In script #1, navigate to the last line saying:
$setmulti(genre,$unique(%_genretemp4%))
   and change it to:
$setmulti(subgenre,$unique(%_genretemp4%))

In your updated script there is no lines with %_genretemp4%. I needed to change the very last line in script 1 from:
$setmulti(genre,$unique(%_genremusic2%))
  to:
$setmulti(subgenre,$unique(%_genremusic2%))

Simple enough fix considering I was able to brain it out myself