• 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: afinfo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: afinfo


  • Subject: Re: afinfo
  • From: Robert Martin <email@hidden>
  • Date: Thu, 4 Nov 2010 23:15:41 -0400

You can also use AudioFileGetProperty with kAudioFilePropertyEstimatedDuration - (see AudioFile.h)

On Nov 4, 2010, at 6:40 PM, Jean-Daniel Dupas wrote:

>
> Le 4 nov. 2010 à 22:20, email@hidden a écrit :
>
>> Hi,
>>
>> I have set up a NSTask to log the afinfo output, which works already.
>> My question is:
>> Is there an argument that gives me back only the duration of the audiofile ?
>> In the terminal I can do this with  -afinfo filename | grep "estimated duration" ,
>> but that does not work with NSTask.
>>
>
> What about using CoreAudio API instead ?
>
> ExtAudioFileRef file;
> if (noErr == ExtAudioFileOpenURL(myURL, &file)) {
> 	UInt64 frames = 0;
> 	AudioStreamBasicDescription desc;
> 	UInt32 pfSize = sizeof(UInt64), descSize = sizeof(AudioStreamBasicDescription);
> 	if (noErr == ExtAudioFileGetProperty(file, kExtAudioFileProperty_FileDataFormat, &descSize, &desc) &&
> 		noErr == ExtAudioFileGetProperty(file, kExtAudioFileProperty_FileLengthFrames, &pfSize, &frames)) {
> 		double duration = frames / desc.mSampleRate;
> 	}
> 	ExtAudioFileDispose(file);
> }
>
>
> -- Jean-Daniel
>
>
>
>
> _______________________________________________
> 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

 _______________________________________________
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:
    • trouble creating working Apple Lossless file under iOS 3.2
      • From: Christopher Penrose <email@hidden>
References: 
 >afinfo (From: email@hidden <email@hidden>)
 >Re: afinfo (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: MeteringView exc_bad_access
  • Next by Date: trouble creating working Apple Lossless file under iOS 3.2
  • Previous by thread: Re: afinfo
  • Next by thread: trouble creating working Apple Lossless file under iOS 3.2
  • Index(es):
    • Date
    • Thread