class for generating melodies