MusicBrainz is a fantastic, free (libre and gratis) online music database. A wealth of metadata is stored there; at the time of writing it covers 1.4m releases and almost a million artists. Perhaps more impressive than the breadth is the depth; it contains information about record labels, who performed on which track and much, much more.
A lot of music apps connect to MusicBrainz to look up metadata, and some music app developers are surprised when they don't see a "genre" field in the results for releases. Genre is a datum much used (and abused) by computer audio collectors - it can be a useful way of choosing albums or tracks for playlisting, depending on your mood.
Here's a basic response for a release from MusicBrainz:
<release id="00897556-cb7a-3417-97aa-756b3fdc77c9"> <title>Silent Alarm</title> <status>Official</status> <quality>normal</quality> <packaging>Jewel Case</packaging> <text-representation> <language>eng</language> <script>Latn</script> </text-representation> <date>2005-02-14</date> <country>GB</country> <release-event-list count="1"> <release-event> <date>2005-02-14</date> <area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"> <name>United Kingdom</name> <sort-name>United Kingdom</sort-name> <iso-3166-1-code-list> <iso-3166-1-code>GB</iso-3166-1-code> </iso-3166-1-code-list> </area> </release-event> </release-event-list> <barcode>5055036260756</barcode> <asin>B0006ZIDJO</asin> <cover-art-archive> <artwork>true</artwork> <count>1</count> <front>true</front> <back>false</back> </cover-art-archive> </release>
http://musicbrainz.org/ws/2/release/00897556-cb7a-3417-97aa-756b3fdc77c9
So, no genre. Given some people find this data useful, it would be valuable to find a way of looking up genres in MusicBrainz. It turns out there is a roundabout way of finding genres. That's to lookup the tags applied to releases by MusicBrainz users.
MusicBrainz offers the ability to tag releases and release groups (release groups are a container
for multiple releases, e.g. where a different release for the same basic album exists in different
countries). These tags can be included in results using the inc=user-tags
parameter:
<release id="00897556-cb7a-3417-97aa-756b3fdc77c9"> <title>Silent Alarm</title> <status>Official</status> <quality>normal</quality> <packaging>Jewel Case</packaging> <text-representation> <language>eng</language> <script>Latn</script> </text-representation> <date>2005-02-14</date> <country>GB</country> <release-event-list count="1"> <release-event> <date>2005-02-14</date> <area id="8a754a16-0027-3a29-b6d7-2b40ea0481ed"> <name>United Kingdom</name> <sort-name>United Kingdom</sort-name> <iso-3166-1-code-list> <iso-3166-1-code>GB</iso-3166-1-code> </iso-3166-1-code-list> </area> </release-event> </release-event-list> <barcode>5055036260756</barcode> <asin>B0006ZIDJO</asin> <cover-art-archive> <artwork>true</artwork> <count>1</count> <front>true</front> <back>false</back> </cover-art-archive> </release>
http://musicbrainz.org/ws/2/release/00897556-cb7a-3417-97aa-756b3fdc77c9?inc=user-tags
Hmmm... exactly the same! It turns out that tags on individual releases are less common than tags on release groups. So, let's take the release group and query that...
<release-group type="Album" id="f3f82b80-b2c5-3151-be53-5cb5803860e0"> <title>Silent Alarm</title> <first-release-date>2005-02-02</first-release-date> <primary-type>Album</primary-type> <tag-list> <tag count="1"> <name>2005</name> </tag> <tag count="1"> <name>alternative rock</name> </tag> <tag count="2"> <name>best albums ever</name> </tag> <tag count="2"> <name>brit pop</name> </tag> <tag count="1"> <name>britannique</name> </tag> <tag count="1"> <name>british</name> </tag> <tag count="1"> <name>britpop</name> </tag> <tag count="1"> <name>indie</name> </tag> <tag count="6"> <name>indie rock</name> </tag> <tag count="1"> <name>overlong</name> </tag> <tag count="1"> <name>perfect debut</name> </tag> <tag count="1"> <name>post-punk revival</name> </tag> <tag count="1"> <name>pregaptrack</name> </tag> <tag count="4"> <name>rock</name> </tag> <tag count="1"> <name>rock and indie</name> </tag> <tag count="1"> <name>uk</name> </tag> </tag-list> </release-group>
http://musicbrainz.org/ws/2/release-group/f3f82b80-b2c5-3151-be53-5cb5803860e0?inc=tags
(Note the use of tags
rather than user-tags
here).
Much better! Now we see the weakness of this approach: because the data is crowd sourced, there
can be all sorts of data in there. It's best not to use this data without user intervention, or
confirmation. The count
attributes at least allow you to discover the most commonly
applied tags.
Note that the tags stored in MusicBrainz are classified as supplementary data and as such are subject to a different data licence.
Thanks to tristanf who made the the image above available for sharing.