Description

Guitar and Audio technology blog

Monday 20 December 2010

Biquad notch filter


Following the last blog post more code has been written making a functioning biquad notch filter.  Although there is some aliasing produced the filter acts a notch filter with the peak around the 8khz range.  The filter works very well as a high pass filter as it cuts all low frequencies.  Switch statements are used to make sure the correct samples for previous inputs and outputs are used. The code is as follows:

void Laneycub10::processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames)
{
float* in = inputs[0];
float* out1 = outputs[0];
float* out2 = outputs[1];

float a0 = 1;
float a1 = 0;
float a2 = -1;
float b1 = 0.1;
float b2 = 0.9;
float xn0 = 0;
float xn1 = 0;
float xn2 = 0;
float yn1 = 0;
float yn2 = 0;
while (--sampleFrames >= 0)
{
float x = *in++;
switch (xcursor) {
case 0:
xn0 = xbuffer[xcursor];
xn1 = xbuffer[2];
xn2 = xbuffer[1];
break;

case 1:
xn0 = xbuffer[xcursor];
xn1 = xbuffer[0];
xn2 = xbuffer[2];

break;

case 2:
xn0 = xbuffer[xcursor];
xn1 = xbuffer[1];
xn2 = xbuffer[0];

break;

}

switch (ycursor) {
case 0:

yn1 = ybuffer[2];
yn2 = ybuffer[1];
break;

case 1:

yn1 = ybuffer[0];
yn2 = ybuffer[2];

break;



}


float y = a0*xn0 + a1*xn1 + a2*xn2 - b1*yn1 - b2*yn2;
xbuffer[xcursor++] = x;
ybuffer[ycursor++] = y;


if (xcursor == size)
xcursor = 0;
if (ycursor == size) //failsafe W cursor should never reach size
ycursor = 0;

*out1++ = y;

Saturday 11 December 2010

Chebyshev polynomial soft clipper

After an intial set up with the VST template, the max/msp chebyshev experiment has been repeated adding the harmonics with the polynomials using the VST sdk.  The code from the previous experiment has been modified to give each chebyshev polynomial its own variable which is calculated separately and then mixed (added) together at output.  This seems to produce stronger harmonic content and reduces clipping.  The nature of the chebsyhev polynomials are to scale the output values between 1 and -1.  The first five (including the initial frequency) harmonics are produced and from the waveform the frequency difference can clearly be seen.  The image below contains the effected output waveform above and the original source below.





Code:



void Laneycub10::processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames)
{
       float* in = inputs[0];
       float* out1 = outputs[0];
       float* out2 = outputs[1];

       while (--sampleFrames >= 0)
       {
              float x = *in++;


              float y = ((2 * (x*x)) -1);
              float y2 = ((4*(x*x*x))-(3*x));
              float y3 = (8 * (x*x*x*x)) - (8 *(x*x)) + 1;
              float y4 = ((16 * (x*x*x*x*x)) - (20 * (x*x*x)) + (5*x));
              *out1++ = y + y2 + y3 + y4 + x;
              *out2++ = y + y2 + y3 + y4 + x;

              }

Filter analysis

Part of the initial experiment was to analyse the tone stack output of the amplifier and how the controls (marked 0 – 10 under ‘tone’) varied the frequency response of the amplifier.  To measure the response white noise consisting of a full band of frequencies were generated and used as an input source for the amplifier.  The tone control was then moved from the 0 position to 10 and a recording of the output was made.  To record the amplifier a Rode NT5 condenser microphone was used due to its flat frequency response, although as standard a shure sm57 may be used for a guitar recording, the microphones specific frequency response boosts certain guitar friendly frequencies, for the experiment however the aim was to reduce the colouring of the microphone by as much as possible(Fig1 Rode nt5 frequency response).  An important aspect to take into consideration is the frequency response of the speaker in the amplifier as it also adds a great deal of colouration to the tone (Fig2 Celestion Tube 10 speaker frequency response).  Although less important in the tone stack analysis as all frequencies are considered the speakers frequency response is a vital consideration for the waveshaping algorithm design.  In Fig 3 (Frequency plot of amplifier with noise) the top line, representing the tone control at 10, almost identically represents the frequency plot of the speaker specification (for example the drop in dB around the 10kHz area).  The bottom line in Fig 3 represents the tone control at 0 so the difference between the two lines can be seen as the response of the tone stack as its controls are adjusted from 0 to 10 (minimum to maximum).  There is a huge boost of around 30dB in the low frequency spectrum and an average of around a 15dB boost in the mid and high range frequency spectrums.  More detailed designs of the tone stack can now be completed based on these findings.  


Rode NT5 frequency plot

Celestion Tube 10 frequency plot

Laney Cub 10 tonestack plot with white noise
The spectrum tool used is a great freeware plug-in from blue cat audio and can be downloaded from: http://www.bluecataudio.com/Products/Product_FreqAnalyst/

Commercial constraints

It has come to my attention during my initial specification that the research I am completing may well have some commercial relevance and hence I am going to have to restrict the information I post on the blog.  I will however update with progress and provide the final plug-in however I will be unable to provide code or specific details on the code.

Saturday 13 November 2010

Project constraint considerations


Whilst writing the constraints section for the project proposal a number of considerations have been bought to attention.

Frequency range of modelling accuracy:

Time constraints mean that not all frequencies of a guitar will be recorded, analysed and modelled so how much will be?  The first 12 frets of a guitar contain 31 unique frequencies (which some cross over beyond the 12th fret).  

Volume, Gain and Tone controls:

The amplifier has three settings controlling the pre amplifier level, the power amplifier level and the tone stack of the amplifier.  Due to non linearity of analogue circuitry difference between 2 - 4 and 4 - 6 in terms of gain will not be the same however not all 1 - 10 values can be calculated.  Tone stack should prove easier to model as it acts as a single band EQ.  

Speaker emulation:

A key aspect of guitar amplifier sounds are due to the speaker and speaker configuration of an amplifier.  This project however does not include speaker emulation as one of its main aims and instead focuses on the pre and power amplifier valve sections.  There are two key issues with this, first of all if the output of the amplifier is to be recorded then using a microphone to measure the speaker will colour the output with the frequency response of both the speaker and microphone.  There is however a speaker output on the amplifier for connection to external cabinets with an 8/16 ohm resistance output.  If this could be used as a line in then an uncoloured signal could be used to truly represent the output of the amplifier sections.  The second issue is how to test the final model as a model of the amplifier, a similar speaker emulation (using convolution plug-ins) will need to be used to test the effectiveness of the model as a guitar amplifier.

Thursday 11 November 2010

Final Rationale

There is a current trend amongst not only guitarists but general audiophiles to use older vacuum tube technology for amplifiers rather than more modern 'solid state' transistor amplifiers.  Often their argument is that although more expensive and far less reliable than transistor amplifiers they supply a 'warmth' that only analogue circuitry can provide.

Digital modelling of guitar amplifiers, an alternative to more traditional guitar amplification, has in the past decade become more realisable with advancements in DSP technology both on custom chip sets and on personal computers.  The major advantage of using a modelling program for amplification is the range of different amplifiers, cabinets, effects and studio conditions that can be recreated from a click of a button.  The other major advantage of using such software is also cost, with amplification modellers costing much less than a single tube amplifier it is no surprise that modelling programs are becoming so popular, especially with the newer generation of guitarists.  Currently there are several major guitar amplifier modelling programs, major names worth mentioning include Native instruments Guitar rig, IK Multimedia Amplitube and Line 6's POD/Gear box range.  With average prices of the major brands exceeding the £250 mark it is clear that the current range of amplifier modelling solutions is aimed at the professional end user.  Although some ‘lighter’ options are available offering a small range of the full packages these are still a considerable cost especially at an entry level price point.  It is proposed that there is a gap in the current market for a basic entry level vacuum tube amplifier emulator.   

The argument against the current range of modelling options is that they do not reproduce the same 'warmth' that a physical tube circuit creates.  This perception of 'warmth' cannot be scientifically calculated.  In theory reproducing the exact output waveform of a tube amplifier should create an exact model of the physical amplification system.  It is proposed that a VST plug-in is to be created, digitally modelling a physical tube guitar amplifier.  More specifically a Laney Cub 10, a small 10 watt class A/B tube amplifier.  The project aims to gain a deeper insight into the characteristics of tube amplifiers and the different ways in which digital modelling can be achieved.

Anthony Evans  

Wednesday 3 November 2010

Max/MSP chebyshev polynomials

As an initial experiment using Chebyshev polynomials a basic max/msp patch has been created using the first 4 polynomials to create the first 4 harmonics of a sine wave.  An output wave has been recorded and analysed showing the effects of the polynomials on the signal.  The patch needs to be adapted to allow for individual amplitude control of each harmonic.
Max/MSP patch


Using Audacity to analyse the audio the frequency peaks can clearly be seen at integer multiples of the fundamental as expected.  Also noted the 'hollow' sound when only odd harmonics added.  Further polynomials are to be added to create a larger effect.

Frequency plot of max output

This was designed as an initial experiment and shall be further adapted to allow for better amplitude control.  The waveform was also analysed to show the effects of the harmonics on the input signal, as expected the wave changed and grew more square like with each additional odd harmonic added.  The next stage is to analyse the harmonic output of the amplifier at various different settings and frequencies.  A suspect limitation may be the frequency range that can be modelled accurately due to time constraints.  Meaning a certain range of input frequencies will be defined in the modeller, at least for the current time anyway.

Anthony Evans

Initial aims and objectives

The following are the key aims and objectives for the project.
Aims:
  • To design, implement and fully test a wave-shaping model of a Laney Cub 10 vacuum tube guitar amplifier in VST plug-in format.
Secondary aims:
  • To critically evaluate wave-shaping techniques as a method of amplification modelling.
  • To show an insight into the alternative methods of amplification modelling.
  • To document the development process of the VST plug-in.
Objectives
  • Record and analyse output from the amplifier within a certain frequency band.
  • Produce initial designs using a high-level graphical audio programming language of wave-shaping functions to be used to emulate amplifier output.
  • Design and implement a functioning filter modelled on the behaviour of the tone stack of the amplifier.
  • Review literature in the area of guitar amplification modelling, wave-shaping techniques and vacuum tube amplification.
  • Perform experiments using wave-shaping polynomials to evaluate different techniques.
  • Produce C++ algorithms for wave-shaping/harmonic polynomial designs to be implemented using the VST SDK.

Sunday 17 October 2010

Digital guitar amplification modelling: Proposal



There is a current trend amongst not only guitarists but general audiophiles to use older vacuum tube technology for amplifiers rather than more modern 'solid state' transistor amplifiers. Often their argument is that although more expensive and far less reliable than transistor amplifiers they supply a 'warmth' that only analogue circuitry can provide.

Digital modelling of guitar amplifiers, an alternative to more traditional guitar amplification, has in the past decade become more realisable with advancements in DSP technology both on custom chip sets and on personal computers. The major advantage of using a modelling program for amplification is the range of different amplifiers, cabinets, effects and studio conditions that can be recreated from a click of a button. The other major advantage of using such software is also cost, with amplification modellers costing much less than a single tube amplifier it is no surprise that modelling programs are becoming so popular, especially with the newer generation of guitarists. Currently there are several major guitar amplifier modelling programs, major names worth mentioning include Native instruments Guitar rig, IK Multimedia Amplitube and Line 6's POD/Gear box range.

The argument against the current range of modelling options is that they do not reproduce the same 'warmth' that a physical tube circuit creates. This is all down to perception however as 'warmth' cannot be scientifically calculated. In theory reproducing the exact output waveform of a tube amplifier should create an exact model of the physical amplification system.  It is proposed that a VST plug-in is to be created, digitally modelling a physical tube guitar amplifier. More specifically a Laney Cub 10, a small 10 watt class A/B tube amplifier. The project aims to gain a deeper insight into the characteristics of tube amplifiers and the different ways in which digital modelling of these charactersitics can be achieved.  There is real market relevance in this area as the ideal end product would be a commercially viable piece of software.  The current commercial market for the project will also be investigated as well as the theoretical research.  

References