Decoding and downsampling
The audio file is decoded into per-channel floating-point sample arrays. Since a typical file has far more samples than the output image has pixels, samples are grouped into one window per horizontal pixel, and each window is reduced to a single min/max (or peak) pair before drawing - this windowed reduction is what produces the familiar jagged bar shape rather than a smooth continuous wave.