Skip to content
master
Switch branches/tags
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Feb 5, 2016

README.md

imptsp.py

Description

A python class for measuring an impulse response with time-stretched pulse (TSP a.k.a. swept-sine) signal. pyaudio, numpy, and matplotlib are required.

In example.py, the output file is written in MATLAB/Octave format using scipy.io. imp_fsXXXX_chXX.mat

Usage

The main class file is imptsp.py. The sampling frequency (Hz) and length of TSP signal (samples) must be specified. Please also refer to example.py for the usage.

First, the class file is imported in your python script:

from imptsp import imptsp

Initialize for the sampling frequency of 48kHz, TSP length of 65536 samples, and 2 channels:

imp = imptsp(48000, 65536, 2)

Measure the impulse response for input channel #1 and #2 and output channel #1:

(ir,tsp) = imp.get_imp([1,2],1)

The impulse response data is stored in ir and the recorded TSP signal is stored in tsp for debugging.

Terminate:

imp.terminate()

If you want to check audio device information, run

python check_audio_dev.py

The other configuration for initialization is as follows:

  • imptsp(Fs, tsp_len, [nchannel], [dev_id], [dbg_ch], [flg_fig], [flg_dump], [nsync], [flg_ud], [flg_eval])
    • Fs: sampling frequency
    • tsp_len: TSP length
    • nchannel: number of channels
    • dev_id: index of audio device
    • dbg_ch: channel number for debug
    • flg_fig:plot figure flag
    • flg_dump: output wavefile flag
    • nsync: number of synchronous additions
    • flg_ud: TSP up or down (0 or 1)
    • flg_eval: TSP evaluation flag

Requirements

References

License

MIT

Author

Shoichi Koyama

About

Measuring impulse response with time-stretched pulse (TSP) signal

Resources

License

Releases

No releases published

Packages

No packages published

Languages