0

I have recently created a real-time STFT with 50% overlap.

enter image description here

I wanted to know if this window-based is possible for scalogram, especially continuous wavelet transform. I haven't found anyone implementing it real-time.

Also, if it is possible, does one need to compute the CWT of the whole window signal or simply a portion of it, like in a recursive way. I started learning wavelets and I look forward to any hints.

Eddy Piedad
  • 157
  • 6

1 Answers1

1

Whether it's "real-time" depends on sampling rate. What's true is that most implementations fall short for realistic $f_s$.

I am currently working on CWT that will be faster than any other I know of, best case by several times. Though, it may be a while until it's open-sourced.

An often overlooked point is, CWT has hop_size just like STFT. Especially if using a scalogram (modulus), there's very little to lose from hop_size=2 or 4, and sometimes we can do 100+. This is implemented easily with Fourier-domain subsampling:

ifft(a * b)[::2] == ifft((a * b).reshape(2, -1).mean(axis=0))

which reduces FFT size by hop_size. The relevant question is, what hop_size is safe? This can be measured directly, as discussed in this answer. Note, perfect inversion is possible for some CWT with complex-valued outputs and hop_size>1, but max permissible hop_size is fairly small and the inversion algorithm not straightforward. However, we don't need complex for inversion; inversion is still possible within a global phase-shift.

Another major slowdown is in low-support wavelets, which are better off with overlap-add/overlap-save.

Putting all these together elevates max supported $f_s$ significantly.

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74
  • Is there a way to determine this realistic $f_s$? Is there a way to know the big-$O$ notation of CWT? – Eddy Piedad Jun 18 '22 at 09:09
  • @EddyPiedad If it processes 1 second of data in 1 second, it's "real-time" with 1 sec latency. What qualifies as "real-time" varies by application, sometimes we want 1 sec in 0.001 sec. – OverLordGoldDragon Jun 18 '22 at 21:10