How can I get album artwork, song name, album name and artist name from an audio file? I need to display this without the use of iTunes. Thanks.
views:
51answers:
3The QuickTime APIs support that, but they aren't ObjC. It'll still work fine though.
http://developer.apple.com/library/mac/#qa/qa2001/qa1135.html
Part of my SFBAudioEngine framework supports reading and writing metadata for AIFF, WAVE, AAC, Apple Lossless, MP3, FLAC, Vorbis, Musepack and WavPack. The code is C++ and BSD licensed.
AFAIK there is no native support for reading/writing FLAC metadata (or FLAC audio for that matter) in OS X.
If the file has been indexed by Spotlight, you can use the Metadata framework to examine it. Create an MDItem for the file, then ask it for the attributes you're interested in.
The attributes of a song are:
kMDItemTitle
kMDItemAuthors
(Artist(s)—value is an array of strings)kMDItemAlbum
For the album art, you'll need to request a thumbnail image for the file from Quick Look. This isn't foolproof, but should work on most systems, as long as the Quick Look generator for audio files uses the album art if present.