Choosing the tech stack for my open-source DAW (#2)
amu
Posted on August 18, 2020
I've been working on an open-source DAW. On the previous post, I talked about the general stuff I had to do in the first two months.
Recently, I've been reading about different things to choose the tech stack of this software. So basically there are a couple of things to talk about:
Back-end and processing side
I have two options:
- To use a library such as
PortAudio
to be able to communicate with audio interface. I directly implement some kind of abstraction that works with bothPortAudio
and the UI - It might be also a good choice to use JUCE because it handles the builds and low-level stuff. (thank you Ryan for suggesting!)
I'm exhausted by the sheer amounts of errors and bugs I've been getting in the past few months so I happily choose JUCE :)
On top of these two, the other day, I was talking to a friend (thank you Arman!) and he informed me about gRPC and it seemed like an amazing solution! In this case, I still will be using JUCE but the software's architecture will be client-server. This means that I can use any JavaScript based solution on the client side. (I have written an example about gRPC further in this post.)
Front-end
A huge issue was choosing a framework for UI. There are also two solutions for the UI:
- At first I wanted to use Qt, then I thought about using OpenGL and tools like ImGui. I read about OpenGL and I've seen a couple of tutorials about it.
- I can also use frameworks such as electron! But I have to research more about other option and their performances.
What's gRPC?
gRPC is a framework made by Google that allows you to use the client-server architecture and interact with the clients regardless of their languages by having them execute procedures and functions of the server directly in the client. (keyword: protocol buffers)
In my case, the main computation and the brain for the software, which is the audio processing, is written in C++ and will get used by the ui framework using the gRPC.
Let's say there is a function called play()
which works with the OS sound driver and some buffers, and it plays you a sound on your audio output device. It's implemented inside the C++ code aka the server but it's called from the js application.
Since both client and the server is users computer, there will be close to zero delay between the client and the server!
Here's a demonstration of how the code will basically work: (not with the exact syntax tho)
SERVER:
void playSound(); // you have a function
int main() {
server = createServer(8080);
server.bind("playSound", &playSound); // you put it in the server
server.run();
}
CLIENT:
const client = new Client("http://localhost:8080");
const result = await client.request({method: "playSound", params: []); // the client can call the function and get the result
In other words, the js application is only an interface that allows the user to call the functions implemented in the C++ code.
My choice:
I'll use gRPC + a js framework + JUCE.
ANYWAYS,
So I went and read about gRPC and wanted to set it up and make it work, but then like 90% of other projects, Windows caused problems. Developing applications on Windows is not easy. A setup that might literally take 5 minutes to do on Linux or Mac, might take a couple of hours of figuring out and debugging on Windows. Also, some programs, like Docker, require a special build of Windows to get installed, so that's another problem. It gets beyond exhausting when you have to deal with this in every project.
So I decided switch to Linux and do the development there. I worked with virtual machines but I didn't have enough space on my laptop to properly setup the project :)
I'm getting a proper laptop with enough space and only install Linux on it, I'll use it in other projects too.
Next goal
Enough reading, let's just start coding. Until the next update, my goal is to:
- Set up the project and its repo.
- Create the hello world application:
- hello world UI.
- hello world gRPC server.
- hello world interaction with JUCE.
- be able to build the project.
- (bonus) be able to build project on both linux and windows.
Thank you for reading this update and I'll see you in the next post!
PS: I'm active on Twitter and Instagram, we can talk and connect there if you're interested. Also, you can check out my music on Spotify or my Bandcamp.
Posted on August 18, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.