Can't simultaneously read/write from ossaudio dsp device

Tito generic_user25 at
Mon Mar 13 14:55:33 CET 2006

I got it working!  There was another thread on
this group where someone had the same problem.  I changed my code to
the following:

from twisted.internet.task import LoopingCall
from twisted.internet import reactor
import os, sys, wave, audioop

While playing the contents of test1.wav,  talk into the mic
and have the audio recorded into /tmp/out.wav

def playnlisten_out():
    audio = wavin.readframes(1024)
    stereoaudio = audioop.tostereo(audio, 2, 1, 1)

def playnlisten_in():
    audio =

def both():

dspout ='/dev/dsp', 'w')    # 2 file handles
dspin ='/dev/dsp', 'r')

wavin ="test1.wav", "r")
wavout ="/tmp/out.wav", "w")

both_loop = LoopingCall(both)

and it worked as expected.  I did not need to mess around with

More information about the Python-list mailing list