How to draw input signal's waveforms?

Hi,

The tutorial: “Tutorial: Draw audio waveforms” teach me how to draw waveforms of sound files.
How could draw waveforms of input signal from input channel in real time?

Are you thinking of a continuously growing coarse Waveform like you see in most DAWs while recording a track or of something like an oscilloscope? In any case, drawing realtime data needs some work to make sure that the realtime thread is never locked up by drawing actions. There is a simple AudioVisualizerComponent, but for an oscilloscope there is nothing coming with JUCE that does all this out of the box, however multiple people out there have solved this task and have published their solutions.

If you need an oscilloscope type and you are not targeting a plugin but a standalone application you might find this juce module which I published under a MIT license helpful, it contains an oscilloscope and spectral analyzer component, both accelerated by the GPU with the help of OpenGL under the hood. However, there might be more straightforward, simpler solutions available out there.

3 Likes

There is AudioVisualiserComponent in the current version of Juce, which can be used to display a scrolling waveform.

1 Like

Oh good point, you are right. I was thinking of an oscilloscope when I wrote those lines – I will edit my post…

AudioThumbNail also works by adding audio buffers into it instead of setting it to use an audio file. It can get tricky to get a visually pleasing result that way, though…There may also be thread safety/memory allocation issues with it if you insert the data into it from the audio thread.

1 Like

Thank you!
Furthrer, I want to know how to draw a signal’s Spectrogram.Should I apply a FFT on that signal first? Then, what is the next?
@PluginPenguin