Csound Csound-dev Csound-tekno Search About

Find IR from input and output sound

Date2016-05-05 02:04
FromAlex Weiss
SubjectFind IR from input and output sound
Hi list,

Is there a way in csound to generate the impulse response of an LTI system when I have an input sound and its resulting output? My Octave/Matlab skills (and DSP skills, for that matter) are a bit rusty so I'd prefer to do it in csound if possible.

Thanks,
Alex
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-06-13 02:45
FromRodolfo Cangiotti
SubjectRe: Find IR from input and output sound
Hi Alex,
considering my level of knowledge about signal processing and mathematics as
not so high, I have to say that I feel not completely sure what I am writing
here now is actually right.
Anyway, I hazard to say that probably the deconvolution process is what you
are looking for.
Unfortunately, despite there are a lot of Csound opcodes that do convolution
between signals, as far as I know there are not opcodes which allow to do
the inverse procedure. 
However, if you consider to spend a little bit of your time, I think it is
possible to get the same result in a not so hard way, using some of the
currently available Csound opcodes.
Handling a bit of theory, Wikipedia defines the deconvolution as an
algorithm which allows the computation of an original signal f(t) if the
resulting signal h(t) and the convolving function g(t) are known. The same
algorithm can be considered also as a division between spectra, that is F =
H / G (capital letters means the tranform of a signal in the frequency
domain, that is the Fourier Transform). If the latter operation can be
considered as linear, I suppose that it is possible to isolate G, that is
the Fourier Transform of the convolving function, by doing G = H / F. Then,
doing the Inverse Fourier Transform of G, the result should be just the
convolving function g(t). I am continuously mentioning the convolution
because the behaviour of LTI systems can be interpreted also as a
convolution between an input signal and a transfer function, which is its
impulse response.
So, that said, in my opinion you should just do the FFT of the input and
output signal and divide the resulting spectrum of this latter for the one
of the input signal; then, you should do the IFFT and theoretically you
should get the IR of the LTI. I am not familiar with this kind of operations
in Csound but the pvs opcode family should allow to do this.
Hoping what I briefly explained above is anyway pretty understandable, I
would also like to please readers with a better knowledge than me about
mathematics and signal processing to correct any possible mistake I did
during my arguing above and to eventually explain a bit more in depth such
topic. I say once more that I am not properly familiar with this stuff but I
like it pretty much and I would really like to improve my knowledge about
it, on my side.
Thanks in advance and regards.



--
View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Find-IR-from-input-and-output-sound-tp5749502p5750149.html
Sent from the Csound - General mailing list archive at Nabble.com.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here