code: def spectral_entropy(data, numOfShortBlocks=10):
      
      data = np.mean(data, axis=1)
  
      nFFT = len(data) // 2
      X = FFT(data, nFFT)
      L = len(X)                         # number of frame data
      Eol = np.sum(X ** 2)            # total spectral energy
  
      subWinLength = int(np.floor(L / numOfShortBlocks))   # length of sub-frame
      if L != subWinLength * numOfShortBlocks:
          X = X[0:subWinLength * numOfShortBlocks]
  
      # define sub-frames (using matrix reshape)
      subWindows = X.reshape(subWinLength, numOfShortBlocks, order='F').copy()
  
      # compute spectral sub-energies
      s = np.sum(subWindows ** 2, axis=0) / (Eol + EPSILON)
  
      # compute spectral entropy
      return -np.sum(s * np.log2(s + EPSILON))
docs: Computes the spectral entropy