<aside> 🎶 This is part of a ongoing series called Building A Music Engine
It documents the process of me smashing my head against the keyboard to build a game called LETSGO
It’s gotten long enough to break into several sections:
Ok we’ve gone down the esoteric road of what music is, thought about music in terms of data structures, and figured out how to get Unreal to compile.
By doing this we now have something that the majority of programmers out there are sorely lacking: A Clue.
So let’s write some damn code:
A note on the comment, which is probably a “bad” comment, except in this case the comment came first, where I listed all the scale names and step pattern as comments, then initialized the accompanying object.
Here we have the ionian
scale (A fancy word for the Major scale). You will notice we have established the step pattern for the scale.
The steps is an enum where Whole = 2 and Half = 1.
The other main enum we have here is the list of notes:
I’ve agonized on the naming of the keys, because everything we define here is a fundamental building block for the rest of our music theory engine. A bad name or structure at this point gives you a compounding problem over time.
There does already exist music notes enum
in Unreal in the AudioMixer
module, but it just flattens all the black keys. Ableton does the opposite, sharpening all the black keys.
Given two competing standards, the obvious choice is to create a third standard!