[LAD] Real-time plotting of audio/ oscilloscope.

Johannes Kroll jkroll at lavabit.com
Fri Jun 18 17:10:15 UTC 2010


On Thu, 17 Jun 2010 00:29:44 -0400
Jeremy <jeremybubs at gmail.com> wrote:

> Hi,
> 
> When I'm programming, I find it immensely helpful to be able to plot audio
> data at different points in its processing, for debugging, and to test new
> ideas.
> 
> Essentially I want an oscilloscope, which plots each chunk of 1024 samples.
> 
> I've tried using libplot, but it seems too slow.  It's causing constant
> xruns, even when I only plot every 5th sample.
> 
> I thought that maybe libplot was too abstract, and that I needed to draw the
> pixels on the screen directly.  I tried using SDL, but it caused excessive
> xruns also.  Simply setting 48000 pixels per second was enough to cause the
> flow of xruns.  This is  *not* erasing the screen, just drawing the points.
>  I'd expect that erasing the screen is the slow part, but apparently not.

How did you write your SDL program? Don't use any Setpixel functions.
Draw your pixels to a memory buffer/surface with the same pixel format
as the screen and flip that to the screen. Or try OpenGL. Use GL Arrays
if glBegin()/glEnd() is too slow.

The hardware shouldn't be a bottleneck if you don't use a system
older than 10 years or so. If you use OpenGL, you need an accelerated
driver of course, else it's useless.




More information about the Linux-audio-dev mailing list