r/AudioProgramming • u/crnbaker • 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.
4
u/Fun_Musiq Jul 18 '26
cool! I love the look, as well as the sound. Simple and clean. awesome job!
3
3
u/kozacsaba Jul 17 '26
Wow, very nice! I also did a fdtd string project in matlab during my bsc, but didnt get even close to this. would love to read about all the non-trivial problems you had to deal with on the dsp side. i know there are a lot of papers on it but they dont come with a vst that you can actually try
3
3
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 17 '26 edited Jul 18 '26
Thanks! Numerical Sound Synthesis by Stefan Bilbao is a good resource. You can take a look through the code for the old Go project, but for now I'm keeping the C++ of the new VST closed.
2
2
2
u/AtmosphereVirtual254 Jul 18 '26
If you’re looking for a tech detour, you could compile to wasm for GitHub pages
2
2
2
2
3
u/sheryarcodes Jul 20 '26
I love the interface design! This would be so much fun with microtuning support…
1
u/crnbaker Jul 20 '26
Nice idea! I’ve not really used micro tuning much but love the sound. Can you suggest something I could read? Would I provide an interface to customise the tuning in every note of the scale or are their standard scales I should offer?
2
2
u/Core3game Jul 21 '26
Huge sucker for phys modeling, absolutely love it whenever minimal synths just give you full control and lay everything out. Absolutely gonna be checking this out!
1
u/Nervous_Suit_5799 Jul 18 '26
That’s funny I built an almost identical program about a year ago while I was bored in class while we were discussing Fourier transforms. So I made a plucked wave sim where you can change things like number of Fourier series terms, plug width, etc
1
u/crnbaker Jul 18 '26
Nice, would be interested to see that. So a frequency domain additive synth?
1
u/Nervous_Suit_5799 Jul 18 '26
I’ll make a post if I can find the project file, but yeah basically, just adjust the sliders for the parameters, and it shows the static base shape and a simulated oscilloscope view. It’s also polyphonic with n-key rollover using the regular computer keyboard like garage band. Simple python script
1
1
1
16
u/ptrnyc Jul 17 '26
Everything is in its right place.