1

1 load wavefile之后 进行归一化

import scipy.io.wavfile as wav

Fs, data = wav.read(inputAudioFile)

# data = np.double(data) /  32768.0 # makes data vary from -1 to 1

scaleData = 1.2 * data.max() # to rescale the data.

data = np.double(data) / scaleData # makes data vary from -1 to 1

==============================================================

2. hanming window

def sinebell(lengthWindow):

"""

window = sinebell(lengthWindow)

Computes a "sinebell" window function of length L=lengthWindow

The formula is:

window(t) = sin(pi * t / L), t = 0..L-1

"""

        window = np.sin((np.pi * (np.arange(lengthWindow))) / (1.0 * lengthWindow))

return window

"sinebell" window  with win_len=2048

你可能感兴趣的:(1)