Finally got the #Spectrum rendering mode for #Harry that I started in December working (almost) properly. It uses #HaarWavelets to estimate #EnergyPerOctave quite cheaply (and nastily). The bugs were:
- `haar[0][i] = haar[0][i];` (the second 0 should be 1)
- scaling by `1/sqrt(2)` (scaling by `1/2` looks much better for a sine sweep - not sure what is really "correct")
- plotting `->rms` instead of `->spectrum` (completely the wrong data, probably read out of bounds, explains some crashes)
- flipping the octaves vertically
- plot RMS for each octave, scaled by the number of octaves (plotting dB didn't work out so well)
Still to do before push:
- zoom in too much in the spectrum display and it goes blank. the fix will be to clamp zooming so you can't do that. will need to zoom out automatically when switching from waveform display to spectrum display, if it's too zoomed in
- the spectrum display judders up and down when you resize the terminal and sometimes overlaps the info text at the top
#spectrum #harry #HaarWavelets #EnergyPerOctave