Example #1
0
def get_results(duration):
    excitation = generation.log_sweep(fstart, fstop, duration, fs)
    excitation_zeropadded = generation.zero_padding(excitation, duration + pad,
                                                    fs)
    system_response = system(excitation_zeropadded)
    ir = calculation.deconv_process(excitation_zeropadded, system_response, fs)
    return ir
Example #2
0
def get_results(fade_in):
    excitation_windowed = excitation * windows.window_kaiser(
        N, fade_in, fade_out, fs, beta)
    excitation_windowed_zeropadded = generation.zero_padding(
        excitation_windowed, pad, fs)
    system_response = system(excitation_windowed_zeropadded)
    ir = calculation.deconv_process(excitation_windowed_zeropadded,
                                    system_response, fs)
    return ir
Example #3
0
def get_results():
    akf = np.correlate(excitation, excitation, 'full')
    plotting.plot_time(akf,
                       scale='db',
                       title='AKF log. Sweep with Rect Window')
    plt.savefig('akf_log_sweep_rect.png')
    plt.close()
    excitation_zeropadded = generation.zero_padding(excitation, pad, fs)
    system_response = system(excitation_zeropadded)
    ir = calculation.deconv_process(excitation_zeropadded, system_response, fs)
    return calculation.snr_db(ir[0], ir[1:4 * fs]), akf.max()
Example #4
0
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

plotting.plot_freq(h, fs, scale='db', title=' ')
plt.xscale('log')
plt.xlim(1, 23000)