Preview:
def win_spec(x,buff_s):
    
    window = np.blackman(buff_s)
    mat = frame(x,buff_s,int(buff_s/2))
    
    # extra step because overwriting can throw errors sometimes
    temp_array = np.zeros(np.shape(mat))
    
    for i in range(0,np.shape(mat)[1]):
        temp_array[:,i] += mat[:,i]*window
        
    fft_col = 10*np.log(np.abs(np.fft.fft(temp_array,axis=0)))
    return fft_col, np.shape(mat)[1]
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter