OK I had a look at RtAudio problems under Linux.
The clicks you are experiencing Arturo are most likely buffer underruns, which means RtAudio is not providing audio samples fast enough to the sound card…therefore there are gaps in the audio stream which manifest as clicks.
Some changes in RtAudio 4.0.4 (haven’t tested the earlier 4.0 series) have made the api a little less responsive or at least more vulnerable to buffer underruns it seems, at least under Linux. Different sound cards will have different results, however I am testing on a standard Intel integrated sound chip found in many laptops. These are crappy sound cards and often experience these problems.
The buffer underruns are worse when using Events, however I was still not able to get a clean stream using regular OF. I tried both ALSA and JACK.
A common way to fix buffer underruns is to increase the size of the audio buffer (i.e. from 256 to 1024, 2048 etc…) however this also increases the latency of the audio application. However doing this in my case improves the stream but I still get occasional pops.
What did fix the problem however was to run the application as super-user. This raises the priority of the app and ensures the samples are fed to the card in time.
One way to proceed with this could be to test earlier versions of RtAudio version 4 to see if they are better, or to contact Gary Scavone, the author of RtAudio and raise a bug. He may however just ignore the request…as integrated laptop sound cards are not really meant for “real-time” audio processing.
I noticed that the test sine wave in Pure Data using Alsa also experienced some clicks…so it’s not necessarily just an RtAudio problem.
Another reason for the clicks could be an interrupt conflict.
When I type:
I discover that my sound card is sharing an interrupt with the nvidia driver.
This probably explains why I get a click when I tab between windows while playing audio in non-super-user mode. A fix for this would be to use a real-time audio kernel.
Some useful links:
So I guess for now the solution for Linux is to stay with 3.0.3 (unless another version works), or perhaps look at some of the other real-time libraries, such as PortAudio (www.portaudio.com)