• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iOS audio file metadata
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iOS audio file metadata


  • Subject: Re: iOS audio file metadata
  • From: Wil Macaulay <email@hidden>
  • Date: Tue, 29 Mar 2011 18:38:24 -0400

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:
https://devforums.apple.com/message/409115#409115

{
  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

  • Follow-Ups:
    • Re: iOS audio file metadata
      • From: Brian Gerstle <email@hidden>
References: 
 >iOS audio file metadata (From: Brian Gerstle <email@hidden>)

  • Prev by Date: iOS audio file metadata
  • Next by Date: Re: iOS audio file metadata
  • Previous by thread: iOS audio file metadata
  • Next by thread: Re: iOS audio file metadata
  • Index(es):
    • Date
    • Thread