Skip to content

Instantly share code, notes, and snippets.

View polunzh's full-sized avatar
🎯
Focusing

zhenqiang polunzh

🎯
Focusing
View GitHub Profile
@polunzh
polunzh / recorder.py
Created March 12, 2016 07:50 — forked from sloria/recorder.py
WAV recording functionality using pyaudio
# -*- coding: utf-8 -*-
'''recorder.py
Provides WAV recording functionality via two approaches:
Blocking mode (record for a set duration):
>>> rec = Recorder(channels=2)
>>> with rec.open('blocking.wav', 'wb') as recfile:
... recfile.record(duration=5.0)
Non-blocking mode (start and stop recording):