[pulseaudio-discuss] new pulseaudio client program clicks on buffer underrun and re-fill

Colin Guthrie gmane at colin.guthr.ie
Mon Mar 14 03:31:54 PDT 2011


'Twas brillig, and Kirk Wolff at 14/03/11 03:03 did gyre and gimble:
> Hello list,
> 
> I've written a sound-centric application where tones are generated and
> played back to the user interactively.  This is not a good candidate for
> 'system sounds' as the tones settings may change throughout the
> interaction.  I've chosen to use the pulseaudio libraries directly to
> play back the sounds, but I'm questioning whether that was a wise
> decision as its not compatible with systems without pulseaudio (though
> I'm willing to live with this decision, and add support for other
> systems in the future by detecting which one is available).  
> 
> My application is using pulseaudio's asynchronous callbacks.  The main
> technical problem I'm having is when the generated tones start and stop
> playing.  I want to send tone bursts, have them complete playing, then
> stop sending data to the stream.  The problem is, there are low-audio
> 'clicks' at the beginning and end of playback.  Whenever the buffer
> underruns, there's a quiet click.  Whenever the under-run buffer is
> re-filled and the stream is resumed, there's another click.  I would
> like to get rid of these clicks as most people using this program will
> likely be wearing headphones and it is distracting.

I don't think you should let the stream underrun. I believe it's better
practice to either produce silence or "cork" the stream (there are API
calls for that).

Corking is basically like a pause, and sounds rather fitting to what you
want to do.

> Also, does anyone have a suggestion to a 'fall-back' sound API that
> would work well with my application (provides asynchronous callbacks)
> and will make the app more compatible with non-pulseaudio systems (e.g.
> KDE and MS Windows)?

I believe most (all?) of the major KDE distros are shipping PA by
default these days. Certainly OpenSUSE, KUbuntu, Mandriva, Fedora and
(soon) Mageia do.

But MS Windows is an issue. I suspect something like gstreamer or libvlc
would work if you want a full framework with graph generation etc. but
perhaps something like libao for just audio output. Not 100% on the
later recommendation tho'.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list