<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5//EN" "http://cnx.rice.edu/technology/cnxml/schema/dtd/0.5/cnxml_plain.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" id="id9042921">
<name>Modeling guitar distortion in Matlab</name>
<metadata>
  <md:version>1.1</md:version>
  <md:created>2006/12/18 02:38:39.993 US/Central</md:created>
  <md:revised>2006/12/20 16:21:06.660 US/Central</md:revised>
  <md:authorlist>
      <md:author id="brent">
      <md:firstname>Brent</md:firstname>
      <md:othername>E.</md:othername>
      <md:surname>Stephens</md:surname>
      <md:email>brents@rice.edu</md:email>
    </md:author>
      <md:author id="narayann">
      <md:firstname>Neil</md:firstname>
      <md:othername>K.</md:othername>
      <md:surname>Narayan</md:surname>
      <md:email>narayann@rice.edu</md:email>
    </md:author>
      <md:author id="robsmith">
      <md:firstname>Rob</md:firstname>
      
      <md:surname>Smith</md:surname>
      <md:email>rob@rice.edu</md:email>
    </md:author>
      <md:author id="barron">
      <md:firstname>Barron</md:firstname>
      <md:othername>D.</md:othername>
      <md:surname>Stone</md:surname>
      <md:email>barron@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="brent">
      <md:firstname>Brent</md:firstname>
      <md:othername>E.</md:othername>
      <md:surname>Stephens</md:surname>
      <md:email>brents@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="narayann">
      <md:firstname>Neil</md:firstname>
      <md:othername>K.</md:othername>
      <md:surname>Narayan</md:surname>
      <md:email>narayann@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="robsmith">
      <md:firstname>Rob</md:firstname>
      
      <md:surname>Smith</md:surname>
      <md:email>rob@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="barron">
      <md:firstname>Barron</md:firstname>
      <md:othername>D.</md:othername>
      <md:surname>Stone</md:surname>
      <md:email>barron@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>distortion</md:keyword>
    <md:keyword>guitar</md:keyword>
    <md:keyword>matlab</md:keyword>
  </md:keywordlist>

  <md:abstract>An implementation of distortion in Matlab</md:abstract>
</metadata>
<content>
<para id="id8993349">A very simple type of guitar distortion can be
done with clipping of the signal. This is where a threshold value is set, and if the signal ever increases above this value, it is clipped off. This type of distortion adds a "fuzzy" sounding
distortion. As is obvious from the picture of the frequency-domain effects of clipping, clipping the signal creates a more complex signal by adding more frequencies.</para>
<figure id="element-550"><name>Distorted Sine Wave</name>
  <media type="image/png" src="clippedsine.png"/>
  <caption>A picture of a sine wave after it has been processed with the Matlab function below</caption></figure><figure id="element-316"><name>FFT of a distorted sine wave</name>
  <media type="image/png" src="fftafterdistortion.png"/></figure><para id="element-862">The Matlab code that implements this algorithm is also very simple:</para><code type="block">function [output]=fuzzy(sound, amount)

norms = norm(sound);
output = sound/norms;
amount = (1- amount)/100;

for i = 1:length(output)
    
  
  if ( output(i) &gt; amount )
    output(i) = amount;
  end

  if ( output(i) &lt; -amount)
     output(i) = -amount;
  end
 
end
 
output = output*norms;</code>












</content>
</document>
