<br><br><div class="gmail_quote">On Thu, Jun 17, 2010 at 3:20 AM, Peter Nelson <span dir="ltr"><<a href="mailto:peter@fuzzle.org">peter@fuzzle.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div class="h5">On Thu, 2010-06-17 at 00:29 -0400, Jeremy wrote:<br>
> Hi,<br>
><br>
><br>
> When I'm programming, I find it immensely helpful to be able to plot<br>
> audio data at different points in its processing, for debugging, and<br>
> to test new ideas.<br>
><br>
><br>
> Essentially I want an oscilloscope, which plots each chunk of 1024<br>
> samples.<br>
><br>
><br>
> I've tried using libplot, but it seems too slow.  It's causing<br>
> constant xruns, even when I only plot every 5th sample.<br>
><br>
><br>
> I thought that maybe libplot was too abstract, and that I needed to<br>
> draw the pixels on the screen directly.  I tried using SDL, but it<br>
> caused excessive xruns also.  Simply setting 48000 pixels per second<br>
> was enough to cause the flow of xruns.  This is  *not* erasing the<br>
> screen, just drawing the points.  I'd expect that erasing the screen<br>
> is the slow part, but apparently not.<br>
><br>
><br>
> At this point I'm not sure if it's even possible to plot the audio<br>
> data in realtime.  I did a rough calculation, that on my 2 Ghz cpu, it<br>
> should have roughly 40,000 cycles to process each sample.  It seems to<br>
> me that considering running the whole plugin only uses 1/4 of my cpu,<br>
> the other 30000 cycles should be plenty to put a pixel on the screen.<br>
><br>
><br>
> So I would guess that something else is the bottleneck, like my video<br>
> chip, or maybe the libraries I'm using.<br>
><br>
><br>
> So basically my question is:  Has anyone else had any luck with<br>
> plotting audio data in real time, and if so, how?  Is it not possible<br>
> to plot every sample, but only a certain percentage of them?  Is there<br>
> a fundamental restriction on doing so, or is my problem in software?<br>
<br>
</div></div>I'm going to assume you're plotting directly within the realtime process<br>
thread, which will never work. Push the audio data in a ring buffer,<br>
then do the plotting in your main thread.<br>
<br>
--<br>
<font color="#888888">Peter<br>
</font><br>_______________________________________________<br>
Linux-audio-dev mailing list<br>
<a href="mailto:Linux-audio-dev@lists.linuxaudio.org">Linux-audio-dev@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-dev" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a><br>
<br></blockquote></div><br>Yes, I'll bet that's my problem. Is it because writing to the screen is high bandwidth but high latency?   Or is it just not possible to draw anywhere near every sample?<br>