# How To Simulate Guitar Sounds?
# Derivation of 1D wave equation
Hi, my friend! Have you ever seen how a guitar string viberate? I mean have you ever look closely after you plunking a string? I want to simulate the motion of a guitar string on my computer. I will show you how to do this from scratch using Python. The first thing first we need to do is to analysis a small piece on the string. Let look at this figure.
# Wave function
The motion of an ideal string can be discribed by a 1D wave equation(In this case the fraction between the string and the air is not considered),
Where, is the displacement of the the string at position , at the time, ; is the tensile force; is the linear density (mass per length). 
# String tension
String tension is a function of three aspects: string gauge, scale length, and pitch. String gauge refers to the thickness of the strings. Scale length is a measurement of the distance of a vibrating string on a given instrument—usually this means it’s measured from the nut to where the string contacts the bridge or tailpiece. Pitch refers to the note/sound the string is tuned to (or intended to be tuned to). 
For a guitar string, the string tension in newton is given by
where is its mass in kilogram, is the length in meter, and the lowest vibration frequency of the string in hertz which determines the pitch. 
# Solve PDE
I am going to simulate the third string, which has the frequency of 196 Hz. The tension 5.39 Kg given by the the manufacturer is converter to 52.85785 newtons by multiplying the gravititional acceleration .
The unit weight (UW) of the third string J4503/EXP given is 0.00004679 pounds per linear inch (lb/in). Hence, the linear density can be obtained.
To slove the partial differential equation, we need to give the initial conditions.
The initio state of the string can be described as these equations.
I use Euler's method to solve the equation numerically. First choose stepsizes and , and set and .
What is the stable condition of this equation?
What is the constraint ?
 Composing molecular music with carbon, MRS Communications, 2015, doi: 10.1557/mrc.2015.9
 Youtube, Martin Shuppius - Physical modelling of guitar strings (ADC'17) (opens new window)
 Daddario, All about string tension (opens new window)
 Daddario, Ej45-Pro-Arte-Nylon-Normal-Tension (opens new window)
 Measuring String Tension, July 2006, Rod Cross, Physics Department, University of Sydney, Sydney, Australia (opens new window)
 A complete technical reference for fretted instrument string tensions (opens new window)
 Youtube: I Generated Guitar Audio in python using NUMBA, Mr.P Solver (opens new window)