Found in 1 comment on Hacker News
rcpt · 2015-04-25 · Original thread
Algorithmic composition is a decently-sized field. Here's a textbook:

http://www.amazon.com/Algorithmic-Composition-Paradigms-Auto...

And some more examples:

http://algorithmiccomposition.org/

Fresh book recommendations delivered straight to your inbox every Thursday.