ó xiŮRc@sąddlZddlZdZejZdZdZd„Zd„Z e dkr­ddl j Z edƒZe jeddd …ƒe jƒe eƒejd eƒndS( i˙˙˙˙NiiiDŹc Csůtjƒ}|jdtdtdtdtdtƒ}dGHg}xAtdt tt|ƒƒD]"}|j tƒ}|j |ƒq_WdGH|j ƒ|j ƒ|jƒtjg|D]=}tj|d tjƒjtjƒtjtjƒj^qľƒS( Ntformattchannelstratetinputtframes_per_buffers * recordingis* done recordingtdtype(tpyaudiotPyAudiotopentFORMATtCHANNELStRATEtTruetCHUNKtrangetinttreadtappendt stop_streamtcloset terminatetnpthstackt fromstringtint16tastypetfloat32tiinfotmax(tsecondstptstreamtframestitdatatf((ssimple_audio.pytrecord s$  $   c CsĆtjƒ}|jdtdtdtdtƒ}tjtj ƒj |}|}g|j dt ƒD]}|j tj ƒjƒ^qb}x|D]}|j|ƒqW|jƒ|jƒ|jƒdS(NRRRtoutputi˙˙˙˙(RRRR R R R RRRRtreshapeR RttostringtwriteRRR(R"RRR#R ((ssimple_audio.pytplay's   4   t__main__ii tcs450(tnumpyRRR tpaInt16R R R R$R)t__name__tmatplotlib.pyplottpyplottptR"tplottshowtsave(((ssimple_audio.pyts