3
$\begingroup$

I have a physical simulation of a vibrating string (made with matter.js). From this, how can I derive the sound wave / air pressure over time, that would result from such a string?

vibrating string simulation

I had considered simply summing up each segment's vertical (y) position at discrete time steps, but this approach does not work for any shape other than the most basic mode of vibration shown above. For example if the string develops another node in the center as shown below, the y-positions would cancel each other out most of the time.

string octave

So, what would be a good way to derive the shape of the resulting sound wave from an arbitrary string shape?

Edit: As Philip pointed out in a comment to Gert's answer, this question could probably have been worded better, so here is another try, by giving an example:

Let's say you pluck a guitar string, take a sound recoding and a video recording with a super slow motion camera, for 1 second.

What we see in the video (all the ways the string vibrates) and the audio matches up.

Now say we lost the audio recoding. Is it possible for me to re-create the audio only with the help of the video?

We can say for convenience that the super slow motion camera recorded 44k frames, which is a typical audio sampling rate. So for each video frame, I want to produce an 'air pressure' value that I can send to my speakers.

(I hope this makes it a bit clearer what I'm asking for. If anybody has any other suggestions for improving this question, they are very welcome!)

$\endgroup$
3
  • 2
    $\begingroup$ Naive question: couldn't one -- in principle -- do what @Gert suggested in the answer below and translate that into sound? This completely circumvents the entire "sound wave" thing, and can't be too bad an approximation. Unless I've very mistaken, the physical frequency of a vibrating string is very close to the frequency of the sound produced... $\endgroup$ – Philip Aug 22 '20 at 19:09
  • 1
    $\begingroup$ "the physical frequency of a vibrating string is very close to the frequency of the sound produced" -> true, but the thing is that a physical string does all sorts of things other than just oscillate in her fundamental frequency. There are overtones (harmonics) and other frequencies thrown in as well. $\endgroup$ – Hoff Aug 22 '20 at 19:14
  • $\begingroup$ True. But that's what Gert's answer below is calculating. Once you find all the overtones $\omega_n$ and their relative amplitudes $A_n$, you could simulate the waveform on a computer. I can't say offhand how close it'd be to the real thing, though. $\endgroup$ – Philip Aug 22 '20 at 19:16
0
$\begingroup$

From a webinar I published a few years back:

A $1D$ string wave is described by the $1D$ wave equation:

$$y_{tt}=c^2 y_{xx}$$

Using separation of variables and applying the boundary conditions (see derivation above) we get:

$$y(x,t)=\displaystyle\sum_{n=1}^{\infty}A_n\cos\Big(\frac{n\pi ct}{L}\Big)\sin\Big(\frac{n\pi x}{L}\Big)\tag{1}$$

For $n=1,2,3,...$

with:

$$\frac{T}{\rho}=c^2$$

$T$ is the string tension, $\rho$ the linear string density.

$t$ is time and $L$ the length ($x$) of the string. $y(x,t)$ is the vertical displacement.

The coefficients $A_n$, aka the amplitudes, are calculated from the initial condition and a Fourier expansion:

$$y(x,0)=f(x)$$

$$y(x,0)=f(x)=\displaystyle\sum_{n=1}^{\infty}A_n\sin\Big(\frac{n\pi x}{L}\Big)$$

$$\boxed{A_n=\frac{2}{L}\int_0^{L}f(x)\sin\Big(\frac{n\pi x}{L}\Big)dx}\tag{2}$$

Inserting the $(2)$ into $(1)$ gives the shape of the $1D$ wave.

$\endgroup$
7
  • $\begingroup$ Great answer as always, @Gert, but I don't think this is what the OP was asking about. I suspect that the question is dealing with the pressure wave or sound wave that can be produced by such a vibrating string. We know that vibrations can produce sound, and it has something to do with the displaced air, and I believe the OP wants to know how one can move from vertical displacements of strings to the compression and rarefaction of air that leads to sound. I think the question should be reworded... $\endgroup$ – Philip Aug 22 '20 at 18:05
  • 1
    $\begingroup$ You're probably right, Philip. $\endgroup$ – Gert Aug 22 '20 at 18:26
  • $\begingroup$ thanks Gert for the answer and @Philip for the comment. I've added an example to hopefully make it clearer what I'm asking. Please let me know if you have a better way of wording this (I'm not a physicist just a coder:) $\endgroup$ – Hoff Aug 22 '20 at 18:58
  • 1
    $\begingroup$ I really don't know the answer to that question. It boils down to how displacement $y(x,t)$ relates to sound produced. Good question but I don't know how that works. $\endgroup$ – Gert Aug 22 '20 at 19:02
  • $\begingroup$ Seems to me that because $y(x,t)$ is small, the air can be considered incompressible: ($\frac{\partial V}{\partial p}=0$). That might be a starting point. $\endgroup$ – Gert Aug 22 '20 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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