Added recording of sound and a few other state ideas

This is not completely finished. A lot has been added. But until we
decide on some work flow I am not sure how much should be done. The
basics are there now. Except for loading and playing a wav file.