Two ways to auto tag
Digital music files contain tags that describe information about the musical contents, alongside the actual audio data. This information includes everything from the song title and the name of the containing release to its year of publication.
It is this data that music programs use to organise and categorise musical collections in helpful ways, such as searching by genre or era; without the appropriate data, people cannot make use of these features. If you have a widespread absence of metadata in your music files that, combined with the size of modern music collections, means your music library becomes impossible to browse and search.
But that presents a problem: if metadata is missing, how can the relevant information be discovered? If we only have the audio data to go on, this would involve a human listening to each piece of music and deducing the release. For large music collections this is not practical, so methods to automatically identify and tag missing information into music files have been developed.
Two ways to automatically identify music collections have emerged. The first, which only works for CD sourced music, is an online database that matches the table of contents of discs as they are ripped, to known album data. The second is audio fingerprinting, which attempts to recognise individual audio tracks based on how they sound. Both of these methods are described and compared here.
CD TOC based
An early solution to automatic tagging was the Compact Disc Database (CDDB). The database contained information about the table of contents of published discs, such as the number of tracks and the length of each. Since the combined specific lengths of the tracks are unlikely to be shared from disc to disc, it served as a semi-reliable identifier. Thus when disc ripping programs were used to copy discs, they would often be able to identify it purely by its declared table of contents.
This proved an effective method for the copying of commercial discs, providing the database was well maintained and up to date. However, this system is simply not useable to identify single tracks, or tracks from discs of any other nature; perhaps where the tracks are out of order, or a disc containing mixed songs burned by a friend.
Furthermore, while the summation of track positions is unlikely to be replicated on other CDs, it does happen and so clashes sometimes result. In my own anecdotal experience I would guess this happens about 10% of the time.
Audio fingerprint based
A more robust and flexible alternative is audio fingerprinting; this tries to intelligently recognise individual tracks by their audio signals. This is done by software that essentially tries to mimic how a human might recognise music, by paying attention to how the music actually sounds, and comparing distinctive acoustics.
Since the algorithms rely on comparing how the music sounds rather than the underlying data, audio fingerprinting has the benefit of being able to work with many formats. It also allows tracks to be recognised independently of others from an album or associated disc. However, analysing audio data is computationally expensive, as is the comparison of such data, making this method slower than simply searching a database with track timings.
There are a number of audio fingerprint services. A famous one is Shazam which uses the technology to recognise clips of music in everyday situations.
Overall, the best method to tag music collections depends on the specific needs of the user. If their collection consists of professionally produced discs that are likely to exist in public databases, and if they can afford to manually edit tags for those that do not, then using CD TOC based lookups should be sufficient. If the user has aggregated music from other sources, such as the Internet, and it is not neatly arranged into full albums, then audio fingerprinting is likely to be the most appropriate and effective.
Thanks to Uberto for the image above.