Hamming window with overlap python

964 views Asked by At

I'm trying to implement the paper Integrated optimization of underwater acoustic ship-radiated noise recognition based on two-dimensional feature fusion.

My biggest problem is transforming .wav files to 2d arrays. In the paper, it's mentioned

Each originally recorded signal in the database is framed using the hamming window of length 2048 with 50% overlap. With sampling frequency fs=52734 Hz, each sample lasts approximately 40 ms

and also

7 levels of WP decomposition with fourth-order Symlet wavelet is utilized to decompose each raw sample into 128 subbands.

I really appreciate any help in understanding and implementing this using Python.

1

There are 1 answers

0
Jon Nordby On BEST ANSWER

You can compute overlapping windows using librosa.utils.frame, with window_length=2048 and hop_length=1024 (50% overlap). The window function can be computed using librosa.filters.get_window with window="hamming"

Each window from the frame function you multiply by the window function. Then you can use pywt.wavedec with wavelet="sym" and level=7 to get the output for each frame. It should have 128 dimensions.