Closed hurui79 closed 11 months ago
I don't think there is an actual mismatch issue here.
An example of using Window with STFT is shown here:
public void testSTFTPositiveHanning2() {
double[] signal2 = {0, 0.0032054, 0.012821, 0.028844 ,0.051264, 0.080049, 0.11514, 0.15642,
0.20371, 0.25673, 0.31508, 0.3782, 0.44536, 0.5156, 0.58773, 0.66029,
0.73154, 0.79944, 0.86167, 0.91566, 0.95863, 0.98767, 0.99981, 0.99222,
0.96229, 0.90789, 0.82756, 0.72074, 0.58799, 0.43124, 0.25394, 0.061185,
-0.14025, -0.34202, -0.53442, -0.70682, -0.8482, -0.9479, -0.99649, -0.98675,
-0.91462, -0.78017, -0.58825, -0.34894, -0.077492, 0.20622, 0.4789, 0.71561,
0.89212, 0.98757, 0.98731, 0.88551, 0.68706, 0.40855, 0.077812, -0.26817,
-0.58696, -0.83575, -0.97747, -0.98685, -0.85575, -0.59652, -0.24245, 0.15515,
0.53361, 0.82846, 0.98481, 0.96847, 0.77473, 0.4324, 0.0016027, -0.43529,
-0.78872, -0.9806, -0.96272, -0.73066, -0.32904, 0.15452, 0.60676, 0.91488,
0.99558, 0.81957, 0.42429, -0.090588, -0.58592, -0.91986, -0.9895, -0.76512,
-0.30533, 0.25425, 0.73849, 0.98726, 0.9103, 0.52354, -0.048382, -0.60854,
-0.95404, -0.95102, -0.59032, -2.9398e-15};
int frameLength = 5;
int overlap = 2;
_Window window = new Hanning(frameLength);
ShortTimeFourier stft = new ShortTimeFourier(signal2, frameLength, overlap, window);
stft.transform();
Complex[][] out = stft.getComplex(true);
}
for this to work you will need to import the Hanning window (or any other window as required).
import com.github.psambit9791.jdsp.windows.Hanning;
how should use this function ?How should i choose _Window ? can i get a demo?
ShortTimeFourier(double[] signal, int frameLength, int overlap, int fourierLength, _Window window, double Fs) Compute the Short-Time Fourier Transform for a time signal, with windowing.
this is matlab,i want it on java ,how shoul i do?