Re: iOS audio file metadata
Re: iOS audio file metadata
- Subject: Re: iOS audio file metadata
- From: Wil Macaulay <email@hidden>
- Date: Wed, 30 Mar 2011 10:23:54 -0400
For mp3 files, I used the info dictionary, which seems to properly return the required info. For AAC files, I parsed the file manually, looking for atoms. I used
kAudioFilePropertyDataOffset
to find out how big the header is.
I used this site as documentation for the atoms:
it seems that there is no standard for aac metadata other than Apple's de-facto standard.
There are some existing pure-C libraries for manipulating the metadata, I believe, but I wanted an objective-C library.
And no, I have not explored WAV files.
wil
On Wed, Mar 30, 2011 at 10:04 AM, Brian Gerstle
<email@hidden> wrote:
Hey Wil, thanks for replying. I wouldn't go so far as to ask you to write it for me, but I do have a couple questions. When reading metadata, did you use the info dictionary or ID3 tag? Did you use built-in functions or parse the file manually (e.g. using fopen)? Also, have you tried working with metadata in WAV files?
Thanks again!
Brian
On Mar 29, 2011, at 6:38 PM, Wil Macaulay wrote:
I wrote some code to read aac and mp3 metadat, but not write. If there is any interest (and no current implementation) I could make it available through github or the like.
wil
On Tue, Mar 29, 2011 at 6:34 PM, Brian Gerstle
<email@hidden> wrote:
Hello everyone,
I was wondering if anyone has experience reading & writing metadata to an audio file in iOS. So far we've tried:
- AudioFileGet/SetProperty
- kAudioFilePropertyInfoDictionary
- kAFInfoDictionary_Comments
- kAudioFilePropertyID3Tag
I'm getting the 'pty?' error code returned when I try to write to the info dictionary or read the ID3 tag. Also, the only "visible" key/value pair when I get the dictionary is the "approximate duration." I've attached some code to demonstrate how I'm trying to use these functions.
Thanks in advance!
Brian
P.S.
My colleague also posted to Apple's Core Audio support forum:
{
NSURL* url = [ NSURL fileURLWithPath: path2 ];
OSStatus err;
AudioFileID fileID;
err = AudioFileOpenURL ((CFURLRef)url, kAudioFileReadWritePermission, kAudioFileWAVEType,&fileID );
if (err == noErr)
{
CFDictionaryRef fileDict = nil;
UInt32 size = sizeof(fileDict);
err = AudioFileGetProperty(fileID, kAudioFilePropertyInfoDictionary, &size, &fileDict);
if (err == noErr)
{
NSDictionary* dict = (NSDictionary*) fileDict;
NSLog(@"%@",dict);
NSMutableDictionary* dict2 = [ [ NSMutableDictionary alloc ] init ];
[ dict2 addEntriesFromDictionary:dict ];
[ dict2 setObject:@"test" forKey: [ NSString stringWithUTF8String:kAFInfoDictionary_Comments ] ];
err = AudioFileSetProperty(fileID, kAudioFilePropertyInfoDictionary, size, dict2);
if (err == noErr)
{
// this point isn't reached
NSLog(@"saved");
}
}
AudioFileClose(fileID);
}
}
...
{
UInt32 outDataSize = 0;
UInt32 isWritable = 0;
// 'pty?' error here
err = AudioFileGetPropertyInfo(fileID,kAudioFilePropertyID3Tag,&outDataSize,&isWritable);
NSLog(@"outDataSize %d isWritable %d",outDataSize,isWritable);
unsigned char* id3data = malloc(outDataSize);
err = AudioFileGetProperty(fileID, kAudioFilePropertyID3Tag, &outDataSize, id3data);
err++;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Products and services:
http://flagpig.com
Blog:
http://flagpig.tumblr.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Products and services:
http://flagpig.comBlog:
http://flagpig.tumblr.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden