[CELT-dev] Cross Platform Audio Library

Ross Bencina rossb-lists at audiomulch.com
Fri Dec 10 18:11:59 PST 2010


mike wrote:
> I was wondering if anyone had any advice on an audio library that is
> better suited to be paired with Celt in terms of latency.  I'm working
> on an application that I would like to have running on both
> windows/Linux systems.  I started by using the OpenAL library but I have
> run into an issue when feeding OpenAL small mono sample sizes that are
> 512 samples or less(1024 bytes).  Even if I create a ridiculous amount
> of buffers the playback is not correct.  I corrected the issue but it
> required that I create a second buffer that can hold around 2048
> samples.  My goal is to achieve the lowest latency possible.

Hi Mike

PortAudio (http://www.portaudio.com) can do that. It's a cross-platform open 
source library. I'm one of the lead developers.

I use PortAudio and CELT in a low latency network audio server I'm building. 
I use ASIO drivers with an RME soundcard with 256 frame buffers (5.8ms at 
44.1k). The RME hardware can deliver much lower latencies/buffer sizes. But 
for my application I'm using 256 sample CELT frames so it doesn't make sense 
to go lower.

PortAudio is a thin wrapper around native low latency platform audio APIs 
such as ALSA on Linux and ASIO on Windows (among others such as WMME, 
DirectSound, WASAPI, OSS, CoreAudio on Mac etc). One of the primary goals is 
to support low-latency audio processing applications (DSP effects processors 
for musical applications) where low latency is mission critical. The API 
overview is here:
http://www.portaudio.com/docs/v19-doxydocs/api_overview.html

Configuring PortAudio to use the absolute lowest latency can be a little bit 
fiddly, but it's usually a lot easier than learning and using the native 
APIs directly.

On Windows you need to know what you're doing to get lowest latency audio --  
you need to target the right native audio APIs since the legacy APIs 
(especially WMME and DirectSound) introduce additional latency internally. 
Vista introduced a new low latency audio API (WASAPI) but this only delivers 
low latency reliably in 64 bit Apps I think (on Vista at least). Usually I'd 
advise targetting ASIO if you can guarantee that your users will install a 
driver -- all pro/prosumer audio hardware provides ASIO drivers and there is 
the ASIO4ALL driver for generic WDM audio hardware. In any case, with 
PortAudio you can let your users direct audio to whatever audio 
interfaces/drivers they have installed.

There are some recent threads in the PortAudio mailing list archives about 
Windows low latency. I'm not an expert on WASAPI or ALSA but if you drop by 
the PortAudio mailing list I'm sure other people will be able to answer your 
questions.

HTH

Ross.





More information about the celt-dev mailing list