On Tue, 2012-10-02 at 22:16 +0200, Samuele Carcagno wrote: > Hi, > > I have the same issue that is described in this post (not mine) > > http://unix.stackexchange.com/questions/7067/do-the-play-utility-in-linux-really-have-a-delay-to-stop-its-process-with-r > > basically, when I play a sound with aplay or other command line > utilities, when the sound ends there is a long delay (about 3 seconds) > before the program returns. This is an issue for me because I play two > or more sounds in sequence from a python program for > psychoacoustics research, and the silent interval between two sounds > needs to be roughly controlled. I could make wav files > with the sounds in sequence and silence between them, but the sounds > need to be synchronized with lights, and this is not > so easy to achieve with a single long wav file. > > I was wondering whether there are any settings in pulseaudio that can > be tweaked to reduce this sound offset lag to negligible levels. > I should add that with alsa (that is when I remove pulseaudio from my > system) there is not such problem, aplay starts and returns > without noticeable delays. For this reason I have been living without > pulseaudio so far, but some programs start not running well > without it (skype on Kubuntu Precise), so it would be great if I could > solve the issue. > > Thanks for any help! First of all, this is a known issue: http://pulseaudio.org/ticket/866 . It's a bit tricky to fix, and so far nobody has volunteered to work on it. I think it should be a viable workaround to keep the latency of the sink low while you play your files. There's no direct knob that you can use to control the latency, but you can play something, and request that to be played with low latency. The sink latency will be configured accordingly. If you use paplay instead of aplay, you can request a latency: paplay --latency-msec=50 somefile.wav. I would expect that to help, but if not, you could also try keep the latency low all the time by playing silence in the background: pacat --latency-msec=50 /dev/zero -- Tanu