  Creating aesthetically pleasing pieces of art, including music, has been a
long-term goal for artificial intelligence research. Despite recent successes
of long-short term memory (LSTM) recurrent neural networks (RNNs) in sequential
learning, LSTM neural networks have not, by themselves, been able to generate
natural-sounding music conforming to music theory. To transcend this
inadequacy, we put forward a novel method for music composition that combines
the LSTM with Grammars motivated by music theory. The main tenets of music
theory are encoded as grammar argumented (GA) filters on the training data,
such that the machine can be trained to generate music inheriting the
naturalness of human-composed pieces from the original dataset while adhering
to the rules of music theory. Unlike previous approaches, pitches and durations
are encoded as one semantic entity, which we refer to as note-level encoding.
This allows easy implementation of music theory grammars, as well as closer
emulation of the thinking pattern of a musician. Although the GA rules are
applied to the training data and never directly to the LSTM music generation,
our machine still composes music that possess high incidences of diatonic scale
notes, small pitch intervals and chords, in deference to music theory.
