rec_play.py
来自「Python语言编译器」· Python 代码 · 共 29 行
PY
29 行
## records an AIFF sample and plays it# infinity number of times.#import timeimport aldef recordit () : p = al.openport('hello', 'r') print 'recording...' buf = p.readsamps(500000) print 'done.' p.closeport() return bufdef playit (buf) : p = al.openport('hello', 'w') print 'playing...' p.writesamps(buf) while p.getfilled() > 0: time.sleep(0.01) print 'done.' p.closeport()while 1 : playit (recordit ())
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?