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

Re: AudioQueueOfflineRender


  • Subject: Re: AudioQueueOfflineRender
  • From: Bruce Meagher <email@hidden>
  • Date: Fri, 11 Dec 2009 15:23:26 -0800

Hi Yuri,

I ran into a similar problem a few month back. If you look at the code I believe there is a bug in the use of the mFlushed flag. In the AQTestBufferCallback once the end of file is reached the code calls AudioQueueFlush and then sets the mFlushed flag to true (lines 88-96). However in the main loop of the code rendering the data (lines 322-334) you'll notice the code breaks out of the loop as soon as the mFlushed flag is set to true. So depending on the amount of data passed to the audio queue in the last buffer callback and the size of the capture buffer I believe the code will not render the entire file. Of course I could be completely wrong, but that was my take.

Bruce

On Dec 11, 2009, at 2:43 PM, Yuri Yuriev wrote:

afconvert /Users/yuri/Downloads/test.mp3 /tmp/out.caf -d LEI16 -f caff -v

Input file: test.mp3, 39168 frames
Formats:
  Input file     1 ch,  44100 Hz, '.mp3' (0x00000000) 0 bits/channel,
0 bytes/packet, 1152 frames/packet, 0 bytes/frame
  Output file    1 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit
little-endian signed integer
Optimizing /tmp/out.caf... done
Output file: out.caf, 39168 frames


afinfo /tmp/out.caf

File:           /tmp/out.caf
File type ID:   caff
Data format:     1 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit
little-endian signed integer
                no channel layout.
estimated duration: 0.888 sec
audio bytes: 78336
audio packets: 39168
audio 39168 valid frames + 0 priming + 0 remainder = 39168
bit rate: 705600 bits per second
packet size upper bound: 2
audio data file offset: 4096
optimized
sound check:
    approximate duration in seconds          0.888
----

--
Yuri Yuriev

2009/12/12 William Stewart <email@hidden>

ok - so the estimated duration here is an estimate - the whole file hasn't been parsed at this point. If you run afconvert on this file:


% afconvert /Users/yuri/Downloads/test.mp3 /tmp/out.caf -d LEI16 -f caff -v

Then:
% afinfo /tmp/out.caf

what does that say?

On Dec 11, 2009, at 11:25 AM, Yuri Yuriev wrote:

I have many short duration (less than 1 second) mp3 files.

afinfo /Users/yuri/Downloads/test.mp3
File: /Users/yuri/Downloads/test.mp3
File type ID: MPG3
Data format: 1 ch, 44100 Hz, '.mp3' (0x00000000) 0 bits/ channel, 0 bytes/packet, 1152 frames/packet, 0 bytes/frame
no channel layout.
estimated duration: 0.888 sec
audio bytes: 11315
audio packets: 34
audio 39168 valid frames + 0 priming + 0 remainder = 39168
bit rate: 101000 bits per second
packet size upper bound: 1052
maximum packet size: 417
audio data file offset: 417
optimized


I have Mac OS X 10.5.8, 10.6.2, iPhone OS 2.2, iPhone OS 3.1... All have the same issue.

I have try to convert original sounds to CBR mp3, try to use differents encoders... no luck.


Do I need change something in aqrender.cpp?

P.S. I have no problem with ExtAudioFile API and AudioConverter API. But it is does't work with mp3 on iPhone OS 2.2 (only 3.0+).

--
Yuri Yuriev

11.12.2009 23:54, William Stewart пишет:

probably something odd about the MP3 file. If you do afinfo on this file
on the desktop, how long does it report it being?


On Dec 11, 2009, at 1:15 AM, Yuri Yuriev wrote:

Hi all!

I am trying to convert mp3 file to caf (PCM) in my programm (Mac OS X
and iPhone 2.2+).


I am using aqrender sample from Apple:
http://developer.apple.com/mac/library/samplecode/AudioQueueTools/AudioQueueTools.zip
(aqrender.cpp)

My mp3 file:
http://www.yuriev.info/test.mp3 (00:00:00.7)

But duration of caf audio file is 00:00:00.5. aqrender cut the end of
source mp3 file.


Where is my mistake?

Thank you!

--
Yuri yuriev

_______________________________________________
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

_______________________________________________
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
References: 
 >AudioQueueOfflineRender (From: Yuri Yuriev <email@hidden>)
 >Re: AudioQueueOfflineRender (From: William Stewart <email@hidden>)
 >Re: AudioQueueOfflineRender (From: Yuri Yuriev <email@hidden>)
 >Re: AudioQueueOfflineRender (From: William Stewart <email@hidden>)
 >Re: AudioQueueOfflineRender (From: Yuri Yuriev <email@hidden>)

  • Prev by Date: Re: AudioQueueOfflineRender
  • Next by Date: Re: API for switching audio output device or disabling output altogether
  • Previous by thread: Re: AudioQueueOfflineRender
  • Next by thread: RemoteIO audioUnit headphone output left side only on iphone
  • Index(es):
    • Date
    • Thread