• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 58
  • Last Modified:

mp3 analyzer


I whant to develop an application that could add ID3 info to
my mp3s, info that would be taken from musicbrainz.org or other db
So I need a library that could analyze the mp3 file and give me some
object that I could use it for retrieving that info.

2 Solutions
Which kind of information you should retrieve from the MP3? the only metadata you have are the ID3 tags.
CinarAuthor Commented:
I'm interested in ID3, I know how to read/write them,
now I'm interested in a library that could somehow analyze the mp3, create a hashcode or something and use that for retrieving ID3 info from musicbrainz.org
I can't comment about "MusicBrainz" however, when using freedb (http://www.freedb.org) you need to compute an ID for the CD you have taken a track from, you can find all this information on their site in the "Software->Howto" sections:

But in essence, when you connect to their server to identify a track, you need to provide a disc ID.  This is an 8-digit hexadecimal (base-16) number, computed using data from a CD's Table-of-Contents (TOC) in MSF (Minute Second Frame) form.

--- Below is taken directly from the freedb.org "how-to" file regarding generating an ID to use with their service ---

The following is a C code example that illustrates how to generate the CDDB/freedb disc ID. Examples in other programming languages may be found on the freedb web site at http://www.freedb.org in the developers-section. A text description of the algorithm follows, which should contain the necessary information to code the algorithm in any programming language.

struct toc
      int      min;
      int      sec;
      int      frame;

struct toc cdtoc[100];

      /* Do whatever is appropriate to read the TOC of the CD
       * into the cdtoc[] structure array.
      return (tot_trks);

cddb_sum(int n)
      int      ret;

      /* For backward compatibility this algorithm must not change */

      ret = 0;

      while (n > 0) {
            ret = ret + (n % 10);
            n = n / 10;

      return (ret);

unsigned long
cddb_discid(int tot_trks)
      int      i,
            t = 0,
            n = 0;

      /* For backward compatibility this algorithm must not change */

      i = 0;

      while (i < tot_trks) {
            n = n + cddb_sum((cdtoc[i].min * 60) + cdtoc[i].sec);

      t = ((cdtoc[tot_trks].min * 60) + cdtoc[tot_trks].sec) -
          ((cdtoc[0].min * 60) + cdtoc[0].sec);

      return ((n % 0xff) << 24 | t << 8 | tot_trks);

      int tot_trks;

      tot_trks = read_cdtoc_from_drive();
      printf("The discid is %08x", cddb_discid(tot_trks));

This code assumes that your compiler and architecture support 32-bit integers.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

MurpheyApplication ConsultantCommented:
Hi Cinar,

xelous is right, however... you need the exact info from the tracks, so if you rip the MP3 with specific options, like remove silence or a specific compression like Lame, there is a big chance that it's not possible to calculate the right disc ID. On top of that is the calculation based on the "CD's Table-of-Contents (TOC) in MSF (Minute Second Frame)", in a lot of cases, the total time in the TOC is not the same as the summmary of all tracks :-S
So if you have a lot of MP3's and don't have the original disk, there is a big chance that you cant calculate the info.

I'm pretty sure, because I had to tag over 21.000 MP3's and had to do it while ripping or manually because the calculation won't work. By manually processing you can use a tool like "The Godfather", than it will save you manual work becaus this program can generate the info fro the file/path structure.

Regards and good luck,
I've requested that this question be deleted for the following reason:

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Not enough information to confirm an answer.

If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Auto Deleter
MurpheyApplication ConsultantCommented:
xelous and I give enough information, so I assume the problem is solved and  Cinar is not willing to assign the answer

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now