eddie-water / lightbeats

1 stars 0 forks source link

Sharpen (normalize?) the higher frequency magnitudes in the scalogram plot #10

Open eddie-water opened 1 month ago

eddie-water commented 1 month ago

I think there is a need to sharpen the higher frequency activity.

This is from plot_cwt_example.py: https://github.com/eddie-water/lightbeats/issues/3#issuecomment-2212690990 Three individual sinusoids of equal magnitudes and different amounts of time support have been summed up together into a resultant signal. The signal has been analyzed using the wavelet.py module and its scalograms have been plotted right underneath the signal plotted as a time series.

For some reason the data points corresponding to the higher frequency components are much more dull than the lower frequency components of the resultant signal. A duller color implies that the magnitudes of these contributions are weaker/less significant the brighter data points. This is weird because all the components were generated using the same magnitude so they should be the same brightness.

eddie-water commented 1 month ago

I think I saw in a Mike X Cohen video on youtube that the you have to "normalize" the data in a logarithmic fashion for some reason. I'm going to try and find the video. I think it was the one in his freq-time analysis video series where he first plotted the continuous wavelet transform using wavelets of different "number of scales" (which I'm really hoping is the same concept of Matlab's notion of "number of voices"). As far as I understand it, the number of voices controls the scale resolution. The scale resolution controls how dilated each wavelet is going to be. Therefore, it also controls the resolution of the frequencies being analyzed. Anyways if you have a scale resolution that is a logarithmic constant, the frequency resolution will be have a logarithmic variable length (which is what we want) because the conventional musical scale has logarithmic frequencies (doubles every 12 "steps"). That was a lot of rambling but I had to write that thought stream out and see if it makes sense later when I come back to this.

Anyways I think before he got to that point, he said you could multiply or divide all the coefficients logarithmically with its frequency to sort of "normalize" the values. Basically I just want the contribution of each sinusoid component to be on an even playing field.

eddie-water commented 1 month ago

I can't find the video where I first found it but this seems promising https://www.youtube.com/watch?v=4m3d5eQzCYk&list=PLn0OLiymPak2BYu--bR0ADNBJsC4kuRWs&index=11