

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)
    for chunk in make_chunks(seg, 500):
        stream.write(chunk._data)
    stream.stop_stream()
    stream.close()
    p.terminate()

dataset/ETHPy150Open jiaaro/pydub/pydub/playback.py _play_with_pyaudio/original