AudioBlog Header

Next step is to cascade several valve stages together and see what happens.

Using same single valve stage as previously now was time to see what happens when multiple stages are cascaded together, each stage being capable of overloading the next as in a real amplifier. Several parts of an original circuit are fairly straightforward to simulate with simple lowpass filters, in particular CR ( Capacitor-Resistor ) filters are commonly used between stages to block DC and to tailor the low frequency response of the circuit. In a real amp too much low frequency content can cause muddying of the sound as the low frequencies are of a higher energy than the high frequencies and distort much sooner. Looking at any circuit diagram of a Marshall amplifier reveals that the low frequencies are heavily reduced in the early stages to enable more distortion in the later stages yet retain a reasonable sound at the output, this is achieved using a bypass capacitor on the cathode resistor.


/*
    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

    Blog 2 - cascade valves to see effects of overload
*/
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

stage2 =  tubestage(TB_12AX7_250k,10.0,1500.0,1.204285):highpass( 2,40):lowpass( 2, 18000 ) ;
stage1 = tubestage(TB_12AX7_68k,10.0,1500.0,1.204541) ;

// cascade produces more harmonics and a thicker distortion
process = stage1:*(gain):stage2;

Again results very promising as frequency plots show as gain is increased the number of harmonics and their levels increase accordingly. As in a real circuit the distortion was heard to gradually increase until a certain level and then become unlistenable. Listening tests again confirm that the sound was very similar to that of a real amplifier.

Next step NFB( Negative Feedback Loops ).

 

 

 

In most guitar amplifiers a negative feedback loop is incorporated to flatten the frequency response and reduce noise, often taken from one of the speaker taps on the output transformer back to the cathode of one of the preamp valves. As this is not possible with the current valve models I decided to wrap the loop around various combinations of valves to see the results.

It is important that the feedback signal is 180 degrees out of phase with the original signal to ensure that he feedback is negative otherwise we will end up with howling feedback.

The valve models already invert the signal so if feedback is implemented around an odd number of valves no extra processing is necessary, if an even number the signal must be inverted.

Generally the level of feedback in guitar amps results in an overall gain reduction of between 6-10dB.

/*
	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 2013

	Blog 1 - single valve stage
	Blog 2 - cascade valves to see effects of overload
	Blog 3 - add some NEGATIVE FEEDBACK and look at effects of filtering feedback loop
*/
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

stage2 =  tubestage(TB_12AX7_250k,10.0,1500.0,1.204285):highpass( 2,40):lowpass( 2, 18000 ) ; 
stage1 = tubestage(TB_12AX7_68k,10.0,1500.0,1.204541) ;

feedback =  vslider("Feedback[alias][style:knob]",-60,-60,0.0,0.1):db2linear: smoothi(0.999);
// cascade produces more harmonics and a thicker distortion
// Suing sub as need to make feedback negative
// Once we get to around -6dB feedback gain we get mental high frequencies
// try lowpass on feedback loop to stop this helps but needs to be quite low
// With -3dB of feedback ( giving around 4dB reduction in output signal )
// we need lowpass at around 13400
// In guitarix amp sims they use 6531 lowpass in between stages 

// Listening the feedback does have the effect of tightening the sound some and reducing harmonics
// so could be useful as feedback tone is definitely different   
// Interestingly can apply 0dB feedback as long as lowpass is as low as 6900Hz
// any frequencies above that and level of feedback severely restricted
// Maybe due to phase shift as on scope there is a fair amount ( filters??? )
freq =  vslider("Freq[alias][style:knob]",20000,5000,20000,100);
process =(sub:stage1:*(gain):stage2)~(lowpass( 1, freq):*(feedback));

Several Faust models later the results are pretty promising but do come with some problems. Seems that the feedback signal needs careful filtering as the mixing of the feedback and original signal produces aliasing artifacts and these can result in additive feedback at high frequencies. More tweaking need to get the best compromise here.

 

In many guitar amps a presence control is inserted in the feedback loop. In effect this is high pass filter to ground, gradually bleeding more high frequencies to ground and thus decreasing the treble content of the feedback signal, which in turn means that the treble is accentuated in the final output.

To simulate the presence control a simple adjustable low pass filter was inserted into the feedback loop.

/*
	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 2013

	Blog 1 - single valve stage
	Blog 2 - cascade valves to see effects of overload
	Blog 3 - add some NEGATIVE FEEDBACK and look at effects of filtering feedback loop
	Blog 4 -  Attempt to model simple guitar amp presence control

*/
import("math.lib");
import("music.lib");
import("effect.lib"); 
import("filter.lib");
import("guitarix.lib");

// Slider for the amount of treble bleed to ground.
vol = vslider( "Vol[style:knob]", -20, -70, 10, 0.1 ):db2linear:smooth(0.999) ;
feedback = vslider( "Feedback[style:knob]", -20, -70, 10, 0.1 ):db2linear:smooth(0.999) ;
presence = vslider( "Presence[style:knob]", 0, 0, 10, 0.1 ):*(-6) ;

// This is by experiment seems that main boost should be in the 1-4K area
// Looking ta various graphs online anywhere between 500-1.5kHz seems to be best cutoff point
// Presence uses a fixed frequency and varies the cutoff gain
// Guess from SPICE simulation is that cutoff is around 800Hz-1kHz
freq = 1000 ;
// Find a better low shelf
loop = high_shelf( presence, freq ):*(feedback):lowpass(1,6531.0) ;

// From guitarix stuff put in a tube stage
amp = *(vol):lowpass(1,6531.0):tubestage(TB_12AX7_250k,194.0,820.0,0.840703)  ;
//process = ( sub:amp)~loop;
process = (+:amp)~loop;

And it works!

Some experimentation needed with the filter cutoff but so far a pretty good presence control. Due to nature of the feedback circuit this has quite a different effect from the same filter in the main signal path.

Similarly a high pass filter in the same place produces a "resonance" control, boosting the lower frequencies.