def compute_ir(n_chan, index): import audio_io import scipy.signal import scipy.fftpack # if mono, only leftchannels are used #Extracting Channels resp_l, resp_r, meas_l, meas_r=audio_io.extract_channels(n_chan,index) # calculating the inverse filter meas_fft_l = scipy.fftpack.fft(meas_l) meas_fft_l= meas_fft_l/meas_fft_l.size inv_meas_l = 1/meas_fft_l inv_filter_l =scipy.fftpack.ifft(inv_meas_l) inv_filter_l = inv_filter_l.real meas_fft_r = scipy.fftpack.fft(meas_r) meas_fft_r= meas_fft_r/meas_fft_r.size inv_meas_r = 1/meas_fft_r inv_filter_r =scipy.fftpack.ifft(inv_meas_r) inv_filter_r = inv_filter_r.real #convolve system response with the inverse filter ir_l = scipy.signal.fftconvolve(resp_l,inv_filter_l) ir_r = scipy.signal.fftconvolve(resp_r,inv_filter_r) return (ir_l, ir_r)
def compute_resp(n_chan): import audio_io import scipy.signal import scipy.fftpack # if mono, only leftchannels are used print "Splitting Channels" #Extracting Channels resp_l, resp_r, meas_l, meas_r = audio_io.extract_channels(n_chan, 0) return (resp_l, resp_r)
def compute_resp(n_chan): import audio_io import scipy.signal import scipy.fftpack # if mono, only leftchannels are used print "Splitting Channels" #Extracting Channels resp_l, resp_r, meas_l, meas_r=audio_io.extract_channels(n_chan,0) return (resp_l, resp_r)
def compute_ir(n_chan, index): import audio_io # if mono, only leftchannels are used #Extracting Channels resp_l, resp_r, meas_l, meas_r = audio_io.extract_channels(n_chan, index) # crosscorrelation of measurement signal and system response # savin IR in array ir_l = numpy.correlate(resp_l, meas_l, "same") ir_r = numpy.correlate(resp_r, meas_r, "same") return (ir_l, ir_r)
def compute_ir(n_chan, index): import audio_io # if mono, only leftchannels are used #Extracting Channels resp_l, resp_r, meas_l, meas_r=audio_io.extract_channels(n_chan,index) # crosscorrelation of measurement signal and system response # savin IR in array ir_l=numpy.correlate(resp_l, meas_l, "same") ir_r=numpy.correlate(resp_r, meas_r, "same") return (ir_l, ir_r)