Good books on computer music will talk a lot about creating sounds from scratch like in this chapter. One of Mark's favorites for understandability is Computer Music: Synthesis, Composition, and Performance by Dodge and Jerse . The bible of computer music is Curtis Roads's massive The Computer Music Tutorial .
One of the most powerful tools for playing with this level of computer music is CSound. It's a software music synthesis system, free, and totally cross-platform. The book by Richard Boulanger  has everything you need for playing with CSound.
jMusic is a free programming library written for musicians in Java (see http://jmusic.ci.qut.edu.au/jmtutorial/t1.html). It allows you to compose music. It can also import and export MIDI and audio files.