2
$\begingroup$

I am having a difficult time understanding the basic principles when sampling the function describing the vibration of a string. Mainly I am confused on given a sampling rate how many samples to take and what size the increments when sampling should be.

I am using the solution to the wave equation from this article (in german). If my explanation is unclear let me know and I'll try to give more information.

$\endgroup$
3
  • 1
    $\begingroup$ What are you sampling? String displacement at string location? The sound produced? The Nyquist limit rules them all. (unless you can sample at two different rates and resolve aliases that way, but that is a different story). You may find this pertinent as it looks like your article focuses on pure harmonics. dsprelated.com/thread/7902/… $\endgroup$ Jul 30, 2020 at 15:03
  • $\begingroup$ I am sampling the string displacement for a fixed location at a certain time. Right now I figured to simply do increments of the size: base frequency divided by the sampling rate because i thought this is the lowest frequency that I need to be able to hear. $\endgroup$
    – Leonard
    Jul 30, 2020 at 15:43
  • $\begingroup$ I don't quite get what you are saying. You are sampling displacement at a point in time. A certain time implies one reading. Assuming you are looking for harmonic motion, you need to have at least two samples per cycle of the highest harmonic of interest. Lower than that, your harmonics will appear as aliases (different places cuz they are around they Nyquist corner) in your spectrum. $\endgroup$ Jul 30, 2020 at 17:39

2 Answers 2

2
$\begingroup$

There's two kinds of sampling here, time sampling and spatial sampling, since the string equation is a PDE. I cannot read German, so I cannot understand your article. I will be presenting the discussion from the book, Physical Audio Signal Processing.

The ideal string PDE is $Ky'' = \epsilon\ddot{y}$, where $K$ is the string tension, $\epsilon$ is the mass density and $y$ is the string displacement.

Now if you use the FDTD method to solve this differential equation, the first and second order partial derivatives are $$y'(t,x) = \frac{y(t,x+X) - y(t,x)}{X} \\ y''(t,x) = \frac {y(t,x+X) - 2y(t,x) + y(t, x-X)}{X^2} \\ \dot{y}(t,x) = \frac{y(t+T,x) - y(t,x)}{T} \\ \ddot{y}(t,x) = \frac{y(t+T,x) - 2y(t,x) + y(t-T,x)}{T^2} $$

Here, $T$ is the time-domain sampling rate, and it can be chosen according to Keegs' answer, i.e., twice the frequency of the highest frequency string harmonic. To model all audible string modes, choose $T = \frac{1}{44,100}$s. $X = cT$ is the spatial sampling rate. Here $c = \sqrt{K/\epsilon}$ is the speed of sound.

Now, using $t = nT$ and $x = mX$, and using $c^2 y'' = \ddot{y}$, we have $$c^2 \frac{y(nT, mX+X) - 2y(nT, mX) + y(nT, mX-X)}{X^2} = \frac{y(nT+T,mX) - 2y(nT,mX)+y(nT-T,mX)}{T^2} \\ c^2\frac{y(n,m+1) - 2y(n,m) + y(n,m-1)}{c^2 T^2} = \frac{y(n+1,m) - 2y(n,m) + y(n-1,m)}{T^2} \\ y(n, m+1) = y(n+1,m) + y(n-1,m) - y(n,m-1) $$ We can solve this iteratively using some initial and boundary conditions, such as $y(t,0) = 0, y(0,x) = $ triangle function etc.

$\endgroup$
0
$\begingroup$

Assuming I understand the question correctly, you need to sample the string's position at least twice as fast as the maximum frequency you anticipate the string can move or the highest frequency you care about. So if the highest overtones the string produces are 16kHz, you need to measure at at least 32kHz if you want to be able to reconstruct the original motion faithfully. This is the Nyquist-Shannon sampling theorem and you can probably find several hundred descriptions of it here and elsewhere on the internet.

If you know the lowest frequency the string can produce or that you care about, there are other tricks you can do (look up heterodyne) to reduce your sample rate requirements assuming you have the equipment to do so on the analog side.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.