I have a 4 channels audio file. As a pre-processing step, it goes through an STFT with $T$ frames and $M$ frequencies. The output is divided into magnitude and phase per channel, so for $C$ channels, we have a $T\times M\times 2\cdot C$ tensor.
I wish to focus on the channel with the highest energy per frame $T$. If the STFT had no overlap, I could simply take the highest energy channel per frame and concatenate to a single channel audio file. The $T$ frames, however, are produced by 50% overlapping windows.
In my case for example:
Audio length = 2880000
number of channels, $C$ = 4
Window Length = 1920
hop size = 960
number of FFT bins = 2048
number of frequencies, $M$ = 1024
Hence the output size:
$T = \frac{2880000}{960} + 1$ = 3001
How do I produce a single channel audio file, with the highest energy per window?
For reproduction: I am using librosa.core.stft for the STFT with a Hanning window.