Setting up the melody generating functions.