playback.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:ndh-challenges 作者: the-mandarine 项目源码 文件源码
def _play_with_pyaudio(seg):
    import pyaudio

    p = pyaudio.PyAudio()
    stream = p.open(format=p.get_format_from_width(seg.sample_width),  
                    channels=seg.channels,
                    rate=seg.frame_rate,
                    output=True)

    # break audio into half-second chunks (to allows keyboard interrupts)
    for chunk in make_chunks(seg, 500):
        stream.write(chunk._data)

    stream.stop_stream()  
    stream.close()  

    p.terminate()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号