Cabinet simulation using biquad filters

My last post introduced tintamp and described the target hardware for the project. I’ll now fill that out a little bit with a description of one the building blocks from which I plan to construct the initial signal chain. For now the idea is to fairly simplistic DSP techniques from which I can develop and end-to-end signal chain, including an amplifier, tonestack and cabinet simulation. Once there is a complete signal chain then the hardware components needed to connect the delicate guitar signal to the target hardware can be tested. Likewise when more sophisticated software is written we have a benchmark to compare it to. There’s no point in sophistication just for the sake of it.

Ultimately I think only two blocks are needed to build a complete chain, a biquad filter and a waveshaper. On its own the biquad is sufficient to construct simple tonestacks and cabinet simulations while the waveshaper allows us to trivially model non-linear relationships between input and output voltages. A waveshaper is not insufficient to model a real valve’s behaviour for AC signals although it can be combined with a biquad filter that feeds back from its input to its output to add at least some modelling of dynamic behaviour.

So on that basis I coded up these basic building blocks (including a test suite) and set to work. I should at this point express my gratitude to Robert Bristow-Johnson for his Cookbook formulae for audio EQ biquad filter coefficients, all those filters compressed into such an easy to read document saved me an awful lot of work.

So, lets get back on topic and introduce a basic cabinet filter using only biquad filters. My starting point was a trace of the frequency response of the Condor cabsim from runoffgroove. I had no real reason to pick this cabinet response over any other but I happened to stumble across their graph first.

Based on the above graph picked out five biquad filters:

  • A -16dB partial notch filter at 400Hz to get the deep notch
  • A 6dB high boosting shelf filter at 400Hz to get the roller coaster effect
  • A single high pass filter at 60Hz
  • Two low pass filters each at 4000Hz

As of now I haven’t yet graphed the response of this cabinet simulation (although I have listened to it) and currently all the Q values are untuned and set to 0.7 . Tuning these will have a big effect on the mid range since in particular they change the shape of the curve around the notch.

Having got this far I won’t be using the runoffgroove graph as a reference any more. All further tuning will be by ear and, eventually, I’ll create other speaker models using graphs from real speakers. That said it will be while before I start improving the cabsim. At the moment one working cabsim is sufficient to get the rest of the signal chain in place so the focus has to be somewhere else for a while.


The Integer Amplifier

This post is an introduction to tintamp, the integer amplifier. The goal of the tintamp project is to build a free software guitar modeller for low resource computers such as digital music players or modern high performance microcontrollers. The focus on low resource devices defines much of the character of the project from its choice of implementation language to the relatively simplistic, and therefore CPU-friendly, DSP engine. These devices also mandate unusual features such as the no malloc() mode and the use of purely integer arithmetic operations (a.k.a. fixed point) from which the project gets its name.

To provide even more focus and to make it easier to ‘complete’ the project I have picked two platforms to be reference devices. These are the first devices I expect to port tintamp to. Both devices require a little hardware hacking as well as the tintamp software so there will be a substantial element of learning as I go.

Target 1 – Sansa Clip Zip

From a hardware perspective this is a simple mini-project to convert an off-the-shelf digital music player into a headphone practice amplifier. The digital music player in question is the Sanza Clip Zip made by Sandisk.

From the point of view of this project it has good many things going for it. In particular it has audio inputs that can be tapped into by de-soldering either the built in microphone or FM radio chip. It also has a colour display, a 250MHz ARM9 CPU and,crucially, a mature Rockbox port. The Rockbox port means I can concentrate on the signal processing code without having to work very hard getting the rest of the hardware to work. Even better, these devices are really cheap, so much so that I’m seriously contemplating buying a second one to keep and use for its original purpose.

The only problem with the device is the noise floor. The microphone is probably too noisy too use at all and even with the FM radio’s line in things are only 12dB better. Still, when finished this device will be a headphone practice amp so there’s little need for studio quality effects. It just has to be playable.

The most significant technical limitation of this platform is the absence of FPU making this device is the main motivation for (optionally) using fixed point arithmetic.

Target 2 – STM32F4-Discovery

This time around the mini project it to take a demo board based around a very powerful modern micro controller, combine it with a good quality codec chip and build a digital effects pedal.

The discovery board from STMicroelectronics[1] brings most of the pins of ST’s STM32F4 controller and brings them out to header connectors. This includes the I2S (digital audio) in/out needed to interface it to a codec chip. Alternatively the board has built-in audio output together with a USB on-the-go controller that allows a USB audio device to be connected up.

The STM32F4 is based around a 168MHz ARM Cortex M4 which, although restricted to only the Thumb2 instruction set, does have a floating point unit. Here the big restriction is that being a micro controller there is only 192k of RAM. This will have to be very carefully managed. On the other hand what memory there is should be very fast compared to the CPU so no performance will be wasted with cache misses.

In the interests of full disclosure I should probably mention that I work for STMicroelectronics. However I don’t work in the microcontroller group and I didn’t pick the Discovery board because it was made by ST. I picked it because the board is fast, cheap and has I2S pins. Likewise, however much I ask my manager, I don’t get the board for free; I have to pay for it like anyone else. While disclaiming things I should also add that nothing in this blog comes from my employer. I’m not authorized to speak on their behalf and all opinions expressed here are purely my own.


De-gunking a thirteen year old Coleman stove

We finally decided enough was enough with the behaviour of our aged but much loved/abused Coleman 424 stove. It was kill or cure time! To explain, Coleman petrol stoves really are brilliant. However if you run them for too many years on neglect and unleaded they start to clog up. In the case of our Coleman it has reached the stage where it eats generators for breakfast. They last maybe three days camping before they are as clogged and gummed up as the one they replaced resulting in a anaemic flame with boil times of around twenty minutes, if ever.

However we want to give it a fighting chance so we’ve given it a new generator and given the tank the cleaning it should have had eight years ago.

After examining it we could hear what sounded like sand in the fuel tank. It has certainly never had sand put in it but it has been laid idle for long stretches of time with a full tank of unleaded. Apparently this lines the tank with varnish which then flakes off and clogs the generator.

The Coleman website suggests a long soak in meths for this problem so we duely filled the tank and left it for twenty four hours disturbed only by the odd shake. Then we siphoned the tank, poured the meths back into the bottle and were left with this.


Noting that the jar in the picture above is upside down should give you some idea of just how sticky the sludge in the tank was. Even shaking the jar has little effect. No wonder the generator kept blocking up! I was so pleased with my new sludge I immediately refilled the tank with meths and siphoned it out twice more. After doing this there was nothing to be heard in the bottom of the tank.

We’ve all recently discovered a fuel called Aspen 4T. Its designed for strimmers and other hand held petrol tools. It’s selling point is a much cleaner burn than regular road fuel. It certainly smells better when you run the cooker! Aspen is about twice the price of unleaded or to put it another way between half and a quarter of the price of Coleman fluid. We plan to make it our fuel of choice for our Coleman kit.

So did all this bustle, activity and alternative fuel actually work? We don’t really know yet. We’ll let you know when we get back from our next camping trip.