Line 73: | Line 73: | ||
The secondpart of the code applies the Tone Filter (using the "Max Treble" setting) to the distorted signal:<br /> | The secondpart of the code applies the Tone Filter (using the "Max Treble" setting) to the distorted signal:<br /> | ||
<source lang="MATLAB"> | <source lang="MATLAB"> | ||
− | % % using the highest tone setting | + | % % using the highest tone setting |
tone_tf = tf([3.179e5 6.78e8 1.062e12] , [4.557e5 3.728e9 5.25e12]); | tone_tf = tf([3.179e5 6.78e8 1.062e12] , [4.557e5 3.728e9 5.25e12]); | ||
tone_dis_tf = c2d(tone_tf,1/Fs); % convert to discrete space | tone_dis_tf = c2d(tone_tf,1/Fs); % convert to discrete space | ||
Line 91: | Line 91: | ||
(I apologize in advance for my crappy guitar skill) | (I apologize in advance for my crappy guitar skill) | ||
− | [[File:SOTW clean.wav | + | [[File:SOTW clean.wav]] |
− | [[File:SOTW_distorted.wav | + | [[File:SOTW_distorted.wav]] |
Revision as of 15:39, 2 December 2017
Characteristic Analysis of a Simple Distortion Pedal (incomplete yet)
by Haoyu Chen
Background
One day when I was playing with my DS-1 Distortion Pedal, I noticed that the circuit inside it was quite simple (it only consists of RC circuits, diodes, and op-amps), and I got curious about how they works in processing the music signal from a electric guitar. So I looked up wikipedia on how distortion works as well as a website that teaches you to "build your own DS-1 pedal."
Overview
Usually, the music signal played on an electric guitar is not directly played out by speaker, instead, the signal goes through one or more pedals to create different distortion to the signal. In this case, I am using a BOSS DS-1 distortion pedal. The DS-1 distortion pedal's circuit consists of 5 main parts:
Input Buffer → Transistor Booster → Gain & Distortion → Tone → Output Buffer
And the main parts that's making changes to the music signal are the Gain & Distortion part and the Tone part.
Distortion
The distortion circuit actually has two part: Gain and Clipping:
↑a simplified circuit for Gain and Clipping respectively
The Gain part is made of an op-amp with a potentiometer, which allows the user to change the Gain factor by turning the potentiometer. Then, after the signal is amplified, this pair of 1N4148 diodes with Vf = 0.7V would cut off any signal part with amplitude larger than 0.7V, thus creating a "hard-clipped" signal. (Clipping) The Clipped signal sounds differently because of the new shape of the signal, and the sound could be "gritty" or "fuzzy", which makes is "distorted."
Here is an illustration of a simple example with a sine wave as input signal:
Tone
The part of circuit that controls the "Tone" of the output signal looks like this:
Unable to compute the original transfer functions, I replaced the reference point of 4.5V with 0V, and I assumed that the frequency responses' filter characteristics should remain the same. With calculations done on scratch paper and finalized through WolframAlpha, I was able to attain following transfer functions: (with the Tone button turn to leftmost position and to the rightmost position respectively)
With the help of Matlab, I obtained frequency responses for both transfer function: (with the Tone button turn to leftmost position and to the rightmost position respectively)
As we can see, the leftmost position offers a Low-Pass Filter while the rightmost position offers a High-Pass Filter, which fits the User's Manual description of "Max Bass" and "Max Treble."
MATLAB implement
Then, I recorded a short guitar play by me (from the song "Smoke on the Water") with no distortion (clean tone), and tried to apply the distortion pedal effect to it using MATLAB:
The first part of the code applies the Gain and Distortion to the original signal:
[SOTW_in,Fs] = audioread('SOTW_clean.wav'); % % applying 100% Gain = 1 + (100k / 4.7k) = 22.27; SOTW_out = 22.27 .* SOTW_in; % % applying the Clipping SOTW_out(SOTW_out > 0.7) = 0.7; SOTW_out(SOTW_out < -0.7) = -0.7; audiowrite('SOTW_distorted.wav',SOTW_out,Fs) % % save the file
The secondpart of the code applies the Tone Filter (using the "Max Treble" setting) to the distorted signal:
% % using the highest tone setting tone_tf = tf([3.179e5 6.78e8 1.062e12] , [4.557e5 3.728e9 5.25e12]); tone_dis_tf = c2d(tone_tf,1/Fs); % convert to discrete space [num,den] = tfdata(tone_dis_tf); A = cell2mat(num); B = cell2mat(den); SOTW_out_tone = filter(A,B,SOTW_out); % apply the filter audiowrite('SOTW_distorted_and_filtered.wav',SOTW_out,Fs)
However, though the frequency response from the last section seems legit, applying the filter does not change the sound of the signal.
So, here are the original record and the distorted and clipped output, as the filtered (finalized) output sounds exactly the same as the distorted output:
(I apologize in advance for my crappy guitar skill)
Sources
[1] BUILD YOUR OWN DS-1 DISTORTION, http://freestompboxes.org/members/5thumbs/Build%20Your%20Own%20DS-1%20Distortion.pdf
[2] Distortion (music), on Wikipedia, https://en.wikipedia.org/wiki/Distortion_(music)