0

Hey,
i want to make a push to talk a chat, but i dont know how.

import pyaudio
import sys

chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format = FORMAT,
                channels = CHANNELS,
                rate = RATE,
                input = True,
                output = True,
                frames_per_buffer = chunk)

print "* recording"
for i in range(0, 44100 / chunk * RECORD_SECONDS):
    data = stream.read(chunk)
    stream.write(data, chunk)
print "* done"

stream.stop_stream()
stream.close()
p.terminate()

This is my code and i want to change it, that only when i press "a" sound is recorded and played. I tryed it with pyhook, that always i press a- something is read out and written in the stream, but i got an input overflow error. Can someone help me?

waki

PS: sorry for my bad english

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Beat_Slayer
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.