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

Re: CAPlayThrough questions


  • Subject: Re: CAPlayThrough questions
  • From: Eyal Redler <email@hidden>
  • Date: Sat, 17 Oct 2009 01:41:48 +0200

Thanks for the answer Bill, I have another one.

I've adapted CAPlaythrough to integrate with my code (mostly just to make sure I understand all the code) and things seems to be working just like the demo application. I've noticed that the playback delay is quite significant (in both my app and the CAPlaythrough demo). I know that some playback delay is unavoidable but I know that other applications, AU Lab for example, achieve a much shorter playback delay and I wonder how they do that.
From what I understand the playback delay corresponds to the input/ output buffer size but when I look at the settings I get the same buffer size (512 frames) with AU Lab as I get with CAPlaythtough.



Thanks,

Eyal

On Oct 8, 2009, at 7:54 PM, William Stewart wrote:

CAPlayThrough is code aimed at doing I/O between 2 audio devices that are not synchronised (or they maybe, but the worst case assumption is that they aren't).

The Varispeed is used as way to adjust the consumption of the input device's audio by the output device.

So, the Varispeed in CAPlayThrough does two things:
(1) if there is a difference between the sample rates of the input and output device, the varispeed AU does a resample
- this is a setting that is made and is constant through the lifetime of the I/O operation (presuming the devices involved don't change)
(2) As the devices involved may NOT be synchronised, a further adjustment is made over time, by varying the rate of playback between the two devices. This rate adjustment is made by looking at the rate scalar in the time stamps of the two devices. The rate scalar describes the measured difference between the idealised sample rate of a given device (say 44.1KHz) and the measured sample rate of the device as it is running - which will also vary. This adjustment is made by tweaking the rate parameter of the varispeed.


If you don't do the corrections to the rate parameter, then the two devices can drift apart over time.

As far as processing - I would add the processing on the output side, and you can put effects units, etc, here to do whatever you would like to the audio as it is played out. The effect unit would be attached to the output unit, and would ask for as much input data as the current output unit does.

HTH

Bill

On Oct 8, 2009, at 5:47 AM, Eyal Redler wrote:

Hi,

I want to write an Audio Unit hosting applications that will have a graph like this:
(User Selectable Input)->(My Custom AU - not user selectable)- >(Possibly other user selectable AU)->(User Selectable Output)


On the surface CAPlayThrough demonstrates the abilities I'm looking for but it contains a few things that make it more complex then what I would have intuitively think. My initial thought was that I could just build the graph like the graph above (input unit->my unit->some additional unit->output unit) and let the graph run but CAPlayThrough does a lot more and I'm not sure if the additional complexities are needed to make this work or just to demonstrate other concepts. Specifically, I'm wondering about the following:

1. Why is the graph split between the input an output, why not do it like this input->varispeed->output?
2. Why use a ring buffer and not a "normal" buffer?
3. Why use the varispeed audio unit, don't the au know how to convert the sampling rate?


TIA,

Eyal Redler
------------------------------------------------------------------------------------------------
"If Uri Geller bends spoons with divine powers, then he's doing it the hard way."
--James Randi
www.eyalredler.com



_______________________________________________
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
  • Follow-Ups:
    • Re: CAPlayThrough questions
      • From: William Stewart <email@hidden>
References: 
 >CAPlayThrough questions (From: Eyal Redler <email@hidden>)
 >Re: CAPlayThrough questions (From: William Stewart <email@hidden>)

  • Prev by Date: Re: Limitations on DefaultOutput unit format converter?
  • Next by Date: Re: CAPlayThrough questions
  • Previous by thread: Re: CAPlayThrough questions
  • Next by thread: Re: CAPlayThrough questions
  • Index(es):
    • Date
    • Thread