[PD] How to increase audio latency on linux?

Roman Haefeli reduzent at gmail.com
Mon Dec 10 11:03:37 CET 2012

On Sun, 2012-12-09 at 13:39 -0800, Miller Puckette wrote:
> grasping at straws but... maybe try Alsa using "callbacks" - so that Pd
> maintains the FIFO instead of having ALSA do it.  I think you can do
> this by opening ALSA through portaudio, requesting blocking in Pd but
> replace
> #if defined(__APPLE__)
> #endif
> with just
> in s_audio_pa.c
> I haven't tried this - don't have time right now - but if you're willing I'd
> be eager to hear how it turns out :)

Hey, I can compile Pd now with portaudio support!

I applied your suggested change, re-compiled Pd and it seems now the
default back-end is -pa. 

It turns out, that I am only able to open ALSA through portaudio, when
no pulseaudio daemon is running. Turning pulseaudio off is not as easy
as 'pulseaudio --kill', as the daemon will automatically be relaunched
in a standard Ubuntu environment. I had to write:

autospawn = no

to ~/.pulse/client.conf and then do 'pulseaudio --kill' in order to
really stop it.

Now I was able to select the 'raw' soundcard through the portaudio
dialog of Pd. It turns out that with your proposed change to
s_audio_pa.c I can set an arbitrarily high buffer. With an audio buffer
setting of 1000ms I was able to do stuff like:

[pow 123.456]

without getting any drop-outs! Mission accomplished. Many thanks for
your help!

Regarding callbacks: This was without checking the 'use callbacks'
checkbox in the portaudio dialog. I wasn't able to change the audio
buffer when it was checked withouth Pd crashing. Also when I check it
after using a high buffer setting, Pd crashes:

*** glibc detected *** pd: free(): corrupted unsorted chunks: 0x082797b8 ***
======= Backtrace: =========

Anyway, I am very glad to see this work in Linux. Will have to test it
on the machine with the 'real' soundcard as I only tested with a
build-in "HDA Intel, CONEXANT Analog".

Many thanks for your help,

More information about the Pd-list mailing list