Problem 54695. Spell musical triads

Chords form the basis of harmony in music. The most basic chords are triads, or groups of three notes. They are specified by three parameters: (1) the root note, (2) quality, which indicates the relationship between the notes, and (3) position, which indicates the order of the notes.
This problem involves four qualities: major, minor, diminished, and augmented. Here are the ways to denote the quality and the spacings between notes in root position (i.e., with the root note on the bottom):
Triads can be in root position or first or second inversion. For example, a G major triad is ‘G B D’ in root position, ‘B D G’ in first inversion, and ‘D G B’ in second inversion.
Write a function to spell (or list the notes of) musical triads. If the position is specified as zero or omitted, then the root note is first.
Take care with enharmonic (or equivalent) notes and follow the conventions at the four links above. For example, Fmin could be spelled as ‘F Ab C’ or ‘F G# C’ because A flat and G sharp are equivalent, but the former is correct by convention. Please use the notes in parentheses in the Wikipedia pages. For example, spell Abdim as ‘Ab B D’ rather than ‘Ab Cb Ebb’ and C#aug as ‘C# F A’ rather than ‘C# E# Gx’ (where ‘bb’ and ‘x’ denote double flat and double sharp, respectively.)

Solution Stats

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Jun 06, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers2

Suggested Problems

More from this Author279

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!