• Hi and welcome to the Studio One & Studio Pro User Forum!

    Please note that this is an independent, user-driven forum and is not endorsed by, affiliated with, or maintained by Fender. Learn more in the Welcome thread!

Building A DAW in C#?

Gray Wolf

Active member
Overview:
I've began the adventure of building a Windows DAW using C# / .NET. I know, it sounds crazy right? :LOL:

I thought it might be interesting to share the path here for any other tech nerds lurking who may be interested.

Why C#?
Because C++ is a very difficult language to learn and use, especially for something as complex as a pro daw, and I don't code in C++.

I took some C++ classes a few years back but it became clear to me pretty early on that my current stage of life is well beyond the point of having the patience or motivation to learn something that complex at the level required to do what I wanted to do with it. C# brings the level of coding difficulty down considerably, but of course, it's a managed language that has considerable overhead compared to C++.

I have a very long history with .NET from the VB side of the street, so I do actually understand C# code. This means that I can help with and independently maintain the code base even if it's mostly vibe coded, which it will be. With C++ I would be a total and complete spectator and be tied to an AI agent in perpetuity.

What about the Audio Engine?
That was my main concern when I first started thinking about doing this.

There are audio engine tools out there that work in .NET such as NAudio, which provides the tools to get that done, including VST3 support. It actually works. My alpha daw can play midi, load and play VST instruments, etc, but it's performance is not good enough for a professional multitrack audio workstation. I stress tested it with 5 instances of BBCSO and it failed miserably. Maybe partly because the VST3 support is new and is noted as being a preview, but it's not acceptable for that task by any measure. I think it's threading is not very well done, as it tends to choke with multitrack loads.

What does that mean?
This is where things got interesting.

In order to be viable, the audio engine has to exist in C++. I looked everywhere and there are literally no .NET tools that can handle that job on the level required for a pro workstation. The best path was clearly the free Tracktion engine and Juce.

That does not mean I would then need to write the DAW in C++, on the contrary, I only need the audio engine in C++, while keeping the DAW project in .NET with C# and Avalonia, which is an open-source cross-platform UI framework for .NET. Since I'd already made significant progress with C# and Avalonia, I was not prepared to throw it all away and start over in another language, and become a useless spectator to a vibe coded C++ project.

Connecting The Two Layers
Given the reality of the above, I was faced with two very specific needs:
  1. The daw behaviors, design, UI and graphics and all that need to remain in C# for the reasons and progress previously outlined.
  2. The audio engine needs to be in C++ since there are no .NET libraries up to that job on a professional level.
So how do we get that done, how do we connect those two things? By creating a DLL bridge to the Tracktion engine, whose methods and properties can be called from the .NET project with relatively simple commands.

As stated earier, I don't code in C++ so I obviously cannot create that DLL. What I did was hand that job off to an OpenAI autonomous work agent who is, as I write this post, building the C# -> C++ DLL bridge and sending me Visual Studio projects as milestones to test along the way.

That's where I am now, about to test milestone 4, ASIO driver discovery and configuration.

Once the basic DLL is done, I can go back to the original C# Visual Studio project and continue working on the DAW while the Tracktion engine handles the audio layer via that bridge. Along the way as things come up, automation, whatever else, I can go back to the agent to update the bridge to expose more things that I may need from the Tracktion engine.

Summary
It's a very intersting adventure. I'm only on day 3 and even though I can't show it yet, the UI looks pretty nice and actually works with the "not really up to the job" .NET audio engine thart it's currently attached to. I'm looking forward to handing the audio work off to the Tracktion engine when the agent finishes the basic bridge.

At any rate, this path looks to be viable for anyone who might want to do similar without going down a C++ rabbit hole.

I'll update this along the way and eventually post some images once the IP is protected.
 
Last edited:
  • Like
Reactions: AAV
Good luck with your project. It sounds (pun?) like a fun one
 
  • Like
Reactions: AAV
Back
Top