PDA

View Full Version : Accessing Metadata In Sound App




kingsapo
Oct 25, 2010, 05:42 PM
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!



chown33
Oct 25, 2010, 06:56 PM
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:
http://id3lib.sourceforge.net/
using the search terms: mac os x id3 lib

If the file has been indexed by the Spotlight system:
http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/MetadataIntro/MetadataIntro.html
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.

kingsapo
Oct 25, 2010, 07:55 PM
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!

kainjow
Oct 25, 2010, 09:14 PM
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 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).

kingsapo
Oct 27, 2010, 07:31 AM
thanks, it's good to know I can use a 3rd party API if I bundle it within the app

kingsapo
Oct 28, 2010, 03:16 PM
I don't know why you think OpenCL might have been relevant. AFAICT it has nothing to do with media or metadata.

Woops! I just realized that I meant OpenAL, not CL. I can see how that wouldn't make sense :D

fernandovalente
Oct 28, 2010, 09:01 PM
QTKit does the job, but the best one is TagLib