Re: Audio playing too fast but not simply sped up
Re: Audio playing too fast but not simply sped up
- Subject: Re: Audio playing too fast but not simply sped up
- From: "Hamish Allan" <email@hidden>
- Date: Mon, 22 Dec 2008 16:44:23 +0000
Apologies for replying to my own post, but I've discovered what my bug
was. I was implementing half a workaround for a bug which used to
exist in AudioFileStreamParseBytes (as described in
http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html
-- but I was passing kAudioFileStreamParseFlag_Discontinuity not only
immediately after kAudioFileStreamProperty_ReadyToProducePackets, but
also in every subsequent call). The bug doesn't exist any more, so the
workaround is unnecessary.
Sorry for the noise,
Hamish
On Sun, Dec 21, 2008 at 11:35 PM, Hamish Allan <email@hidden> wrote:
> Hi,
>
> I'm currently trying to write an AVAudioPlayer-alike Objective-C
> class, but which can handle remote URLs as well as local.
>
> I've written some lightweight wrapper classes for AudioQueue,
> AudioQueueBuffer and AudioFileStream, but when I use them to play an
> MP3 stream (of indeterminate length) it sounds sped up; not
> straightforwardly as if the sample rate were altered, but sort of
> bubbly or watery, as if packets were being dropped or played only
> partially.
>
> I've made a minimal XCode project available at
> http://hamish-cocoa-dev-examples.googlecode.com/files/AQAudioPlayer-0.1.zip
> and I would appreciate it if any of the audio experts on this list
> could spare a few moments, not even to look at the code but just to
> listen to the effect and tell me what it suggests to their experienced
> ear.
>
> (Though of course, if anyone did have the time to cast an eye over the
> code, that would be much appreciated; as I say, it's really very
> lightweight and minimal right now.)
>
> The console output from a typical run is below. Note that although I
> enqueue several buffers before starting playback, they are recycled
> faster than they are enqueued, which leads to an eventual buffer
> underrun (i.e. jitter). Oddly, once this starts to happen, it's not
> long before total silence, which is not what I would expect; you see
> that the last couple of buffers are recycled only milliseconds after
> they are enqueued. Perhaps this might ring a bell with someone?
>
> Many thanks,
> Hamish
>
> 2008-12-21 23:27:02.542 AQAudioPlayer[59297:20b] startProducing YES
> 2008-12-21 23:27:03.928 AQAudioPlayer[59297:20b]
> fileStream:didFindAudioStreamBasicDescription
> 2008-12-21 23:27:04.930 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x589fe0 enqueued +
> 2008-12-21 23:27:06.913 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x5aa980 enqueued +
> 2008-12-21 23:27:13.493 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x57ce50 enqueued +
> 2008-12-21 23:27:13.967 AQAudioPlayer[59297:20b] startConsuming YES
> 2008-12-21 23:27:16.978 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x589fe0 recycled -
> 2008-12-21 23:27:18.527 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x5aaa80 enqueued +
> 2008-12-21 23:27:21.468 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x5aa980 recycled -
> 2008-12-21 23:27:24.227 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x589fe0 enqueued +
> 2008-12-21 23:27:25.094 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x57ce50 recycled -
> 2008-12-21 23:27:29.087 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x5aaa80 recycled -
> 2008-12-21 23:27:30.001 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x5aa980 enqueued +
> 2008-12-21 23:27:33.590 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x589fe0 recycled -
> 2008-12-21 23:27:35.851 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x57ce50 enqueued +
> 2008-12-21 23:27:37.480 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x5aa980 recycled -
> 2008-12-21 23:27:41.313 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x57ce50 recycled -
> 2008-12-21 23:27:41.650 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x589fe0 enqueued +
> 2008-12-21 23:27:45.456 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x589fe0 recycled -
> 2008-12-21 23:27:47.425 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x57ce50 enqueued +
> 2008-12-21 23:27:50.039 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x57ce50 recycled -
> 2008-12-21 23:27:53.276 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x589fe0 enqueued +
> 2008-12-21 23:27:53.341 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x589fe0 recycled -
> 2008-12-21 23:27:59.050 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x57ce50 enqueued +
> 2008-12-21 23:27:59.088 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x57ce50 recycled -
> 2008-12-21 23:28:04.924 AQAudioPlayer[59297:20b] + AudioQueueBuffer
> 0x589fe0 enqueued +
> 2008-12-21 23:28:05.004 AQAudioPlayer[59297:20b] - AudioQueueBuffer
> 0x589fe0 recycled -
>
_______________________________________________
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