slightly ot: room impulse response and inverse impulse response
Magnus Danielson
cfmd at swipnet.se
Wed Dec 22 02:30:40 CET 1999
From: Martin Czech <martin.czech at intermetall.de>
Subject: slightly ot: room impulse response and inverse impulse response
Date: Tue, 21 Dec 1999 15:05:52 +0100 (MET)
> Caution: This is a long one. It may pay to read it to
> the end, however.
>
> A couple of weeks ago I kicked off a thread about room impulse response,
> measuring that, and convolution. Time to knitt a bit further.
>
> One question was, if I have a nonideal impulse source (pistol etc.),
> will I be able to compute a actual working reconstruction filter, ie. a
> filter that will make the nonideal impulse ideal (maybe delayed) and thus
> the nonideal room impulse response to be he ideal room impulse response.
>
> After some hundred lines of C-code the anser is yes, and no...
>
> Yes, I was able to compute a FIR filter with the desired property:
>
> H(z) * F(z) = UI(z)
>
> with: H(z) pistol spectrum
> F(z) reconstruction filter spectrum
> UI(z) unit impulse response spectrum
>
> at least with a couple of synthetic test functions h(n), eg. exponential
> decay sinusoids.
>
> (Btw.: Pistol. I'm trying to get a device that uses compressed air.
> No fumes (this might upset the church keepers!). Another idea is to uses
> a spring driven plate, crashing into a fixed plate. Another idea was
> the kind of starting device for the 100m dash... I guess large rooms
> will enable me to seperate direct sound from reverb, about 6ms/m if the
> nearest wall is considered. In this case an electronic gate could prevent
> overload during the first wave front. The pseudo noise generator idea
> is nice, but I think a generator with reasonable output would require
> large speakers... which is impossible to carry in a briefcase.)
The trouble with all these methods is that you run in to the trouble of
1) Enougth dynamics in order to measure anything
2) Remove noise sources (airline traffic, car traffic, air conditioner noise
etc)
3) Accurate and repeatable enougth impulse responce of the source
Now, when we do this in concert halls, we actually use a known source.
If you have a known source impulse responce and a known result responce you
may use correlation technique to separate out the room impulse responce.
So, given that we can measure the impulse responce as such on some speaker,
store that and then recall it on the day and then be able to measure the full
impulse responce you should be all set.
Now, to measure the impulse responce of some system we can use some sound of
known impulse responce. It would be ideal if this noise can be controlled and
that it is continous or repeated often enougth and with time accuracy enougth
that we may take repeated measurements in order to eliminate noise sources and
get more accurate readings. One class of signals that fall well into this
category is pseudorandom noise. We can easilly make pseudorandom noise sources
for which we may control the phase well by using some shift registers (that is,
a bunch of D-flipflops) and a pair (or three) XOR gates. By a simple design we
may create maximum length sequence (MLS) pseudorandom noise with known
statistical properties and repeatable with the period of 2^N-1 where N is the
number of shift registers (N=16 => 65535 steps before it repeats itself).
By clocking the shift registers with a known suitable clock we get a nice
signal. One has to adapt the level of the signal so that known levels exist if
one wants to know what is happening in the system.
Anyway, the autocorrelation really requires that one can increase the phase
positions between the generator and detector, we can do that by letting the
detector run an exact replica of the genrator random noise generator. At first
we synchronise them but for each sample we want to make we let the detector
generator lag one cycle from it's previous position. Then, we force it to
stay put for one cycle for each phase/sample step we want to do. Then, within
each such step we simply sample away the input, integrate the result and run
it for long enougth for it to even out and stabilize. Then we store that
value and move on for the next phase position. When we have done that for all
positions possible we have gone a complete cycle and is back at the starting
position. We have now the full suite of samples which is the measured
impulse responce. We can then use this technique to measure the speakers
and measurement mike impulse responce as a reference and then measure it with
a surrounding room. We then use basically the same technique to separate out
the rooms impulse responce.
All this is allready available in the MLSSA measurement rig. It works pretty
well even if it is becomming dated and we could do better nowdays. The MLSSA
system is really nice to work with thougth and I really would like to have
something similar. Time to build one I guess.
Anyhow, I originally came accross this technique in an old Motorola CMOS
hanbook from mid 70this. There was a project there where you actually built
the whole setup and used your DMM for readout! I never got it working (my
skills was not very refined when I built it) but it was all done on a 100x160
mm PCB with ratnest tendencies and would only do 255 steps, more steps is not
that far away. The post processing to compensate of the speaker and mike can
be done quickly in a computer.
Once you have the impulse responce you can do FFT for instance in order to
get a nice frequency responce with phase and all that.
Notice how the core is really very free of FFT and IFFT. You CAN do it with
FFT and IFFT but it is really not required. You don't do division (other then
possibly by a constant, but this can be viewed as a multiplication with a
scaling factor), you just use plain good old addision and multiplication.
And besides, the pseudorandom noise is one-bit amplitude, so you only have to
switch signs and your multiplication is really, really cheap.
Maybe people would be interested enougth in seing an DIY project based on
these methods? I want one at least...
> Voice from the off: "This has nothing to do with synth diy".
>
> I aggree, my friend. Partly. But we all need some kind of reverb, when
> it comes to actuall recording. Wouldn't it be nice to have natural room
> responses in your studio, that will cost you nothing?
Sure. But what I propose above can also be used to measure frequency responces
of filters in the audio frequency range. Done well it can be a really powerfull
tool. Take it from one who have done this on commercial basis and tuned large
PA systems with it, both at the lab bench level and out in the field.
> I'll try to finish my fast convolver C-source. I hopefully will put it
> on my web site, and also DOS executeable.
>
> I'll try to record some impulse responses during Christmas vacations.
> I know at least one church where they wouldn't arrest me for firing
> a pistol (no, not during service...)
Beware of the cross-fire eh... crosstalk???? ;) ;)
> Now: what do the gurus say to my results? Any theoretical hints?
> Any failures? Any pitfalls?
Guru or not (I let that to the readers of this list to comment and judge) I
think I have hinted for an alternative approach of doing this. The hard work
is put on cheap hardware and any computational stuff can be done as
postprocessing and is only needed to be done once. As for hardware requirements
I ran the MLSSA system on a 20 MHz 386 and the 386 had to do the FFTs. It was
pretty usefull (well, except for the normal suite of problems that you get
with DOS applications and environment and naturally we would have loved more
speed) on that entry level.
You could have the hardware itself in a small box and record the impulse
responces on a laptop or even a palmtop (like a Psion or something). The
speaker, amp and mike setup would be the more bulky part of this system.
You can make it pretty portable tougth. A good smooth responce mike and a
good smooth responce speaker is recommended.
There is a catch hidden in here, but I let you guys discover it so I know which
are awake enougth ;)
Yeap, I have and answer to the catch that I refer to ;)
> And: who would like to share impulse responses with me? Also of your
> effects? (Please respond NOT to the list, private).
Who would get the sudden impulse to respond? ;)
Sharing impulse responces sounds like a nice thing to do. Soon we be all
hacking our own reverb algorithms and all of a sudden DSP hacking is the
norm... OUPS!
BTW. Don't kill the tube thread, I really enjoy poping in and reading about
them. Some day I will to do DIY tube stuff... some day...
So, anyone in for a impulse responce DIY project?
Cheers,
Magnus
More information about the Synth-diy
mailing list