Bad, vile and meaningless: Gnuitar from Alan's clob

So I bought myself a Fender Stratocaster

Now I'm looking for effect boxes to play the guitar with. I bought the Ibanez Wailing Demon wah-wah pedal, and unfortunately the almost useless distortion box called 7th Heaven. I've Boss's OD-3 and Ibanez's DE-7 in the mail, and I'm interested to hear what they sound like.

Audio on Linux

Only, it might just be that I can replace all those effect boxes with a Linux distribution. While I was waiting for the delivery it occured to me that I used to hook my guitar up to my Amiga's parallel-port sampler and then ran some audio software with realtime delay, flanger and phaser effects. So I started looking for applications to do the same sort of stuff on Linux. The name of the game is digital signal processing.

Applications in this front are numerous: stompboxes, creox, ecasound and its dozens and dozens of plugins... But none was quite good. Creox for instance has horrible distortion and only so-so effects. Stompboxes seemed pretty new sort of project, ugly user interface, mostly crappy effects. Ecasound, ecamegapedal and so on did not impress me either. Lots of bad plugins, no good distortions that I could find. In fact, crashy software that has weak effects and sometimes noisy amplifier-breaking, ear-splitting wailings when the mouse slips to some dangerous setting. Ugh!!!

I had almost given up hope, but then I went on gnuitar's homepage and saw it advertising that it has mathematical model for an Ibanez Tubescreamer 9 so I decided to give it a try. And oh my, how fabulous it sounds like.

I've been playing with love-, awe- and general retro-inspiring sounds with the reverb, chorus and the fabulous tubescreamer emulation (called distort2). I really love how it all sounds like. Especially the chorus is mellow and so wonderfully sweet that it should be edible.

But all is not well...

Unfortunately the software was a bit buggy. I took today to work out its kinks, and the result is a patch: gnuitar-0.3.2-alan1.diff. (The patch needs -R for reverse because I'm lame.)

The patch adresses the following issues:

Known issues remaining:

I've written to maintainer about most of these issues, but have not yet received a response.

2005-07-28: Update

I've made contact and it looks like I may become one of the maintainers for gnuitar. (Either that or I fork the software, though.) The patch above is also hopelessly out of date. This here is a snapshot of my work:



The original software worked with GTK1.2, but unfortunately this version will not. I'll have to hack it a bit to fix that.


The science of digital signal processing

The general trick is to take some alternating current system and simulate the states of the components using a bunch of state variables. Many circuits come out as IIR filters, the most common kind is called a biquad filter which operates on the signal by remembering the last 2 samples of the original signal and the last 2 samples of output, and gets the current sample as input. There are whole books about computing those coefficients for biquads and I won't go into that here.

You don't simulate a tubescreamer with just a biquad filter, though. There is actually an exponential equation of some kind which needs to be solved for each sample. The equation is written as follows in the source:

f(y) = x1 + (x-y) / DRIVE + Is * (exp((x-y) / mUt) - exp((y-x) / mUt)

Now, x is the original signal and y is the output of the amplifier. The value f(y) is current in the circuit, and sums to zero when all the components have been satisfied. The mysterious term x1 is the current through a static RC filter that reduces distortion for discants.

When user controls the "DRIVE" parameter, he is actually controlling a resistor that combines the input and output of the operational amplifier together. The smaller this value, the more the term (x-y) factors into the solution and the less distortion is produced by the circuit.

The circuit also has two diodes, modelled by the exponential terms, and the simulation makes current through the diodes large very fast, similar as happens with the actual components should the voltage difference across the diode cross the threshold value (approximately 0.5 V).