Where to start....

Written by steve Print Email

As my aim was both to learn the intricacies of audio DSP programming and to assess the quality of valve simulations using DSP code I decided that the first project should just be a very simply one stage valve preamplifier, a simple task as the valve models are already coded and provided in the Guitarix framework.

Real valve amplifiers are incredibly simple in construction as valves are already basic voltage amplifiers ( unlike transistors which are basically high speed switches ). A single stage amplifier consists of one half of a small triode valve, 3 resistors and 1 or 2 capacitors plus the power source. The operating point of the valve is controlled by the values of these components and can be tuned for the intended purpose ( highest gain, cleanest signal etc etc ). In guitar amps it is not always required to find the operating point with least distortion so chosen values are mostly different from those found in hi-fi amps as some form of harmonic distortion is a necessary part of the final sound.

The valve models in Guitarix are based on ........ and are implemented using a lookup table generated with various parts of the circuit predefined ( power supply voltage, anode resistor, input resistor ). The resulting model can be tweaked at run time as the cathode resistor and resulting bias value are variables. The following values were used for initial experiments as they are the most common in guitar preamplifiers :

Valve 12AX7

Power Supply voltage 250V

Anode resistor 100k

Input/grid resistor 68k

Cathode resistor 1k5

Bias voltage 1.2V

/*
	Experiments with Guitarix Components
 
	Series of experiments with aim of using the "tube" components 
	to build amplifiers as close as possible in topology as real valve amplifiers
 
	Steve Poskitt Copyright 2013
 
*/
import("guitarix.lib");
 
// Input gain so can test overload
gain =  vslider("Gain[alias][style:knob]",0,-20,20,0.1):db2linear: smoothi(0.999);
// A valve is represented by the tubestage function
// By time gain is at +6dB there are numerous harmonics above 22k with 1kHz input sine
// so there is a need for a lowpass filter to calm this down.
// Similarly you can also see harmonics at the very low end which could also cause problems
// In a guitar amp this is no problem as likely to roll off above 6500Hz anyhow
stage1 =  tubestage(TB_12AX7_250k,40.0,1500.0,1.204285):highpass( 2,40):lowpass( 2, 18000 ) ; 
process = *(gain):stage1;

Results were promising, frequency analysis shows production of various harmonics, predominately even order with lower odd order too, the level of harmonics increased with level of input signal until distortion became audible. Generally a good result as in listening tests the result compared favorably with a real circuit, not identical but then the valve model does not take in to consideration phase distortions and the difference in sound of different manufacturers valves.

Next Step is to experiment with different cathode resistor values and compare results.