The second wave is probably an approximation of a column of a simple zig zag graph.
Each column is a row from the previous sample amplitude to the current sample amplitude.
So, read all the patterns in the canvas or texture as a preliminary test in the form of dots, then, as soon as you do this, you can do two cases, make columns instead of dots, draw up to the last pattern or up to this pattern, depending on which was higher as long as you draw a line between the two. This ensures that the waveform is small at low energies between the following samples and high with high energies.
You can pseudonize it and measure several samples, it just depends on what equipment you are working on, if you want to read 1000ds of samples and create a gigantic representation of a 2d wave array, and then hide it down to a smaller displayed image or if you just want to run Only 512 samples and update them quickly. with a 2-dimensional canvas in programs, it must be fast to create detailed waveforms with more than 512 samples.
... another option is the same as the gray wave in another answer, output the absolute value in the form of lines from + the current sample to the sample-camera.
it helps to average several samples, i.e. Ever 4 samples, or get the maximum out of every 4 samples to have a less erratic graph, this is a quick smoothing guy.
source share