Thursday, January 31, 2013

Its Convoluted

I'm so ridiculously close to having my thesis done its ridiculous. I'm crazy not to just finish it up. So why am I writing this? I'm not sure.



I stayed up really late last night trying to finish episode 61 of OSMP. I got pretty frustrated with Ardour3 but I think it may have been a result of creating the project in 48khz sampling the recording and mixing everything at 44.1khz. Anyway its out now so go have a listen. I talk a little about IRC a lot about convolution and impulse responses (IRs), and a little about the next Tunestorm. I'm not going to stenograph everything I said in those wee hours of the morning, you can go listen to it, but I'd like to add a few things here.

Convolution, actually was the subject of my first honors project at USU. The honors program was pretty useless, but this project was good, and I wouldn't have done it without the honors requirements, but thats all another story. Bottom line: I think convolution is awesome in the nerdiest sort of way.

In the episode I talk a fair bit about the theory, but forgot several applications that I wanted to mention. I used the IR reverb plugin for all the demonstration in the podcast, but there are lots more ways to convolve. Some notable ones I've used are the jconvolver engine in Guitarix, and the convolutron in Rakarrack. The jconvolver is more a frontend in Guitarix. Last I checked at least, you had to configure it with the dialog then click go and the settings apply, which means no realtime tweaking fun. The rakarrack convolver was heavily optimized so that you can downsample to get most of the benefits without quite so much computation, though its probably the heaviest effect in the rack. I've never really tried to add my own impulse to it either so I can't comment on how that goes, but the presets built in sound nice. Now you are aware of some other convolution options, really when it comes to mixing I think IR hands down is the convolution plugin to reach for.

Another thing I discuss was making my own impulse responses. For synthetic IRs I've used gnu octave, the FLOSS equivalent of Matlab. And JSYK I love octave. For those inlined here is the script I used:

%synthetic Impulse Response File generator
fs = 48000;%sample rate
nsamples2 = 2*fs;%2 second ir
hz = 440;
del = .5;

sines = sin(2*pi*hz/fs*(1:nsamples2));
delay = zeros(1,nsamples2);
delay(1:fs*del:nsamples2)=1;

chirpup = chirp(0:1/fs:2,300,2,15000);
chirpdn = chirp(0:1/fs:2,15000,2,300);

noise = rand(1,nsamples2);

ausave('sines.wav',sines,fs,'long');
ausave('delay.wav',delay,fs,'long');
ausave('chirpup.wav',chirpup,fs,'long');
ausave('chirpdn.wav',chirpdn,fs,'long');
ausave('noise.wav',noise,fs,'long');



Save that as ir.m or something.m open octave in a terminal in that directory and simply run the command ir.m. In the directory you will have several wav files that work as IRs, You can change lengths and sampling rate and all that.

Some comments on the podcast taught/reminded me new ways to make your own IRs measured from whatever spaces you want. The first was to pop a balloon and record the response. Its close enough to an impulse to get a pretty good sample I hear.

The other way which is more common today is deconvolution. This is basically unconvolving a known signal to figure out what the IR is. Usually the known signal is a sine sweep (a really slow chirp signal). This way the calculated IR has all the harmonics. The downside of this is you are actually measuring the IR of your speakers playing in the room being recorded through your mic. If you have really accurate stuff you'll have the response, but I imagine any condenser with a full range monitor system would be good enough to use. You don't really want to hear reverb anyway. Its the sort of thing that should be in the background, you're much more likely to notice when its not there at all.

There is a program that makes this easy! Qloud is designed for measuring loudspeaker performance to aid in design. But the way it takes measurements is a long sine sweep (sound familiar?). Set it from 20hz to 22khz, let her rip and whamo! One of the outputs is an impulse response! Its not very clear how to export the IR, but the secret is, qloud is actually just storing 2 IRs for every measurement. Make note of the working directory in the main window and the measurement number you want and in said directory will be #impulse trimmed.wav. That will do it. Just load it into IR and it will sound like whatever room you measured, without taking off your headphones.

No comments: