• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python numpy.blackman函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.blackman函数的典型用法代码示例。如果您正苦于以下问题:Python blackman函数的具体用法?Python blackman怎么用?Python blackman使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了blackman函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: noiseFilter

def noiseFilter(data_in):

	N = int(np.ceil((4 / b)))
	if not N % 2: N += 1  # Make sure that N is odd.
	n = np.arange(N)
	 
	# Compute a low-pass filter with cutoff frequency fH.
	hlpf = np.sinc(2 * fH * (n - (N - 1) / 2.))
	hlpf *= np.blackman(N)
	hlpf = hlpf / np.sum(hlpf)
	 
	# Compute a high-pass filter with cutoff frequency fL.
	hhpf = np.sinc(2 * fL * (n - (N - 1) / 2.))
	hhpf *= np.blackman(N)
	hhpf = hhpf / np.sum(hhpf)
	hhpf = -hhpf
	hhpf[(N - 1) / 2] += 1
	 
	# Convolve both filters.
	h = np.convolve(hlpf, hhpf)
	s = np.convolve(data_in, hlpf)

	fig, ax = plt.subplots()
	ax.plot(data_in)
	plt.show()
	fig1, ax1 = plt.subplots()
	ax1.plot(s)
	plt.show()
	return s
开发者ID:chemil5000,项目名称:DUSoundTransmission,代码行数:29,代码来源:bandpassFilter.py


示例2: applyWindow

 def applyWindow(self, window="hanning", ww=0, cf=0):
     '''
     Apply window function to frequency domain data
     cf: the frequency the window is centered over [Hz]
     ww: the window width [Hz], if ww equals 0 the window covers the full range
     '''
     self.info("Applying %s window ..." % window)
     if window == "hanning":
         if ww == 0:
             w = np.hanning(self.numfreq)
         else:
             pos = int((cf - self.lowF) / self.deltaF)
             halfwidth = int(ww / (2.0 * self.deltaF))
             w = np.zeros(self.numfreq)
             w[pos - halfwidth:pos + halfwidth] = np.hanning(2 * halfwidth)
     elif window == "hamming":
         if ww == 0:
             w = np.hamming(self.numfreq)
         else:
             pos = int((cf - self.lowF) / self.deltaF)
             halfwidth = int(ww / (2.0 * self.deltaF))
             w = np.zeros(self.numfreq)
             w[pos - halfwidth:pos + halfwidth] = np.hamming(2 * halfwidth)
     elif window == "blackman":
         if ww == 0:
             w = np.blackman(self.numfreq)
         else:
             pos = int((cf - self.lowF) / self.deltaF)
             halfwidth = int(ww / (2.0 * self.deltaF))
             w = np.zeros(self.numfreq)
             w[pos - halfwidth:pos + halfwidth] = np.blackman(2 * halfwidth)
     self.data = self.data * w
     self.done()
开发者ID:kmunve,项目名称:processgpr,代码行数:33,代码来源:gpr.py


示例3: test_calculate_lanczos_kernel

    def test_calculate_lanczos_kernel(self):
        """
        Tests the kernels implemented in C against their numpy counterpart.
        """
        x = np.linspace(-5, 5, 11)

        values = calculate_lanczos_kernel(x, 5, "hanning")
        np.testing.assert_allclose(
            values["only_sinc"], np.sinc(x), atol=1E-9)
        np.testing.assert_allclose(
            values["only_taper"], np.hanning(len(x)), atol=1E-9)
        np.testing.assert_allclose(
            values["full_kernel"], np.sinc(x) * np.hanning(len(x)),
            atol=1E-9)

        values = calculate_lanczos_kernel(x, 5, "blackman")
        np.testing.assert_allclose(
            values["only_sinc"], np.sinc(x), atol=1E-9)
        np.testing.assert_allclose(
            values["only_taper"], np.blackman(len(x)), atol=1E-9)
        np.testing.assert_allclose(
            values["full_kernel"], np.sinc(x) * np.blackman(len(x)),
            atol=1E-9)

        values = calculate_lanczos_kernel(x, 5, "lanczos")
        np.testing.assert_allclose(
            values["only_sinc"], np.sinc(x), atol=1E-9)
        np.testing.assert_allclose(
            values["only_taper"], np.sinc(x / 5.0), atol=1E-9)
        np.testing.assert_allclose(
            values["full_kernel"], np.sinc(x) * np.sinc(x / 5.0),
            atol=1E-9)
开发者ID:rpratt20,项目名称:obspy,代码行数:32,代码来源:test_interpolation.py


示例4: __init__

 def __init__(self, fl=1200, fs=240, fftl=2048):
     self.fl = fl
     self.fs = fs
     self.fftl = fftl
     winpower = np.sqrt(np.sum(np.square(np.blackman(self.fl).astype(np.float32))))
     self.window = {'ana' : np.blackman(self.fl).astype(np.float32) / winpower,
                    'syn' : winpower / 0.42 / (self.fl / self.fs)}
开发者ID:TonyWangX,项目名称:pyTools,代码行数:7,代码来源:stftTool.py


示例5: _update_mode

    def _update_mode(self):
        if self.allocation.width <= 0:
            return

        if self.fft_show:
            max_freq = (self.freq_div * self.get_ticks())
            wanted_step = 1.0 / max_freq / 2 * self._input_freq
            self.input_step = max(floor(wanted_step), 1)

            self.draw_interval = 5.0

            self.set_max_samples(
                ceil(self.allocation.width / \
                        float(self.draw_interval) * 2) * self.input_step)

            # Create the (blackman) window
            self.fft_window = blackman(
                ceil(self.allocation.width / float(self.draw_interval) * 2))

            self.draw_interval *= wanted_step / self.input_step
        else:
            # Factor is just for triggering:
            time = (self.time_div * self.get_ticks())
            if time == 0:
                return
            samples = time * self._input_freq
            self.set_max_samples(samples * self.max_samples_fact)

            self.input_step = max(ceil(samples\
                                           / (self.allocation.width / 3.0)), 1)
            self.draw_interval = self.allocation.width\
                                           / (float(samples) / self.input_step)

            self.fft_window = None
开发者ID:leonardcj,项目名称:Measure,代码行数:34,代码来源:drawwaveform.py


示例6: hpf

def hpf():

    """
    Ref:
        https://tomroelandts.com/articles/how-to-create-a-simple-high-pass-filter

    Usage:
        h = hpf()
        s = np.convolve(s, h)
    """

    fc = 200.0 / 16000
    b = 150.0 / 16000
    N = int(np.ceil((4 / b)))
    if not N % 2: N += 1 # N, odd
    n = np.arange(N)

    # compute a low-pass filter
    h = np.sinc(2 * fc * (n - (N - 1) / 2.))
    w = np.blackman(N)
    h = h * w
    h = h / np.sum(h)

    # spectral inversion, make high-pass filter
    h = -h
    h[(N - 1) / 2] += 1

    return h
开发者ID:rhee,项目名称:sam-alexa-pi,代码行数:28,代码来源:_hpf.py


示例7: __init__

    def __init__(self, sample_rate, fft_peak=7.0, sample_format=None, search_size=1, verbose=False, signal_width=40e3):
        self._sample_rate = sample_rate
        self._fft_size=int(math.pow(2, 1+int(math.log(self._sample_rate/1000,2)))) # fft is approx 1ms long
        self._bin_size = float(self._fft_size)/self._sample_rate * 1000 # How many ms is one fft now?
        self._verbose = verbose
        self._search_size = search_size
        self._fft_peak = fft_peak

        if sample_format == "rtl":
            self._struct_elem = numpy.uint8
            self._struct_len = numpy.dtype(self._struct_elem).itemsize * self._fft_size *2
        elif sample_format == "hackrf":
            self._struct_elem = numpy.int8
            self._struct_len = numpy.dtype(self._struct_elem).itemsize * self._fft_size *2
        elif sample_format == "float":
            self._struct_elem = numpy.complex64
            self._struct_len = numpy.dtype(self._struct_elem).itemsize * self._fft_size
        else:
            raise Exception("No sample format given")

        self._window = numpy.blackman(self._fft_size)
        self._fft_histlen=500 # How many items to keep for moving average. 5 times our signal length
        self._data_histlen=self._search_size
        self._data_postlen=5
        self._signal_maxlen=1+int(30/self._bin_size) # ~ 30 ms
        self._fft_freq = numpy.fft.fftfreq(self._fft_size)
        self._signal_width=signal_width/(self._sample_rate/self._fft_size) # Area to ignore around an already found signal in Hz
        
        if self._verbose:
            print "fft_size=%d (=> %f ms)"%(self._fft_size,self._bin_size)
            print "calculate fft once every %d block(s)"%(self._search_size)
            print "require %.1f dB"%(10*math.log(self._fft_peak,10))
            print "signal_width: %d (= %.1f Hz)"%(self._signal_width,self._signal_width*self._sample_rate/self._fft_size)
开发者ID:bkerler,项目名称:iridium-toolkit,代码行数:33,代码来源:detector.py


示例8: apply_filter

 def apply_filter(self, array):
     if len(array.shape)!=1:
         return False # need 2D data
     nx = array.shape[0]
     # Apodization function
     if self.type == 1:
         ft = np.bartlett(nx)
     elif self.type == 2:
         ft = np.blackman(nx)
     elif self.type == 3:
         ft = np.hamming(nx)
     elif self.type == 4:
         ft = np.hanning(nx)
     elif self.type == 5:
         # Blackman-Harris window
         a0 = 0.35875
         a1 = 0.48829
         a2 = 0.14128
         a3 = 0.01168
         x = np.linspace(0,1,nx)
         ft = a0 - a1*np.cos(2*np.pi*x) + a2*np.cos(4*np.pi*x) + a3*np.cos(6*np.pi*x) 
     elif self.type == 6:
         # Lanczos window
         x = np.linspace(-1,1,nx)
         ft = np.sinc(x)
     elif self.type == 7:
         x = np.linspace(-1,1,nx)
         exec('x='+self.custom)
         ft = x
     else:
         ft = np.ones(nx)
     
     array.data = array.data*ft
     return True
开发者ID:vpaeder,项目名称:terapy,代码行数:34,代码来源:apodization.py


示例9: smavg

def smavg():
    # 权重设置
    weights_exp=np.exp(np.linspace(-1,0,N))
    weights_exp/=weights_exp.sum()
    weights_sim=np.ones(N)
    weights_sim/=weights_sim.sum()
    weights_blw=np.blackman(N)
    weights_blw/=weights_blw.sum()

    # 平滑操作
    sm_exp=np.convolve(weights_exp,data)[N-1:-N+1]
    sm_sim=np.convolve(weights_sim ,data)[N-1:-N+1]
    sm_blw=np.convolve(weights_blw ,data)[N-1:-N+1]

    #np.savetxt('result',expa)
    exp_mean=1.01*np.average(sm_exp)
    sim_mean=1.02*np.average(sm_sim)

    #sub mean
    #expa=expa-exp_mean
    #sima=sima-sim_mean

    # 绘图
    #plt.plot(t,data[N-1:],lw=1.0)
    #plt.figure()
    plt.plot(t,data[N-1:],'k',label='origin')
    #plt.plot(t,sm_exp,'r',label='exp avg') #指数移动平均
    #plt.plot(t,sm_sim,'g',label='sim avg') #简单移动平均
    plt.plot(t,sm_blw,'y',lw=2.0,label='blackman win avg')  #布莱克曼窗函数
    plt.legend(loc='upper center')

    #plt.axhline(y=exp_mean,lw=2,color='y')
    #plt.axhline(y=sim_mean,lw=2,color='b')
    plt.show()
开发者ID:tuling56,项目名称:Python,代码行数:34,代码来源:exp_avg.py


示例10: blackman_window

	def blackman_window(self, show=0):
		apod = N.blackman(self.data_points)
		for i in range(2):
			self.the_result.y[i] = self.the_result.y[i]*apod
		if show == 1:
			return self.the_result
		return self
开发者ID:BackupTheBerlios,项目名称:damaris-svn,代码行数:7,代码来源:DaFFT.py


示例11: Execute

    def Execute(self,data):

       #compute power in both components
       pReal = (data['real']/2.0**self.bits)
       pImag = (data['imag']/2.0**self.bits)

       # create empty complex array to combine pReal and pImag
       data = np.empty(pReal.shape, dtype=complex)
       data.real = pReal;
       data.imag = pImag;
       
       # subtract average dc from each range
       dc = np.mean(data,axis=0)
       data = np.subtract(data[:,],dc)
       data = np.clip(data,1e-15,np.max(data))

     
       coeff = np.blackman(64)
       for i in range(0,data.shape[1]):
          data[:,i] = np.convolve(data[:,i],coeff,'same')


       # compute complex 256-point for each range cell
       dMap = np.fft.fft(data,256, axis=0)
       dMap = np.fft.fftshift(dMap,axes=(0,))

       # convert values to dB
       dMap = 20*np.log10(np.abs(dMap));
    
       return dMap
开发者ID:rseal,项目名称:HDF5RPlotter,代码行数:30,代码来源:RadarTools.py


示例12: single_taper_spectrum

def single_taper_spectrum(data, delta, taper_name=None):
    """
    Returns the spectrum and the corresponding frequencies for data with the
    given taper.
    """
    length = len(data)
    good_length = length // 2 + 1
    # Create the frequencies.
    # XXX: This might be some kind of hack
    freq = abs(np.fft.fftfreq(length, delta)[:good_length])
    # Create the tapers.
    if taper_name == 'bartlett':
        taper = np.bartlett(length)
    elif taper_name == 'blackman':
        taper = np.blackman(length)
    elif taper_name == 'boxcar':
        taper = np.ones(length)
    elif taper_name == 'hamming':
        taper = np.hamming(length)
    elif taper_name == 'hanning':
        taper = np.hanning(length)
    elif 'kaiser' in taper_name:
        taper = np.kaiser(length, beta=14)
    # Should never happen.
    else:
        msg = 'Something went wrong.'
        raise Exception(msg)
    # Detrend the data.
    data = detrend(data)
    # Apply the taper.
    data *= taper
    spec = abs(np.fft.rfft(data)) ** 2
    return spec, freq
开发者ID:aminkhalil,项目名称:HtoV-Toolbox,代码行数:33,代码来源:utils.py


示例13: get_freq2

def get_freq2(sample, rate):
    sample_len = 22100
    frequencies = (np.arange(0, sample_len/2+1)).astype('float')*rate/sample_len
    
    
    avg_sample = np.convolve(sample, np.ones((5,)))
    avg_sample = avg_sample[2:-2]
    window = np.blackman(len(sample))
    fft_data4 = np.log(abs(np.fft.rfft(avg_sample*window, sample_len))**2)

    w = 50
    t = 3

    peaks = []    
    for j in range(0,len(fft_data4)-w):
        mx_i = np.argmax(fft_data4[j:j+w])
        strength = fft_data4[j+mx_i]-np.median(fft_data4[j:j+w])
        if mx_i == w/2 and strength > t:
           d_x = frequencies[j+mx_i]
           y0,y1,y2 = fft_data4[j+mx_i-1:j+mx_i+2]
           x1 = (y2 - y0) * .5 / (2 * y1 - y2 - y0)
           peaks.append([d_x, x1, strength])
           
    peaks = np.array(peaks)
    (freq, new_peaks) = freq_from_harmonics(peaks)
    return get_note(freq)  
开发者ID:JamesLTaylor,项目名称:general,代码行数:26,代码来源:get_frequency.py


示例14: get_wave_data

    def get_wave_data(self, file_path):
        with wave.open(file_path, 'rb') as wf:
            sample_width = wf.getsampwidth()
            frame_rate = wf.getframerate()
            num_frames = wf.getnframes()

            length_in_seconds = num_frames / (frame_rate * 1.0)

            num_iterations = int(length_in_seconds * 2)
            iteration_size = int(num_frames / num_iterations)

            wave_data = []

            for fragment_num in range(0, num_iterations):
                data = wf.readframes(iteration_size)

                window_size = len(data) / sample_width
                window = np.blackman(window_size)

                fragment_data = wave.struct.unpack("%dh" % window_size, data) * window
                fft_data = abs(np.fft.rfft(fragment_data)) ** 2

                wave_data = np.hstack((wave_data, fft_data[:100]))  # take only 100 frequences

        return wave_data
开发者ID:shybovycha,项目名称:pitch-detector,代码行数:25,代码来源:GenreDetector.py


示例15: _sweep_harmonics_responses

 def _sweep_harmonics_responses(self, response, N, freqlist, shift=True):
     g = self.input_signal.ptp() / 2
     di = self._fft_convolve(self.sweep_inverse_signal, response / g)  # deconvolved impulse response
     imp_indices = numpy.zeros(
         N + 1, dtype=int
     )  # the indices of each impulse (1st linear, 2nd the first harm. dist. etc.)
     imp_indices[0] = len(self.sweep_inverse_signal) - 1
     for n in range(1, N + 1):
         imp_indices[n] = imp_indices[0] - int(round(math.log(n + 1) * self.sweep_rate))
     imps = []
     for n in range(N):
         dl = (imp_indices[n] - imp_indices[n + 1]) // 2
         lo = imp_indices[n] - dl  # the low limit where to cut
         hi = imp_indices[n] + dl  # the high limit where to cut
         di_w = di[lo:hi]
         win = numpy.blackman(len(di_w))
         if len(di.shape) == 2:
             win = win.reshape((len(win), 1))
         di_w *= win  # smoothed version
         w = freqlist
         if shift:
             w = w * (n + 1)
         h = scipy.signal.freqz(di_w, worN=w)[1]
         off = imp_indices[n] - lo
         h *= numpy.exp(off * 1j * freqlist)
         imps.append(h)
     return imps
开发者ID:unclechu,项目名称:guitarix,代码行数:27,代码来源:signals.py


示例16: main

def main():
    if len(sys.argv) > 1:
        wf = wave.open(sys.argv[1],'rb')
        firstTone = False
    else:
        inp = raw_input('Press enter to start record')
        while inp:
            inp = raw_input('Press enter to start record')
        rec = Recorder(channels = 1)
        with rec.open('Test.wav','wb') as recfile:
            recfile.start_recording()
            print 'Start recording...'
            inp = raw_input('Press enter to stop')
            while inp:
                inp = raw_input('Press enter to stop')
        recfile.stop_recording()
        wf = wave.open('Test.wav', 'rb')
        firstTone = True
        ScaleList = getScale(0, Tones)
        curPos = 0
    swidth = wf.getsampwidth()
    RATE = wf.getframerate()
    window = np.blackman(chunk)
    p = pyaudio.PyAudio()
    stream = p.open(format =
                p.get_format_from_width(wf.getsampwidth()),
                channels = wf.getnchannels(),
                rate = RATE,
                output = True)

    data = wf.readframes(chunk)
    values = []
    while len(data) == chunk*swidth:
        stream.write(data)
        if ( firstTone == False):
            thefreq = getHz( swidth, window, RATE, data )
            posTone = binaryNoteSearch(thefreq, Tones)
            if posTone != -1:
                ScaleList = getScale( posTone, Tones )
                firstTone = True
                curPos = 0
                print "The freq is %f Hz. Note: %s" % ( round(thefreq), Tones[posTone].NoteName )
        else:
            thefreq = getHz( swidth, window, RATE, data )
            if( thefreq > ScaleList[curPos].HighFreq or ScaleList[curPos].LowFreq > thefreq ):
                posTone = binaryNoteSearch(thefreq, ScaleList)
                if posTone != -1:
                    if posTone != 16:
                        values.append(posTone)
                    if len(values) == 2:
                        Text = getString(values)
                        sys.stdout.write(Text)
                        values = []
                        sys.stdout.flush()
                    curPos = posTone;
        data = wf.readframes(chunk)

    Text = getString(values)
    print Text
    p.terminate()
开发者ID:Donluigimx,项目名称:str2Audio,代码行数:60,代码来源:audio2Str.py


示例17: receiving

    def receiving(self, y):
        received = ''

        for x in range(0, len(y), len(generator.time_segment)):
            segment = y[x: x+len(generator.time_segment)]
            fft_segment = numpy.fft.fft(segment*numpy.blackman(len(segment)))
            fft_segment /= max(abs(fft_segment))
            freqs = numpy.fft.fftfreq(fft_segment.size, d=1 / generator.sampling_frequency)
            peak_value_index = numpy.argmax(fft_segment[0:fft_segment.size / 4])
            """
            code alphabet:
            f1 = 00
            f2 - 01
            f3 - 10
            f4 - 11
            """
            if freqs[peak_value_index] == generator.frequency:
                received += "00"
            elif freqs[peak_value_index] == generator.frequency2:
                received += "01"
            elif freqs[peak_value_index] == generator.frequency3:
                received += "10"
            elif freqs[peak_value_index] == generator.frequency4:
                received += "11"
        return received
开发者ID:Daretzky,项目名称:MFSK-simulation,代码行数:25,代码来源:MFSK+simulation.py


示例18: doPitchDetect

 def doPitchDetect(self):
     self.frames = []
     # play stream and find the frequency of each chunk
     swidth = 2
     window = np.blackman(self.CHUNK)
     data = self.micStream.read(self.CHUNK)
     self.frames.append(data)
     # unpack the data and times by the hamming window
     indata = np.array(wave.struct.unpack("%dh"%(len(data)/swidth),
         data))*window
     # Take the fft and square each value
     fftData=abs(np.fft.rfft(indata))**2
     # find the maximum
     which = fftData[1:].argmax() + 1
     # use quadratic interpolation around the max
     if which != len(fftData)-1:
         y0,y1,y2 = np.log(fftData[which-1:which+2:])
         x1 = (y2 - y0) * .5 / (2 * y1 - y2 - y0)
         # find the frequency
         theFreq = (which+x1)*self.RATE/self.CHUNK/2
         if (theFreq > 300 and theFreq < 715):
             self.checkFreq(theFreq)
     else:
         theFreq = which*self.RATE/self.CHUNK/2
         if (theFreq > 300 and theFreq < 715):
             self.checkFreq(theFreq)
开发者ID:eterui,项目名称:SuperMarioWhistle,代码行数:26,代码来源:superMarioWhistle.py


示例19: plot_spectrogram

def plot_spectrogram(x, fs, filename,nfft):
    cf=0.0
    plt.figure(figsize=(18,20))
    fig, ax1 = plt.subplots(nrows=1)
    from matplotlib import pylab
    #wrapper = lambda n: np.kaiser(n,40)
    wrapper = lambda n : np.blackman(n)
    #wrapper = lambda n : np.hamming(n)
    #wrapper = lambda n : np.hanning(n)
    #Pxx, freqs, time, im = ax1.specgram(x, NFFT=nfft,  Fs=fs, detrend=pylab.detrend_none, noverlap=nfft/2, window=wrapper(nfft))
    Pxx, freqs, time, im = ax1.specgram(x, Fs=fs, NFFT=nfft)
    ax1.set_title('specgram spectgm'+'NFFT= %d'%nfft)
    #ax3.axis('tight')
    #labels = [item.get_text() for item in ax1.get_xticklabels()]
    ax1.set_ylabel('frequency(Hz)')
    ax1.set_xlabel('time')
    #ax1.set_ylim(40000,80000.0)
    fig.colorbar(im, ax=ax1).set_label("Amplitude (dB)")
    #ax1.set_xlim(0,7)
    #c=ax1.get_yticks().tolist()
    #print c
    #a=[str(float((i+cf)/1000.0)) for i in c ]
    #print a
    #ax1.set_yticklabels(a)
    #ax1.set_ylim(30,40)
    plt.savefig(filename+'.pdf')
开发者ID:abnarain,项目名称:malware_detection,代码行数:26,代码来源:spectral_analysis.py


示例20: play_

 def play_(self):
     wf = wave.open('output.wav', 'rb')
     chunk = 2048
     swidth = wf.getsampwidth()
     RATE = wf.getframerate()
     window = np.blackman(chunk)
     p = pyaudio.PyAudio()
     stream = p.open(format=p.get_format_from_width(wf.getsampwidth()), channels=wf.getnchannels(), rate=RATE, output=True)
     data = wf.readframes(chunk)
     thefreq = []
     while len(data) == chunk * swidth:
         stream.write(data)
         indata = np.array(wave.struct.unpack("%dh" % (len(data) / swidth), data)) * window
         fftData = abs(np.fft.rfft(indata)) ** 2
         which = fftData[1:].argmax() + 1
         if which != len(fftData) - 1:
             y0, y1, y2 = np.log(fftData[which - 1:which + 2:])
             x1 = (y2 - y0) * .5 / (2 * y1 - y2 - y0)
             thefreq.append((which + x1) * RATE / chunk)
         else:
             thefreq.append(which * RATE / chunk)
         data = wf.readframes(chunk)
     if data:
         stream.write(data)
     stream.close()
     p.terminate()
     self.olahFrequency(thefreq)
开发者ID:youandri,项目名称:Frequency-Based-Voice-Type-Detection,代码行数:27,代码来源:nlp.py



注:本文中的numpy.blackman函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python numpy.block函数代码示例发布时间:2022-05-27
下一篇:
Python numpy.bitwise_xor函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap