This script will record audio using the pyaudio library. There have been no updates by me to to this library as of 2016-11-30. If there are improvements, please feel free to send me a pull request.
All credit to @mabdrabo for writing this library. Please see his Gist on it for further information.