Mixed Messages - Chord Progression and Verse Generator

Hey Codecademy,

Going to paste my poorly formatted readme below the dashed line here, but the high level for this project - the base criteria were very easy and I was prepped by the course to crush it; that aspect took under an hour.

I decided to challenge myself a bit with an additional task, in that I wanted to generate random lyrics. This aspect ended up taking almost a week of dedicated time (I would estimate 4-12 hours a day), as there were multiple elements (modules, async programming, etc) I had to research to understand in tandem with creating my code, as well as reaching out for assistance from a more experienced programmer to understand some of these more complex ideas. I also utilized multiple .js files as an academic exercise; going forward I believe it would be easier to utilize more .js files that deal with specific tasks, and organize my overall program that way for better cognitive tracking.

Currently, my program is in a working state - it outputs a string that specifies a random musical key and variation of the four chord progression (I-V-vi-IV), as well as four lines of lyrics that are randomized - generalized details of that are below.

I would like to come back to this in the future to tighten up the syllable tracking mechanisms, and to narrow the list of potential word options in my verses - the wordpos module that randomly generates some of my word choices draws from Princeton’s WordNet database, which is too broad for my purposes and generates strings that are not organically suited for singing.

Thanks very much, and best of luck going forward!


I initially had a program that would give a random musical key pulling from two data sources, an array of strings representing all the musical notes, and another array of two strings indicating major or minor. The third element was a random variation of the I-V-vi-IV “four chord” progression, utilizing a for loop with modulo operator to begin at any given point and progress, wrapping around the array if necessary, to return the potential progression options.

This satisfied the criteria of my Codecademy portfolio project, however I wanted the ability to generate lyrics, and I also wanted to generate “any” lyrics.

The program does so by utilizing a variety of modules. A series of four randomly generated “template” verse lines are created via the Poem-gen module, and each word in that poem is then pushed through a function which utilizes the wordPOS module to check it’s type against known adjectives, nouns, adverbs, and verbs; it will randomly generate a like word of a similar type and syllable count from any available in Princeton’s WordNet Database, and return this word, with “rest” words returned as-is, and in both instances as a string within an array due to wordPOS’ functionality in order to maintain consistency. The newly generated array of lines are pushed into a new array, which is now three dimensional; I maintained this both to experiment academically with retreiving and replacing objects in a three dimensional array, and to be frank because initially I could not think of an easier option, though I am certain one exists. At this point, a while loop coupled with the rhymes module determines if a given word has no available rhyming options; if it does not, a new word is selected at random utilizing the syllableCountCheck function; if the word falls into the “rest” category, it returns itself and a completely new word selected ignoring the type (verb/adverb/etc) is assigned, the while loop verifies again, etc. Once this occurs, the final word of the fourth verse is used as an argument for the rhymingWordMateSelect function which generates one of the available rhyming matches at random, and it is assigned to that index position.