示例#1
0
文件: ramirez.py 项目: AliceWu5/vad-3
    def ltsd(self, s):
        x = sigutil.framesig(s, self.Nw, self.Nsh, self.win)
        X = np.apply_along_axis(sp.spect_power, 1, x, fs, Nw)

        L = len(X)
        d = np.zeros(len(l))
        flag = np.zeros(len(l))
        for l in range(self.M, L-self.M):
            ltse = np.amax(X[:,l-self.M:l+self.M],1)
            d[l] = 10*math.log10(ltse**2 * (1.0/self.N**2)/self.NFFT)
示例#2
0
文件: ramirez.py 项目: AliceWu5/vad-3
 def __init__(NFFT, fs, Nw, Nsh, n, M, K=3):
     self.NFFT = NFFT
     self.fs = fs
     self.Nw = Nw
     self.Nsh = Nsh
     self.win = signal.hamming(Nw)
     self.K = K
     self.alpha = 0.95
     n = sigutil.framesig(n, Nw, Nsh, self.win)
     N = np.apply_along_axis(sp.spect_power, 1, n, fs, NFFT)
     self.N = np.mean(N[:K*2], 1) # Initial mean noise spectrum.
     energy = np.sum(n[:K*2]**2, 0)
     self.E0 = min(energy)
     self.E1 = max(energy)
     self.M = M