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

Jeremy Jongepier jeremy at autostatic.com
Thu Jun 17 13:36:41 UTC 2010


On 06/17/2010 10:11 AM, Philipp Überbacher wrote:
> Excerpts from James Morris's message of 2010-06-17 09:57:26 +0200:
>> On 17 June 2010 08:20, Peter Nelson <peter at fuzzle.org> wrote:
>>> On Thu, 2010-06-17 at 00:29 -0400, Jeremy 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.
>>>>
>>>>
>>>> At this point I'm not sure if it's even possible to plot the audio
>>>> data in realtime.  I did a rough calculation, that on my 2 Ghz cpu, it
>>>> should have roughly 40,000 cycles to process each sample.  It seems to
>>>> me that considering running the whole plugin only uses 1/4 of my cpu,
>>>> the other 30000 cycles should be plenty to put a pixel on the screen.
>>>>
>>>>
>>>> So I would guess that something else is the bottleneck, like my video
>>>> chip, or maybe the libraries I'm using.
>>>>
>>>>
>>>> So basically my question is:  Has anyone else had any luck with
>>>> plotting audio data in real time, and if so, how?  Is it not possible
>>>> to plot every sample, but only a certain percentage of them?  Is there
>>>> a fundamental restriction on doing so, or is my problem in software?
>>>
>>> I'm going to assume you're plotting directly within the realtime process
>>> thread, which will never work. Push the audio data in a ring buffer,
>>> then do the plotting in your main thread.
>>>
>>
>> How about taking a look at some of the sound editors, snd, mhwaveedit,
>> etc? Or perhaps Freqtweak?
>>
>> I seem to recall seeing a reference somewhere recently, to
>> oscilloscope type software, which also might be useful to read the
>> code of, but can't remember where.
>>
>> James
> 
> Well, there's ll-scope, but no idea how close it is to what you want:
> http://www.student.nada.kth.se/~d00-llu/music_dssi.php?lang=en

jack_oscrolloscope: http://das.nasophon.de/jack_oscrolloscope/
Sonogram: http://www.christoph-lauer.de/Homepage/Sonogram.html
MeterBridge has an oscilloscope plugin too
And then there's jack.scope, but that one chokes on my computer

Maybe the above links provide some useful info.

Best,

Jeremy



More information about the Linux-audio-dev mailing list