replaced tabs, added sample_rate, fixed average=True bug