Abandoning the “Stockfish for Music Theory” idea in favor of a much more straightfoward approach.
Implemented a MusicalStrategy interface, along with the first implementation to set a simple pedal point:
Still need to smooth out the rough edges, but it revealed opportunities to DRY up existing code.
My sampled synth “CheeseKeys” has a data mapping object that connects each sound wave to a musical note.
This is fine, but I think I’d prefer to have a common “InstrumentData” type that has mappings of sound waves and musical notes.
That way CheeseKeys would be an instance of this data mapping, and the musical composition logic wouldn’t have to care about which instrument has been selected, but has a reference to the instrument selected.
That would also prompt me to add another instrument type. Maybe a simple bass guitar type thing?