Re: best way to get rate conversion
Re: best way to get rate conversion
- Subject: Re: best way to get rate conversion
- From: Bill Stewart <email@hidden>
- Date: Thu, 10 Oct 2002 11:06:26 -0700
on 10/10/02 10:01 AM, Phil Burk wrote:
>
I am preparing to add support for sample rate conversion to PortAudio, an
>
open-source cross-platform audio API used in many projects.
>
>
http://www.portaudio.com/
>
>
I currently use the HAL (Hardware Abstraction Layer ), making calls to
>
AudioDeviceAddIOProc() and AudioDeviceStart(). This technique is close to
>
the hardware and provides excellent latency but does not provide sample rate
>
conversion. My PowerBook G3, for example, only supports 44100 Hz.
>
>
A higher level API involving the AudioOutputUnit does provide sample rate
>
conversion by setting "austream.mSampleRate".
>
>
Questions:
>
>
1) Is the AudioOutputUnit the best way to implement basic audio I/O if I
>
want sample rate conversion?
Generally yes - it won't introduce any additional latency on top of the HAL
unless the converter itself has some latency - in which case the output unit
would publish this as a latency (kAudioUnitProperty_Latency), so you can
determine exactly what is being introduced by the converter...
>
2) I know that SRC can increase latency because it involves filters. But for
>
rates that match the HW rate (eg. 44100 Hz) will using the AudioOutputUnit
>
increase the latency significantly versus using the HAL?
If no rate conversion is required, you won't get a rate converter - we're
very careful about only establishing the converters that you need - so in
the case where you format matches the I/O Proc you won't have a converter at
all.
The OutputUnit attaches itself to the I/O Proc of the device. Then in the
I/O Proc it calls its own AudioUnitRender call - which then pulls on its
inputs, etc, and the result is passed into the I/O Proc directly.
One of the things the AU will do for you (and this is true of the generic
AUConverter unit as well) is calculate as close as it can to how many sample
it needs to satisfy that particular I/O Proc request - so if you're
converting from 88->44 (512 frames), then the request from the AU will be
for 1024 samples (with a slight fudge factor of 1 or 2 samples for weird
conversion ratios)
We've done some significant work on the rate converters since Jaguar that we
hope to have available shortly (they should be both faster and better
quality) - so don't be too harsh on the performance/quality of the existing
ones (better ones are on their way)
Bill
>
Thanks,
>
Phil Burk
>
http://www.softsynth.com/ - JSyn, software development
>
http://www.javasonics.com/ - audio I/O for Java and the web
>
http://www.transjam.com/ - collaboration server, WebDrum
>
http://www.portaudio.com/ - portable audio API for 'C'
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
--
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
__________________________________________________________________________
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.