fs = 44100 fstart = 1 fstop = 22050 pad = 7 # Excitation signal excitation = np.zeros(44100) excitation[0] = 1 excitation_zeropadded = generation.zero_padding(excitation, pad, fs) system_response = measurement_chain.convolution(ir_imitation.diracs([0, 1050]))(excitation_zeropadded) h = calculation.deconv_process(excitation, system_response, fs)[:len(excitation)] # Plot impulse response plotting.plot_time(h) plt.xlim(-500, 10000) plt.xticks([0, 1050, 2000, 4000, 6000, 8000, 10000]) plt.savefig('impulse_response.png') plt.close() # Plot frequency response
duration = 1 pad = 4 # Generate excitation signal excitation = generation.log_sweep(fstart, fstop, duration, fs) N = len(excitation) # Noise in measurement chain noise_level_db = -30 noise = measurement_chain.additive_noise(noise_level_db) # FIR-Filter-System dirac_system = measurement_chain.convolution([1.0]) # Combinate system elements system = measurement_chain.chained(dirac_system, noise) # Lists beta = 7 fade_in_list = np.arange(0, 1001, 1) fade_out = 0 # Spectrum of dirac for reference dirac = np.zeros(pad * fs) dirac[0] = 1 dirac_f = np.fft.rfft(dirac)
import ir_imitation fs = 44100 fstart = 1 fstop = 22050 pad = 7 # Noise in measurement chain noise_level_db = -50. noise = measurement_chain.additive_noise(noise_level_db) # FIR-Filter-System dirac_system = measurement_chain.convolution(ir_imitation.diracs([0, 1050])) # Combinate system elements system = measurement_chain.chained(dirac_system, noise) excitation = np.zeros(44100) excitation[0] = 1 excitation_zeropadded = generation.zero_padding(excitation, pad, fs) system_response = system(excitation_zeropadded) h = calculation.deconv_process(excitation, system_response, fs)[:len(excitation)] # Plot impulse response