2009-11-26 - Adding MusicBrainz Support to JMusicMetaManager

Download Report

Transcript 2009-11-26 - Adding MusicBrainz Support to JMusicMetaManager

Adding MusicBrainz
Support to
jMusicMetaManager
Bruno Angeles
McGill University – Schulich School of Music
MUMT-621
Fall 2009
1/18
Outline



Introduction

jMusicMetaManager and MusicBrainz

Some Programming Definitions

ID3v1 vs ID3v2
Changes

From java_mp3 to jid3lib

Code Sections of Interest
Finishing the Project

Improvements

//TODO:

Current Issues
2/18
What is jMusicMetaManager?
[…] a tool for improving metadata
associated with recordings by
automatically detecting inconsistencies
and redundancies.
(McKay et al. 2006)
3/18
What is MusicBrainz?
MusicBrainz is a user-maintained
community music metadatabase.
http://musicbrainz.org/doc/AboutMusicBrainz
4/18
Some Programming Definitions

Object-Oriented Programming
Programming paradigm
Objects & Classes: Shapes example

GUI
Graphical User Interface

String
Sequence of characters

Hash table
Array of values accessed with a key
5/18
ID3v1 vs ID3v2


ID3v1

30 bytes max per field

Metadata is at the end of the file

ID3v1.1: add 60 bytes to title, artist, album

(ID3v1.2: comment 3043 bytes)
ID3v2

Use Frames (hash table) of max total size 256MB!

Internationalization: different character sets

Metadata is at the start of the file  streaming

ID3v2.1, ID3v2.2, ID3v2.3

ID3v2.4: not widely supported
6/18
From java_mp3 to jid3lib



java_mp3 (even the latest release 0.4
December 2008) supports ID3v1 but only
ID3v2.0 (i.e., revision 0)
jid3lib supports:

ID3v1.0 and ID3v1.1

ID3v2.0 to 4
Other JAVA libraries for ID3 tags: jaudiotagger, Entagged ,
AudioTT, Axone , ID3v2 Audio Text Tools, ID3v2 Chapter Tool,
Jaikoz, etc.
7/18
Code Sections of Interest

ID3 library change  Metadata abstraction

Class RecordingMetaData:
public RecordingMetaData(File mp3_file)

Reporting choices

Class AnalysisPreferences
handle GUI selections

Report generation

Class AnalysisProcessor
new method reportMusicBrainz()

MusicBrainz querying


Class MusicBrainzProcessor
GUI
8/18
MusicBrainzProcessor Class
jMusicMetaManager
1
1
MusicBrainzProcessor
+MIN_WAITING_TIME_BETWEEN_QUERIES : int
-timeOfLastQuery : long
-maxNumberOfHits : long
-musicbrainzQuery
+MusicBrainzProcessor()() : void
+GetArtists()() : string
+GetReleases()() : string
+GetTracks()() : <unspecified>
Uses libmusicbrainz-java library (revision 12315) for querying
9/18
reportMusicBrainz()
Iterate through all parsed files:
1. Fetch artist name
2. Fetch album name (using artist name)
3. Fetch title (using artist and album names)
10/18
GUI Changes
11/18
GUI Changes
12/18
Sample Report
In browser
13/18
Improvements

More files can now be read by the software!

Simplest report, full personal library (all MP3, no
iTunes XML):



Previously: read only 6 985/10 377 = 67% of ID3 tags
(mostly because of ID3v2 revision > 0)
Now: reads 9 892 / 10 377 = 95% of ID3 tags

Character set when reading year  can be fixed

ID3 tag exception  to investigate
Basic MusicBrainz support so far
14/18
//TODO:

Improve MusicBrainz hit rate

Handle weird character sets

Create an ID3 randomizer for testing purposes?

Add more options to the MusicBrainz report

Add MusicBrainz links to the report

Maintain all the metadata fields from the previous
implementation

Try other available libraries that support ID3v2.4

Use other MusicBrainz servers to avoid low query rate?

Figure out if the credentials are necessary
15/18
Current Issues

jid3lib: simplifies a lot of data fetching, but not
everything!



Hash tables with different keys across revisions
Managed fields so far in my project: artist, album, title, composer, year
(first 4 chars MUST be numbers), compilation, comments (only ID3v1),
genres, bit_rate
Data integrity:



String fields that are converted to numerical values
Files with both ID3v1 and ID3v2 metadata
Read v2, else read v1? Read v1, then overwrite with v2?
Handling different character sets
ÿþ  0xFF 0xFE signature of UTF-16 encoding
16/18
Current Issues (continued)

Random IOExceptions

Tags that exist in 2 places:

Comments / SongComments

Year / YearReleased

Compilation tag: only if folder contains “Compilation”

Limit of 1 query per second can slow down reporting

10 377 queries take a minimum of 2 h 53 min
17/18
References
McKay, C., D. McEnnis, and I. Fujinaga. 2006. A large publicly accessible prototype audio
database for music research. In Proceedings of the International Conference on Music
Information Retrieval. Victoria, Canada. 160–3.
Links
Dan O’Neill. 2009. Home – ID3.org. http://www.id3.org/ (accessed 26 November 2009)
Cory McKay. 2006. jMusicMetaManager.
http://jmir.sourceforge.net/manuals/jMusicMetaManager_manual/Manual.html (accessed
26 November 2009)
Eric Farng. 2005. Java ID3 Tag Library. http://javamusictag.sourceforge.net/ (accessed 26
November 2009)
18/18