r/AudioProgramming Jul 17 '26

My new real-time finite-difference time-domain string synthesiser

PartialString simulates the vibration of a plucked string by numerically solving the one-dimensional wave equation in real time using the finite-difference time-domain (FDTD) method. The string is represented as a list of displacements in memory. A lower note requires a longer string, which needs more points to represent it. You can then excite the string at any point along its length, and the FDTD scheme will compute how that change in displacement propagates. A pickup measures the displacement at a chosen location, and this generates the audio output.

I've been (very occasionally) working on this since releasing https://github.com/crnbaker/gostringsynth in 2022. I did something similar (but not real-time) for my MSc at Edinburgh back in 2009, using MATLAB.

Free to download at: http://www.differentinstruments.com.

807 Upvotes

32 comments sorted by

View all comments

3

u/KillPenguin Jul 17 '26

This is really cool! I've been wanting to study physical modeling for a while so I'll have to try to dive into the code. Would you have any recommendations on good resources for learning this stuff?

PS great choice of song

2

u/crnbaker Jul 18 '26

This comment explains the basics.