• 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: Loop Audio on iPhone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loop Audio on iPhone


  • Subject: Re: Loop Audio on iPhone
  • From: Marco Papa <email@hidden>
  • Date: Thu, 19 Feb 2009 11:50:59 -0800

Date: Tue, 17 Feb 2009 14:46:07 -0800
From: William Stewart <email@hidden>
Subject: Re: Loop Audio on iPhone
To: Marco Papa <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset="us-ascii"

On Feb 17, 2009, at 2:31 PM, Marco Papa wrote:

> Bill,
>
> I did some more research. You say in your post below:
>
> "AudioQueue's buffer routines provide a trimming function for just
> this purpose. AVAudioPlayer uses these."
>
> I did the same exercise you mentioned below. I obtained a fairly
> long "uncompressed" WAV file. I played it using the "loop" function
> of AVAudioPlayer: the loop worked flawlessly.
>
> Then I encoded it with AAC and stored in a CAF file using afconvert,
> as suggested in your post below.
>
> I verified using afiinfo that the "priming frames" (2112) at the
> beginning and the "remainder frames" at the end are also stored in
> the CAF file.
>
> Then I tried to loop the CAF file using AudioQueuebuffer routines
> (using AudioFileGetProperty((audio_file,
> kAudioFilePropertyPacketTableInfo,... to get the priming and
> remainder frames totals ). This seems to also loop fine.
>
> Then I tried to loop the CAF file using AVAudioPlayer routines using
> the same code that loops fine with the uncompressed WAV file. This
> one did NOT loop fine and there is a very audible glitch.


>
> I tried both of the above using the iPhone Simulator - 2.2.1 (latest
> release).  I haven't tried it an actual iPhone yet, but I would not
> expect it to be any different.
>
> Should I submit a bug report?

For sure (and if you can include your code that will be great) - I
would have expected this to work. Thanks

Bill

I did some more experimenting and I'm happy to report that the "looping glitch" bug present with AAC/CAF compressed files using AVAudioPlayer is NOT present when using IMA4/CAF compressed files. 

The only difference that I could see is the fact that AAC/CAF files have 2112 priming frames, while IMA4/CAF files have 0 priming frames. as produced by afconvert. Both formats have remainder frames. 

You can use afconvert as in:

afconvert -f caff -d ima4 audiofiile.wav

to do the conversion.

IMA4 files are not as "compressed" as AAC files (on the average they are 3 times bigger), but you still get a compressed file that is 1/4 of the size of the original WAV uncompressed file.

Marco Papa, Ph.D.
Computer Science Department
University of Southern California
Henry Salvatori Computer Center
Los Angeles, California 90089-0781
Voice: +1-213-974-2137
Cell: +1-310-944-5468
E-mail: 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:
    • Re: Loop Audio on iPhone
      • From: Marco Papa <email@hidden>
  • Prev by Date: Re: Audio unit hosting
  • Next by Date: Recommend way for an Audio Unit to implement a background timer
  • Previous by thread: Re: Loop Audio on iPhone
  • Next by thread: Re: Loop Audio on iPhone
  • Index(es):
    • Date
    • Thread