The challenge.
Make a program that produces a random series of 8 notes in the scale of E minor, and then harmonizes them.
Details.
- Notes must be represented in output as a 1-2 char string, which designates the note and if it is sharped or not, followed by a number, which designates the octave. Examples would be
C3,D#7, orA#1. No notes can be flatted, only sharped. - No notes can have an octave lower than
1. - The scale starts at
E4and ends atD5. No notes that are randomly generated can be outside of these bounds, but the chords can be below it. - Each note that the program randomly makes must have a chord of three notes an octave below it.
- The three notes of a chord are as followed:
- Root note: The note originally randomly generated, but an octave lower.
- Middle note: Depending on what note fits within the scale, this is
3to4semitones above the root note and is what makes a chord major or minor. - Top note: The fifth of the root note, or raised
7semitones. If the fifth of the root note isn't in the scale, then the top note is6semitones above the root.
- Output is simply just a print to the console of a string.
Output.
What a note and its harmony look like:
({E4}, {E3}, {G3}, {B3})
Output format:
[ (*note and harmony*), x8 ]
All space padding is optional.
Conclusion.
Any languages are allowed, and the shortest response, in bytes, after a week is the winner.
E F# G A B C Dand you mention that the scale ends on D. But then you also mentionD#andA#. As far as I'm awareA#is not a note in any version of E minor.D#instead of D occurs in some variants of the E minor scale, but in harmonies it would typically only be used to substitute a B minor chordB D F#with a B major chordB D# F#and never as the root note of a chord so I'm wondering why it's included. I suggest you just list the 7 possible outputs, one for each note of the scale \$\endgroup\$[E4 E3 G3 B3][F#4 F#3 A3 C4][G4 G3 B3 D4][A4 A3 C4 E4][B4 B3 D4 F#4][C5 C4 E4 G4][D5 D4 F#4 A4 ]is that correct? if so edit it into the question. \$\endgroup\$