u/Emotional-Kale7272

▲ 5 r/unity

Unity burst compiler for audio DSP?

Hey,
I knew Unity burst compiler would be awesome for DSP and audio, but I am really surprised how well it works and also how much CPU work it saves.

I am making a DAW in Unity and I was looking into options how to improve CPU performance when playing multiple sustained voices while stress testing the system.

The DSP CPU reached 170% during testing in editor and although the builds were better, I just could not leave it like this. After research and checking how other DAWs do it, I found the Burst compiler and I instantly knew this is the DAW grade architecture I need.

After porting/mirroring the original DSP audio engine to bursts I noticed much better CPU performance that is not going over 100%, even when stress testing in editor! It also has lower peaks and shorter frame time. This is extra important, because for real time audio processing this means less audio artifacts, dropouts and glitches.

Honestly I am surprised how well Unity works for this scenario.

Not claiming I have done anything special, native machine code or equivalents are standard for all serious audio app, but I think not many have tried to do this in Unity.

What other case you have where bursts were the logical choice and you were surprise about actual CPU savings?

Not totally comparable - editor/build but you can see the difference in peaks and CPU usage

o

reddit.com
u/Emotional-Kale7272 — 3 days ago

Hey,

I’ve been building a real time music engine inside Unity as a long term audio/DSP project, and I’d love some technical feedback from people who care about signal flow and architecture.

DAWG - Jamming in DIY DAW made in Unity

DAWG - DIgital Audio Workstation Game is a music tool where you can make beats, layer instruments, play with FX and learn about music production along the way.

Today I had a good jamming session that I wanted to shared with r/synthdiy.

Some technical details:

  • Custom real time DSP running inside Unity
  • PolyBLEP, FM, WT, noise oscillators
  • TPT SVF filters
  • Custom gain staging
  • Per voice envelopes, modulation, filter movement, pitch behavior
  • FX control through touch UI and MPU style controls
  • MIDI support, including hardware MIDI, Bluetooth MIDI, and MIDI clock send
  • Multi platform support with the same engine targeting desktop, mobile, and Steam Deck
  • Beginner friendly tutorial and UI layers so users do not need to understand synthesis to start making loops

Idea was to have an adaptable DAW meant for beginners, street musicans & expirienced users wanting a chill session while trying something new. Instead of scrolling, offer people something new, fun and creative to do instead...

Unity is great as a cross platform engine, UI system, and game host, but it is not a DAW engine.

Currently I am working on burst compilers for the C# DSP code. For Unity this means assembly like native code and performance, that should help reduce the DSP load when playing multiple voices on the sustained notes.

Still a long way to go, but todays session filled me with some hope that project is going in the right direction.

Support the project by WL it on Steam

I’m particularly interested in feedback on:

  • Architecting DSP systems inside non audio native engines
  • Clean ways to expose complex DSP without overwhelming the UI
  • Any red flags you spot (musical theory, logic mistakes, UI, DSP,...)

Would love to discuss design and I can also share some of the techniques used.

Thanks for checking the DAWG 🙌

u/Emotional-Kale7272 — 12 days ago