Applying the inverse of an impulse response?

VST, AU, AAX, CLAP, etc. Plugin Virtual Effects Discussion
RELATED
PRODUCTS

Post

Let's suppose you're using convolution to apply a speaker cabinet impulse response to a source. The output then sounds like it was recorded through a speaker cabinet. I was wondering, is there any way that you could use the processed file and the original impulse response to REMOVE the cabinet effect from the processed file (and perhaps other recordings that were similarly processed)? I tried phase inverting the impulse response and re-convolving the processed file, but that just resulted in a mushy mess, so I'm pretty sure that's not the way to go about things :) . Any DSP gurus care to enlighten me?

Post

http://www.voxengo.com/product/deconvolver/
however, that's offline.
something that's not (exactly) deconvolution but tries to do what you want:

http://www.zynaptiq.com/unveil/
or this one:
http://www.zynaptiq.com/unfilter/

Post

chroma wrote:http://www.voxengo.com/product/deconvolver/
however, that's offline.
something that's not (exactly) deconvolution but tries to do what you want:

http://www.zynaptiq.com/unveil/
or this one:
http://www.zynaptiq.com/unfilter/
Thanks for the suggestions, chroma. With regard to deconvolver, my understanding was that it could be used to generate an impulse response based on the dry and wet signals. That impulse response could then be used to apply the desired reverb/effect to alternative dry sources, but I don't think you are able to use it to remove said effect from wet sources that already have it. Feel free to correct me if I am mistaken.

Post

MaxC wrote: That impulse response could then be used to apply the desired reverb/effect to alternative dry sources, but I don't think you are able to use it to remove said effect from wet sources that already have it. Feel free to correct me if I am mistaken.
On the Voxengo Deconvolver, you set path to "test tone file" , and the one where the reverb is applied.
You could try to swap both, and see if it works.

Post

Careful this may result in time travel.

Post

Zynaptiq claim that one can do this very thing with their Unfilter software. In fact, it is one of the tests in the demo video, removing a cabinet from a lead guitr...And then placing the cabinet from that guitar onto a lead synth. Just watch the demo video on their website. The possibilities with this device seem at first glance intriguing, but I have not tested it as of yet. I'm waiting for a rainy day and....We have nothing but sunshine here in the North for weeks now :tu:

Post

snigelx wrote:Zynaptiq claim that one can do this very thing with their Unfilter software.
Unfilter is in fact amazing, but assuming a hobbyist doesn't have a spare $400 laying around, is there any other software/technique that can achieve something comparable, even if not as elegantly? Clearly it is theoretically possible. Perhaps Zynaptiq has a monopoly on the capability thus far...

Post

well, unveil/unfilter is quite more complicated than 'simple' deconvolution (i didn't look at the voxengo plug in detail... deconvolution is a well-defined mathematical process which could theoretically reverse convolution for a known impulse).

however, unveil manages to do this without knowing the original impulse response - they are using AI techniques (so their web site says) to discern which parts of 'desirable' and which parts are extra things like room sound. i don't know of anything else even close to it.

Post

MaxC wrote:
snigelx wrote:Zynaptiq claim that one can do this very thing with their Unfilter software.
Unfilter is in fact amazing, but assuming a hobbyist doesn't have a spare $400 laying around, is there any other software/technique that can achieve something comparable, even if not as elegantly? Clearly it is theoretically possible. Perhaps Zynaptiq has a monopoly on the capability thus far...
Have you tried the Voxengo Deconvolver, by swapping test tone & target reverb result ? You can try it for free,it's only limited if you want to make extensive use of it such like batch processing.

Imho, it's possible to compute the reverse of a convolution.
After all, a convolution is just a linear combination of values from sample,
and mathematically this could be "inversed" (just like could solve easily any linear system of equations).

Post

If you don't know the original convolving function then any deconvolution will be guess work and therefore inaccurate I'm afraid.
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/
£10 for lifetime updates including wavetable editor for Windows.

Music: https://soundcloud.com/markholt

Post

take impulse fft data, make magnitudes (1 - mag), rerecord impulse, convolve.

maybe mammut or something does the (1 - mag) thing... (a math environment like octave ought to if you use one). when people say "spectral inversion" i think they usually mean the frequency bins are reordered, so it might be a hard search term.
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.

Post

I've recently come across this explanation of the process from a HRTF project at MIT. The following passage describes how one can generate an inverse filter of an impulse response using solely the IR:
The inverse filter was designed by zero-padding the measured impulse response and taking the DFT of the zero-padded sequence. The resulting complex spectrum was inverted by negating the phase and inverting the magnitude. This was done over the range from DC to 18 kHz; beyond 18 kHz the inverse spectrum was made flat by repeating the 18 kHz magnitude value. The inverse filter was obtained by computing the inverse DFT of this spectrum.
As is often the case, having answered the original question, I am now left with more questions:

1. How does one take the DFT of an IR? Is there a simple program that can accomplish this without resorting to MATLAB or compiling various open source libraries? I'm no programmer...

2. What is meant by "negating the phase"? Is this different than phase inversion?

3. How does one invert the magnitude of a spectrum?

4. How does one compute the inverse DFT of a spectrum?

The whole process looks like it may be more trouble than it's worth, but I thought I'd ask anyway in the event someone out there has an elegant solution.

*Mods, feel free to move this thread to the DSP sub-forum if you deem it appropriate.

Post

MaxC wrote:1. How does one take the DFT of an IR? Is there a simple program that can accomplish this without resorting to MATLAB or compiling various open source libraries? I'm no programmer...
You can always try Scilab or GNU Octave. Especially the latter one is very much like Matlab (Scilab is a bit easier to use IMO), and you can do all your manipulation in there.
2. What is meant by "negating the phase"? Is this different than phase inversion?
3. How does one invert the magnitude of a spectrum?
An DFT (or FFT) of a signal results in an array of complex values, a+bi. The magnitude is sqrt(a^2+b^2), the phase is atan2(b, a). So my guess is they find another complex value, a' + b' i, for which the magnitude sqrt(a'^2+b'^2) is max - sqrt(a^2+b^2), and the phase atan2(b', a') = -atan2(b, a). I'm too lazy to look up how to determine a' and b'.
4. How does one compute the inverse DFT of a spectrum?
With the inverse transformation function. E.g. if spectrum = fft(signal), then signal = ifft(spectrum).

Perhaps you should try to find an easy introduction into Fourier Transform and FFT, and try out a few things with Scilab or Octave.

Post

Hi all,

I wrote this up a while ago, but didn't know if anyone was really interested or not. Now that this thread has been bumped, what the heck....

--------

The process of deconvolution can be implemented as a convolution. This may be the point of xoxos's post, but I cannot tell for certain --- if so, it's a good suggestion for addressing some of the concerns voiced in this thread.

The advantage of doing deconvolution this way is that you can use all the additional functionality of a typical convolver (for example, applying envelopes, filters, etc.) in real-time inside of your DAW instead of running the deconvolution outside. In other words, you can tweak your deconvolution in real-time to either "improve" the result or, alternatively, provide additional sound-mangling possibilities.

The impulse response function (IR) to be used can be created from the original one by a simple algorithm. Below I provide an algorithm or recipe.

--------

Take an FFT (DFT) of the original IR. This produces a sequence of complex values a + b*i. This could be, for example, a stereo WAV file that has all the a's in the left channel and b's in the right channel. Exactly what this is depends on the format used by the FFT program.

For each resulting a, b compute a' , b' , taking care to note the minus sign for b' (real-valued arithmetic follows, that is not requiring complex-valued math libraries or capabilities):

a' = a / (a*a + b*b) = a / (a^2 + b^2)

b' = -b / (a^2 + b^2)

In polar form for comparison to previous recent discussion and/or for the case that your FFT program uses polar form:

Magn' = sqrt(a'^2 + b'^2) = 1 / sqrt(a^2 + b^2) = 1 / Magn

Phase' = arctan(b' / a') = arctan(-b / a) = -Phase

Form the sequence of complex values a' + b' * i, taking care to put the values in their proper places, by which I mean simply a' goes where a was and b' goes where b was for each complex value. Multiplication by i, for those not familiar with this stuff, is implied by where you place b'.

Take the inverse FFT (inverse DFT) of the new sequence, creating the new IR (that is, time domain) for doing the deconvolution using convolution. Be sure to use the inverse FFT program that corresponds to the forward FFT --- same block size, etc. --- not just any old iFFT program that you have lying around.

It should probably be noted that deconvolution is inherently noisy; it relies on division, even with the process above (thanks to 1 / (a^2 + b^2) ). Be careful with your volume levels when you first try the newly formed "inverse" IR and when tweaking your deconvolution with filters and envelopes.

I myself set a' = b' = 0 whenever a = b = 0. You might as well: The IR in question is assumed, rightly or wrongly, to be *exactly* what was used to create the signal to be deconvolved. Given that assumption, the original convolution should produce a = b = 0, so you'd be dividing zero by zero which is, of course, thoroughly undefined, not merely approaching plus or minus infinity as the denominator approaches zero in the division, as it would for a finite numerator.

Similarly to what was previously described, you may be able to take the *complex-valued reciprocal* (not 1 - Magn) in Octave or other scientifically oriented programs rather than writing a program or script. The program used must comprehend complex-valued operations and should use at least double-precision floating point arithmetic. Many programming languages now perform complex-valued arithmetic or can be linked to libraries that do this. But still be sure to consider what to do for a = b = 0 as I noted just above.

Regards,
Dave Clark

PS: To double-check the math above, start with the definition of the complex-valued reciprocal:

a' + b' * i = 1 / (a + b*i)

and separate out real and imaginary values. Useful hint: (a + b*i) * (a - b*i) = a^2 + b^2.

Post

if you have any environment where you can perform it, fourier analysis will give you magnitude and phase data. like i did say before you went looking for it elsewhere, the magnitude would be (1.0 - magnitude)

don't chuck out the phase data (by which they presumably mean zeroing, or maybe randomising it) because "it's still good, man!" even after changing the level! amazing!

unfortunately i can't think of any way to make this easily available to you. it's seriously a matter of typing about four characters into an existing fft process, but my existing fft codes aren't inside a trivial standalone. may take you a few hours to learn, a programmer 20 minutes to build.

if it were just one file you need, there's probably a bunch of guys proficient in matlab/octave to just take (ooh, 45 seconds?) to make an inverse of your impulse file.
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.

Post Reply

Return to “Effects”