4 ms·
A plucked string simulator using Julia
- minetest2048 2y agoI always wanted to do this, I think Julia is a good language to develop audio plugins and virtual instruments. But its currently missing real time tooling and binding to audio plugin frameworks such as CLAP JUCE VST3 There is a way to compile Julia to webassembly: https://tshort.github.io/WebAssemblyCompiler.jl/stable/examples/lorenz/ https://tshort.github.io/WebAssemblyCompiler.jl/stable/examp... , it might be possible for you to run the julia script clientside. I don't know whether FFTW.jl can run though for the spectrogram plot Another related demo is https://youtu.be/bujv4mxG7mE?si=LMGri56Gzs7mWTN_ https://youtu.be/bujv4mxG7mE?si=LMGri56Gzs7mWTN_ , they solve differential equations of a saxophone
- ssfrr 2y agoOne of the issues with Julia for this kind of thing is that it’s tuned for throughput more than latency, especially the sort of worst-case latency you worry about for realtime systems. You have to be careful to make sure any methods that are called ahead of time so they’re not JIT-compiled in your audio loop. It’s also hard to write zero-allocation code, which is what you need if you don’t want the GC pausing your program at an inopportune time.
- deleted 2y ago[deleted]
- patagurbon 2y agoThese things are all much improved recently, but you are correct not there yet. ‘juliac’ is a new static compilation option which should release around 1.12, and there are others like Cognibotics experimenting with Julia for hard real time applications. Julia was also recently used by WhatsApp for audio codec R&D. Hopefully these use cases will drive better guarantees and tooling.
- ChrisRackauckas 2y agoThere's also the new GC(s) that are almost ready to merge that have different properties that can be tuned.
- xiaodai 2y agoWhat does Julia have to do with this?
- cthalupa 2y ago> The page communicates over a websocket with a Julia program running on a server. That program does the calculations, generates the plots and the sound, and sends them back for insertion in the page. No files are created. The part of the Julia program handling the communication amounts to just a few lines, calling functions from the HTTP.jl library. We don’t need any web frameworks or boilerplate. I’ll supply the source shortly; check back here or subscribe to my feed for updates.
- lagrange77 2y agoThat's awesome. Looking forward to the code!
- leephillips 2y agogit clone https://lee-phillips.org/pluckit/code https://lee-phillips.org/pluckit/code
- lagrange77 2y agoThank you!