I’m new to JUCE and am trying to create a simple oscilloscope, very similar to the one demonstrated at 14:01 in this JUCE Cpp Con presentation: https://www.youtube.com/watch?v=boPEO2auJj4
I already have a sine wave generator implemented.
My oscilloscope class inherits from AudioIODeviceCallback
so it can receive audio data generated by the sine wave, and from AudioVisualiserComponent
to do some of the drawing for me.
The only problem is, I’m having trouble displaying the waveform in a similar way to the video. When I use the AudioVisualiserComponent
to show the waveform, I can get close to a good, zoomed in, waveform representation by adjusting setSamplesPerBlock()
and setBufferSize()
, but the wave looks sharp like it is made out of triangles instead of smooth like a sine wave. I think this is because of the way AudioVisualiserComponent
paints the audio data, so I’m going to try to override its paintChannel()
function.
Here’s a dropbox link to a screen/audio recording of the program I have so far:
https://www.dropbox.com/s/ng1720mb215tz8f/Oscilloscope.m4v?dl=0
(the sine wave’s frequency is being controlled by an invisible frequency ribbon triggered by mouse events)
There seems to be alot of sharp triangle shapes in this visualization at times, which is not what I want.
Does it seem I am moving in the right direction with this?
Does the AudioVisualiserComponent
seem fit for this kind of oscilloscope implementation?
I also realize that oscilloscopes are not just audio scrollers, but will keep a certain number of cycles visible in the viewport, so I’ll have to deal with that as well.
If anyone has made something similar to this before, any kind of explanation would be helpful.
Thanks.