This is part of my journey on pybind11. I wrote a tiny FM Synthesis library in C++ and a Python wrapper for that using pybind11.
There is a command-line piano app in the examples directory if you want to play with it. Here is the link: https://github.com/charstorm/koelsynth/tree/main/examples/si...
My next target is to attach this to some kind of physics simulation - like a bunch of balls moving around in a box with some internal walls. When the ball hits certain trigger points, it produces the sound.
Have you tried to port it to WASM?
Python can also call the wasm with wasmer
I ported https://github.com/chaosprint/glicol for my Python audio project using the same method
for your physics idea, with wasm, perhaps it can be something like this?
https://jackschaedler.github.io/karplus-stress-tester/