DEV Community


Posted on

Audio Engine Dev Update (#8) - Music Theory Module: Notes, Scales, Chords


Recently I've been working on a "music theory" module. It lets you:

  • Work with notes instead of frequencies
  • Choose scales
  • Define chords
  • Define chord progression

I used the logic of a code of a project that I made in Unity (C#) and converted it into C++.

To make this work, the demo program had to be changed too. Along the way I changed the structure of the demo too and added some command classes to easily decode and extract parameters that can be used as inputs for the engine. The code is kinda dirty but it works for now.

So the demo program has a bunch of commands now: set frequency or set note, add new track, play scale notes, play a single note, activate track, deactivate track, and some more.

I was sure that the logic of the music theory module works correctly but I was 99.99% certain that converting the code from C# to C++ wouldn't be bug-free. I mean, it's C++ we're talking about. When I made sure the scale data structure is set correctly and the engine plays the scale notes like an arpeggiator without errors, I moved on. So I haven't test the chords yet. Logically, they must be ok but there might be some segmentation faults because of the pointers. I'll fix those until the next dev update.

The reason I didn't completely test the chords was that I had to work on my bachelor thesis project. It's the first non-demo program that uses Ava (other than the DAW). It's a digital hardware synthesizer!! I think it's too complicated to talk about in this post, but I'll write more about it in the future.

As I work more on the engine, I add more and more new features to the backlog. The current version is not close to the version 1.0.0 that I have in mind yet. I think until the end of summer, it will progress a lot more.

The reason I'm focusing on the engine a lot and not the DAW itself is that the DAW code base, at its core, will be just an interface that utilizes the engine, so it's important for the engine to be solid so that the interface gets implemented easily and smoothly.

Here's the link to repo if you want to check it out!

Discussion (0)