Distortion Effects
4.3 Distortion Effect
4.3 Distortion Effect
Distortion functions are similar to the overdrive in that the resulting signal is modified with respect to some given amplitude threshold. However, the distortion acts over a wider range of thresholds whereas overdrive is often a singular threshold. There are many different forms of distortion effects that are non-linear targeted for guitar such as cubic distortion, arc-tan distor-tion and absolute value. These algorithms lend themselves well to floating point arithmetic but are impractical to implement on an FPGA due to resource utilization as well as the restricting input ranges to values from -1 to 1 in most cases [28, 29].
y= x
Another common method to create a digital distortion effect for electric guitar is to use a large lookup table and compare the incoming audio signal to the look up table. The audio signal will inevitably fall in between two different audio range bins. The signal will then be quantized to either of the two closest range bins depending on the encoding scheme. This method is well suited to FPGAs that have large look up table capabilities but being able to be adjusted is not always a parameter that can be tuned to various ranges like an analog distortion pedal [30]. In order to accommodate the tunability requirement associated with this project,
4.3 Distortion Effect 30
a scalable quantization strategy was utilized. The algorithm seeks to have two main tunable parameters: level and distortion.
The level parameter sets the upper limit on the input signal similar to that of the hard clipping overdrive circuit. This results in any signal that is greater than or equal to the level is quantized to the value of the level input. The distortion parameter works in conjuncture with the audio range bins to determine the spacing between the range bins. The algorithm uses 40 positive and 40 negative audio range bins for quantization. Through empirical testing its was found that 80 audio range bins provided sufficient distortion without sacrificing too much tone.
The algorithm was first developed in MATLAB using a summation of sine waves at different frequencies for the input signal. Distortion range bins were calculated relative to the maximum threshold parameter and the distortion parameter.
Figure 4.9: Quantization Distortion Effect in MATALB simulation - Small Quantization Re-gions
In the case where little distortion is applied, the range bin spacing is relatively small in Fig-ure 4.9 when compared to the the large distortion parameter that was used in FigFig-ure 4.10 where
4.3 Distortion Effect 31
Figure 4.10: Quantization Distortion Effect in MATALB simulation - Large Quantization Re-gions
the audio range bin spacing is much larger. The audio range bins are calculated and expanded from the value of the level value instead of from zero. This effect can be demonstrated by the MATLAB simulations as well noting that in the case of small distortion values, distortion of the signal occurs greater than |2.75 ∗ 105|. In the case of the large distortion value, it can be seen that the range bin spacing is much greater and there is more quantization occurring for values greater than |.25 ∗ 105|. This is due to a combination of setting the quantizing bin pri-ority from the level value instead of zero as well as allowing the range bins to change spacing relative to the level as seen in Figure 4.11.
When porting the MATLAB code to Verilog the scaling parameter that calculated the audio range bin spacing had to be converted from a floating point division to a fixed point multipli-cation. This was achieved by first using the two input parameters that controlled the level and distortion spacing parameter. The two parameters are 8 bit Q8.0. Combining this audio range bin calculation paired with the 80 total range bins offered the most audibly pleasing tone. A
4.3 Distortion Effect 32
Figure 4.11: Distortion quantization audio range bin configuration: Zero based large bins (left) Level based large bins (center) Level based small bins (right)
portion of the positive and negative comparator style distortion algorithm is represented in Figure 4.12
A test bench was created to ensure proper operation of the distortion algorithm. Three test cases were verified with the test bench by varying the threshold and distortion coefficient inputs. The first case has a high threshold and a small distortion coefficient. The second case has a low threshold and a small distortion coefficient. The third case has a low threshold and a large distortion coefficient.
In the first case of Figure 4.13 it can be seen that the high threshold limit coupled with the small distortion ranges creates little if any distortion. When the distortion input was held constant and the level threshold was lowered in the second case, it can easily be seen that the input signal is clipped and other small amounts of quantization take place in the local area around the clipping. In the last case, large amounts of distortion can be seen in the clipped region as well as in the previously clean signal in case two as the distortion coefficient was increased and the level threshold was held constant. The three cases together serve to demonstrate that the distortion algorithm is properly functioning as designed.
4.3 Distortion Effect 33
Figure 4.12: Distortion effect quantization process: Positive value quantization (top) and neg-ative value quantization (bottom)
Figure 4.13: Distortion test bench