Generating Random, Yet, Constrained Music


In this project, the concept of generating music, fugues in particular, is explored through writing a set of rules translated into C++ code that generates a random musical theme. This theme is then imitated throughout the piece where certain operations are applied like inversion, transposition, scaling, and retrogression … etc. The imitated melodies are placed at random starting points distributed throughout the piece. Some parameters and constraints were added to prevent disorganized compositions and unpleasant sounds. Some of these parameters are: using the major scale, frequency range and maximum note duration.