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

Re: ExtAudioFileRead performance


  • Subject: Re: ExtAudioFileRead performance
  • From: Doug Wyatt <email@hidden>
  • Date: Fri, 2 Oct 2009 14:27:09 -0700


On Oct 1, 2009, at 21:28 , Dominic Feira wrote:

So I am to understand that extaudiofile doesn't read in larger chunks from disk for me.

It uses a 64K internal buffer. This is overridable via kExtAudioFileProperty_IOBufferSizeBytes.



Even with your description though I don't see why it would take as long as it is. 0.4 seconds is pretty excessive for reading and decoding a single packet of apple lossless.

When you ask for 256 frames, that can trigger a 64K disk read and a decode cycle. The implementation could well be decoding more than one packet, like, all of the packets it just read... (I could go dig into it and the underlying AudioConverter and codec some more and tell you for sure, but I think for your purposes it's best to assume the worst, that this can happen).


All that said, 0.4 seconds is still a horribly long time. Try "sudo fs_usage -f filesys". Can you catch a long disk read in the act? Once I spent two days debugging something like this. I made a copy of the file and it stopped happening. I ultimately discovered that I had a bad block on my disk that was being retried many times, every time it was read.

Doug



I will make the suggested adjustments.

-- Dominic

On Oct 1, 2009, at 22:16, William Stewart <email@hidden> wrote:


On Oct 1, 2009, at 10:45 AM, Dominic Feira wrote:

I'm getting some really poor performance with ExtAudioFileRead sometimes. While reading audio from a m4a with Apple Lossless in it, it sometimes takes an extremely long time to complete the read. Typically it takes on 0.000002 seconds to complete the read. Then out of nowhere it takes approximate 0.4 seconds to complete the read. The reads are for 256 samples of audio at a time. Perhaps this should be larger?

Yes

The only thing that I can think of is disk contention, but at 0.4 seconds that seems like a long time even for disk contention.


Does anybody have any ideas why ExtAudioFileRead could be so slow?

Apple Lossless is packetised into data chunks that are 4096 samples long. So, probably what is happening is that you are reading 1 packet, decoding it (you have 4096 samples), and ExtAudioFile returns you your 256 samples. Then you read again, it already has enough decoded data, so it just passes you back the next 256 samples, and again, until eventually it runs out and has to actually go and read some more and decode it, then it starts again.


But really, this is a very poor way of interacting with the file system. You should be reading larger chunks when you have to go and read.

Bill

Dominic Feira / Code Monkey / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com


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
References: 
 >ExtAudioFileRead performance (From: Dominic Feira <email@hidden>)
 >Re: ExtAudioFileRead performance (From: William Stewart <email@hidden>)
 >Re: ExtAudioFileRead performance (From: Dominic Feira <email@hidden>)

  • Prev by Date: RE: AU, Obj-C and names
  • Next by Date: iPhoneOS 3.1 and kAudioSessionProperty_OverrideCategoryEnableBluetoothInput
  • Previous by thread: Re: ExtAudioFileRead performance
  • Next by thread: Re: CAF file, testing chunk types?
  • Index(es):
    • Date
    • Thread