I took an interdisciplinary course in University and one of the CS professors did a whole lecture series on research in music and analysis. A lot of beat analysis, understanding rhythms and predicting popularity of songs based on the distribution of the timing between their beats. It was very cool and extremely creative.
"Songsmith generates musical accompaniment to match a singer’s voice. Just choose a musical style, sing into your PC’s microphone, and Songsmith will create backing music for you."
Here's his homepage if you want to learn more http://cgm.cs.mcgill.ca/~godfried/
Edit: Looks like he recently published a book on it too http://www.crcpress.com/product/isbn/9781466512023