voip - Python Voice Communication -


hello trying figure out code suppose send voice on network. having problems audio sends series of loud beeps , not audio input

after beeps finished eoferror

i have spent last 48 hours trying figure out ideas appreciated

the relevant code

 import pyaudio import speex import sys  chunk = 320 format = pyaudio.paint16 channels = 1 rate = 44100 record_seconds = 5  ### server function ### def server():     ### initialize socket      s = socket.socket(socket.af_inet, socket.sock_stream)     s.bind((host, port))     s.listen(5)     ### start recieve loop     while true: ...         elif cmd == cmd_audio:             d = speex.decoder()             d.initialize(speex.speex_modeid_wb)             p = pyaudio.pyaudio()             stream = p.open(format = format,                             channels = channels,                             rate = rate,                             input = true,                             output = true,                             frames_per_buffer = chunk)              #voice = cpickle.loads(decrypt_my_message(msg))             voice = cpickle.loads(msg)             print voice             in range(len(voice)):                 decdata = d.decode(voice[i])#decode data. (yay)#decode data. (yay)                 stream.write(str(voice), chunk)    #write data out speakers             stream.stop_stream()             stream.close()             p.terminate()             d.destroy()         if not msg: break      conn.close()   ### read data mic ###  def sendaudio():     chunklist = []     init_my_audio = speex.encoder()     init_my_audio.initialize(speex.speex_modeid_wb)     p = pyaudio.pyaudio()     stream = p.open(format = format,                     channels = channels,                     rate = rate,                     input = true,                     output = true,                     frames_per_buffer = chunk)      in range(0, 44100 / chunk * record_seconds):         try:             data = stream.read(chunk)         except ioerror:             pass         encdata = init_my_audio.encode(data)         chunklist.append(encdata)         client(chr(cmd_audio), cpickle.dumps((chunklist), 1))     stream.stop_stream()     stream.close()     p.terminate()     init_my_audio.destroy()  


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -