Drawing waveform as audio is passed to plug-in


I’m trying to figure out the best way to have my audio plugin draw an incoming waveform as it’s being fed from the host (it’s also drawing some other stuff based on the analysis of the waveform but the issue is the same.) I know there is a simple way to do this, but I’m not seeing it.

For the data, I was thinking shared memory, so I’ve looked at the MemoryInputStream and MemoryOutputStream classes. However I don’t see how you have simultaneous writing and reading with these classes.

It looks to me like I need to implement a MyInputStream : InputStream class so I can feed data into it from the filter. The filter could be an InputSource allowing the UI to call createInputStream() which would give it access to the dynamically updating stream. I was planning on using AudioThumbnail to do the drawing (I’ve seen the other posts on that).

My filter is a ChangeBroadcaster already, which is used to update the UI’s sliders during automation, etc. But when I added a call to sendChangeMessage() when the audio is flowing in to tell the UI to update itself, things ground to a halt. The mechanism works fine for automation, but perhaps calling it every 128 samples is too often? I would like the display to look almost continuously updating as the audio is played, so if there is a more efficient way to do this, I’m open to suggestions.


Have you looked at the new audio page of juce demo, that I did last week? It’s got waveforms of the input data all over the place, might be interesting to you.


Thanks, the AudioInputWaveformDisplay class was helpful. I’m having my filter pass incoming samples to that via audioIODeviceCallback() for starters. I’m morphing the code to suit my needs but this gives me a working real time display to start with.



I've been also wondering about that one so I've made the following implementation:


I'd be more than happy if any wiser JUCER could give me some feedback and tips.
In addition I don't know why when I set it to use OpenGLContext it flickers (maybe the refresh rate of 75hz is too much?)

Thank you!


Hi ttg, I'm trying to run your plug-in but I'm getting some missing headers. Am I missing something?


what are the missing headers ?

I've started it with Introjucer and only additional header is std::stack 


you shouldmonly mind the juce header and modules which are not included of course.


PluginProcessor.h:15 #include "SyncedBuffer.h"

Where can I find this header?


I've removed it but forget to remove header you're correct.

It is not being used. I'm using std::stack instead to simplify this as possible.