I'm converting a signal to a spectrogram, manipulating that (nonlinear stuff), and then want to use the modified audio signal. I can make it so the segments are not overlapping, but am unsure how to deal with the complex part of the signal.

The manipulation I'm doing is increasing the value of the smaller values (but not modifying large ones), effectively lowering SNR. I can't think of how I would do that in the time domain. And I'm unsure whether it would make sense to just do the same thing to the complex values? And then I guess I would have to do ISTFT for each segment, I don't see a function to do that for several segments (a spectrogram) in scipy so I guess I would have to do that manually? Anyone else had to do something like this before?

  • $\begingroup$ Scipy has STFT and ISTFT functions for this now. Follow their Examples $\endgroup$
    – endolith
    May 8 '19 at 18:42
  • $\begingroup$ Obviously scipy has STFT and ISTFT functions. That does not answer the question at all. $\endgroup$
    – Nimitz14
    May 9 '19 at 11:06

I am not a good Python coder, but did similar processing in Matlab in the past. The subject has been discussed in SE.DSP in several instances, for instance Librosa stft + istft - Understanding my output.

Tools seem to exist:

How you should process complex coefficients is a complicated manner. The most simple consists in modifying the modulus, and keeping the phase. However, the result depends on the type of enhancement you want to perform. You could find inspiration on papers talking about shrinkage (esp. with complex, dual-tree or quaternionic wavelets) and homomorphic filtering. I could update later if you can clarify objectives.


Not the answer you're looking for? Browse other questions tagged or ask your own question.