Copy-paste from http://stackoverflow.com/questions/6867675/audio-recording-in-python