Accessing Metadata In Sound App

Discussion in 'Mac Programming' started by kingsapo, Oct 25, 2010.

  1. kingsapo macrumors member

    Jun 10, 2010
    Hey all! This forum has never let me down before, so here's my question. I'm trying to make a basic app that will let you select a song (via a file-picker), play the song, and display some metadata (such as album, artist, etc.). I already have the file-picker setup, my need for help is in finding a framework that will allow for basic audio playback, and retrieval (and possibly editing) of metadata. Editing isn't a necessity, though it would be nice.

    Sorry if this is kinda a noobie question, but I've done my research, gone through QTKit, OpenCL, and some other audio framework that I can't remember, and can't seem to find a clear answer on how, if possible, to retrieve metadata.

    As usual, any help is greatly appreciated!
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    I don't know why you think OpenCL might have been relevant. AFAICT it has nothing to do with media or metadata.

    ID3 is a common media metadata format. It was easy to find this:
    using the search terms: mac os x id3 lib

    If the file has been indexed by the Spotlight system:
    then you can also get its metadata using NSMetadataQuery (google it). That way you don't need to know what format the file is, nor what format its metadata is.

    NSMetadataQuery will provide a single API regardless of how metadata is stored in the file, so I'd start with that first. If the desired data isn't returned in the result, only then resort to an ID3 lib and decoding the metadata yourself. Since the metadata might not be in ID3, letting Spotlight do the hard work will be the simplest thing that could possibly work, and that's almost always a good starting place.
  3. kingsapo thread starter macrumors member

    Jun 10, 2010
    thanks, the NSMetadataQuery sounds better, considering I'll be developing this for the (to be released) Macintosh App Store, which, as far as I know, doesn't allow 3rd-party APIs, which id3lib is. I'll definitely look into NSMetadataQuery, thanks for the suggestion!
  4. kainjow Moderator emeritus


    Jun 15, 2000
    I believe you can, you just can't install it as a framework/library into the user's computer. You'd have to bundle it with your .app as a framework/dylib (which you should do anyways).
  5. kingsapo thread starter macrumors member

    Jun 10, 2010
    thanks, it's good to know I can use a 3rd party API if I bundle it within the app
  6. kingsapo thread starter macrumors member

    Jun 10, 2010
    Woops! I just realized that I meant OpenAL, not CL. I can see how that wouldn't make sense :D
  7. fernandovalente macrumors 6502


    Aug 29, 2008
    Third world **** hole, I mean, Brazil
    QTKit does the job, but the best one is TagLib

Share This Page