Open-source DAW + Audio Engine Update (#5)

AMU
3 min readFeb 12, 2021

--

Hello! It’s been ~two weeks since the last post. But in reality it seems like it’s been much longer for me because I’ve been dealing with more segmentation faults than I could count! Sometimes it gets beyond exhausting (but it’s ok because I love the project.)

If it’s your first time here, hi! I’m making a DAW and in the process of making that, I’m making a sound engine (called Ava.)

Here are my previous posts: part 1, part 2, part 3, and part 4.

Update:

In the previous two weeks I implemented a simple delay effect and implemented the Ava to have multiple tracks play in parallel and for each track, have effects get processed sequentially.

It took way more time (and WAY MORE segmentation faults) than I anticipated at the beginning, however it led me to learn many new things. It also made me change the initial design I had in mind and make it more efficient.

The code structure for effects is something like this:
There is a SoundEffect class that contains general properties and methods such as SetDryWet or SetName. However it doesn't directly contain the algorithm which changes the sound; instead, with the help of Strategy design pattern, there's an object called SoundEffectType which holds that algorithm. On run-time, different childs of SoundEffectType fill that object. (for example delay, reverb, bitcrusher, etc.)

So if you want to apply a sound effect to some data, you have to do something like this:

1) Give the raw data to soundEffect.
2) Call soundEffect->soundEffectType->ApplyEffect().
3) Put the data returned from 2 into soundEffect's data.

In order for the user to write the least amount of code, there are a set of effect preset classes that contain ready-to-use sound effect objects. So they provide objects with 1) already composed behavior (strategy pattern) 2) already set names and default parameters.

To implement a delay effect for the engine, we have to create:

1) A Delay class as the child of SoundEffectType
2) A DelayPreset class to hold a ready-to-go SoundEffect object.

So, the user will use an instance of DelayPreset class on their program and append that effect to a track (which is a collection of a single sound generator and a sequence of effects.) They don't need to care about SoundEffect or SoundEffectType.

Right now the effect doesn’t work well, but it’s ok because the structure is all set, all I need to do is to make sure the algorithm for the effect calculates values properly.

On another note,

I started to write about the time consuming bugs I face and how I solve them. It’s like a reverse StackOverflow. Some of them may seem simple when they get solved, but when there are lot of issues at the same time and there are a lot of possible reasons for a bug, it’s easy to forget them and they do seem really complicated.

This was started because I thought at least some one may look at them and finds them useful and it saves them some time off debugging.

I put those problems and their solutions in here.

If you want to take a look at Ava’s code base, it’s on this repo!

Originally published at https://dev.to on February 12, 2021.

--

--

AMU
AMU

Written by AMU

I make sound tools and software, music, and sometimes games. I love writing about stuff.

No responses yet