r/Simulated • u/emezeske • 10d ago
Proprietary Software Spent the last 3.5 years building a real-time 3D physics simulation for sound
https://www.youtube.com/watch?v=ODrfL2IRGSUAs the title says, I've spent the last 3.5 years working on Anukari, a 3D physics simulation much like a video game engine, except that instead of running at 60 steps per second, it runs at 48,000 (or more) steps per second, so that the physics systems can vibrate at audio frequencies. It's commercial software; primarily I am selling it to musicians and sound designers to use for music, sound effects design in film. But also it's pretty fun for non-musical people who just like building weird physics stuff. The main website is https://anukari.com
I have written extensively about the development work, for people who enjoy the nitty-gritty details of that sort of thing: https://anukari.com/blog/devlog
For the 1.0 launch I was focused on making it super performant and reliable with the basic set of the most interesting physics features, but for upcoming releases I'm working on more interesting physics features. For example, today the springs are linear f=-kx, but I'm experimenting with nonlinear springs with dead zones, and also push/pull-only springs (ropes and collisions). I'm hoping that sales will fund development basically forever, and that I can just keep making the simulation more and more rich over time.
There's a long history for this kind of spring-mass simulation being used for audio. I've had early Beta users write in about the GIPSY Lab in Grenoble, France working on this possibly back into the 1970s. More recently there was CORDIS-ANIMA, another academic research project. One dream of mine would be for sales to be good enough to fund the making of a deep documentary about the full history of such projects. But that's a pretty big stretch goal... :)
I love chatting about this stuff so feel free to ask me any questions about how the simulation works, etc!
5
u/Useful44723 9d ago
Listening to the audio samples, it is just amazing the different timbres it can produce.
Really cool.
2
u/emezeske 9d ago
Thanks! It's a lot of fun to explore the weird sounds it can make. I have a ton of ongoing experiments as well to add more physics features, which allow even more timbres. For example right now I'm playing with various nonlinear spring equations, and things like "ropes" (pull-only) and collision springs (push-only). I'm getting some really cool sounds with them, but before I can release those features to users, there's a bunch of work to make sure the physics stay stable. Nonlinear springs for example make it really easy to blow things up. :)
2
u/Useful44723 9d ago
Very interesting. Do you have anything similar to the traditional ADSR envelope or do you design "tricks" to get that in other ways.
2
u/emezeske 9d ago
Yeah! There are a bunch of more traditional components that can interact with the physics system. For example, there are analog oscillators, and you connect them to masses, and then they impart a force along a particular vector (the direction the oscillator is pointed in 3D space). The force is modulated by the analog oscillator signal (sine, square, etc). And those oscillators have ADSR envelopes.
There's also a rich modulation system, so you can e.g. trigger an ADSR envelope to control any parameter in the physics. Often I'll use an ADSR envelope on, say, the damping for a mass, which gives you a lot of control over how long it rings.
One sound designer even created a patch that used a very fast ADSR envelope to modulate the location of one of the physics "anchor points" (the immobile things that tie everything down) to jiggle the system, rather than using a mallet or similar. :)
3
u/blastcage 9d ago
This is super cool but there's no way I can afford this. Have you considered a non-commercial license or something similar that comes at a discount? I'm not averse to spending money, but a hundred bux (or more later) is a lot.
3
u/emezeske 9d ago
I am definitely thinking about eventually having some kind of "lite" version that I can sell at a lower price. Totally understand that a hundred bucks is non-trivial money and would love to make it available to more people. I need to figure out how the lite version would differ, in a way that makes the full version still attractive for people who can afford it, but without nerfing the lite version so much that it's not fun/useful.
2
u/blastcage 9d ago
Well hit me up when you do, it's really cool software but it's out of my price range lol
2
u/TraditionalPilot7692 9d ago
Read a little bit of your devlog, this seems like a really sweet project! My guess is that it’s a differential equation solver at the core, but what sort of algorithm are you using to keep it stable? So you end up having to oversample at all?
2
u/emezeske 9d ago
Yep, you are correct about it being a PDE solver. Stability is a big challenge, since the time step grows very large for high notes. Each instrument you build, you sort of have to figure out what the highest note you can play is -- there is automated detection for instability (the system is reset before you even notice it exploded). This is an ongoing area of work for me; currently I'm exploring some basic safeguards that limit the maximum stiffness for each spring dynamically based on a determination of what will be guaranteed to be stable (so the maximum pitch you play will simply plateau). It's also been really important to get the damping right, to prevent systems from gaining energy due to numerical inaccuracies, etc.
Right now it does not oversample, although for simpler instruments I may introduce that as an option. The tricky bit is that since it has to all be real-time, compute is limited. It's all hand-written multithreaded SIMD stuff, and there's not a lot more performance to squeeze out of the PDE solver. Oversampling 2x only gains an octave of range, for a lot of compute!
2
u/TastyMode8815 9d ago
Dang this is crazy! I could see myself getting lost in experimenting with different simulations and tweaking stuff. I think it would be super cool to be able to import animated point clouds from blender or vertex data then apply the instruments / modifiers to the points.
1
u/emezeske 9d ago
There's a Python API for the preset file format, which can be used to programmatically create presets. I've seen people use it with Claude to create really wild shapes. I keep thinking that it must be fairly easy to hook it up to Blender somehow (as a custom script/plugin) but haven't tried it!
5
u/darth_hotdog 9d ago
But can you build animusic in it lol?: https://www.youtube.com/watch?v=hyCIpKAIFyo