Chord Dictionary

Foreword

As a former music student, When I was tasked with creating a program for my student project at DMACC, I decided to create a music tool with a user interface that could accurately identify three-note chords. While the overall scope of the project is relatively small, If you would like some additional music theory context for what this program is meant to achieve, click here to watch a youtube video by the channel David Bennet Piano. It served as a resource for some of the more obscure chords within the dictionary.

Problem

In the tradition of Western music, triadic chords (chords with 3 notes) are considered to be the backbone of classical music theory. Identifying chords can be challenging for new musicians, but the process could be expedited with a tool that can identify chords both quickly and accurately. This project aims to allow the user the ability to enter notes into a GUI and have the program output an accurate identification of the chords, regardless of key.

Solution

This project has 5 key parts: user input, translation, logic, output, and testing. To that end the project utilizes 2 classes: ChordGui and ChordDictionary. The ChordGui class handles user input. It uses dependencies like QButton and QVBoxLayout to create a window with 12 note buttons and a submit button. Upon submitting 3 notes the values are stored as a string (example “C E G”). The program is only designed to identify triadic chords, so any submissions with anything other than 3 notes will be handled with an error message, although duplicate note inputs (A, A, C, E) are truncated and technically still valid.
The ChordDictionary class performs 2 tasks; input translation and logic. The ChordGui stores user input as a string with letters (ex. “C E G”), However music theory has a few quirks that require translating the input. The notes “C E G” and “F A C” would both be considered Major chords, just in different keys. While you could write out every permutation of the letters (if I did my math right, about 220 combinations), the far smarter approach would be to convert the letter names into numerical scale degrees. The program considers the first note input to be the root of the chord, with each following note assigned a value based on its distance in semitones relative to the root (“C E G” and “F A C” would both be translated to “0 4 7”). The core of the ChordDictionary is a map that contains logic for 19 types of triadic chords. These 19 chords were chosen out of a combination of mathematical and musical necessity. There are about 220 potential combinations of 3 notes, and many of them are either redundant (“C E G” and “F A C” are both major chords), inversions (“C E G” and “E G C” have the same notes), or aren’t considered usable enough to have an official name. The ChordDictionary has entries for Major, Minor, Diminished, Augmented, Suspended, Lydian, Phrygian, Locrian, Major-flat5, and Quartal chords along with their respective non-redundant inversions.
Outside of the classes I also implemented unit testing and User Input validation.