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

From: Jeremy <jeremybubs@email-addr-hidden>
Date: Sun Jun 20 2010 - 07:59:20 EEST

On Fri, Jun 18, 2010 at 1:10 PM, Johannes Kroll <jkroll@email-addr-hidden> wrote:

> On Thu, 17 Jun 2010 00:29:44 -0400
> Jeremy <jeremybubs@email-addr-hidden> 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.
>
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@email-addr-hidden
> http://lists.linuxaudio.org/listinfo/linux-audio-dev
>

I used a setpixel function, but it was quite simply a pointer dereferencer.
 I believe I am doing exactly what you are suggesting, but with SDL.
 Writing directly to the array, and then calling flip. I think I realize
why I'm having this problem. I'm using moderately old hardware, which
doesn't have any linux acceleration driver (even 2d), so everything is
written to main memory and then copied on flip (I believe). This is why
it's slow. Even with this, I only get xruns when I click another window, or
try to drag or resize a window. Basically, it's good enough that if I put
the flip() call in another thread it probably should run perfectly.

Jeremy

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Jun 20 08:15:02 2010

This archive was generated by hypermail 2.1.8 : Sun Jun 20 2010 - 08:15:02 EEST