The main sound code

This is the implementation of the main sound code.