You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using read_audio function to do something then I respond with write_audio.
while pcall.state == call.CallState.ANSWERED:
if silence_counter >= max_silence_count:
break
data = pcall.read_audio(length=800, blocking=True)
if data and ((data.count(b"\x80") + data.count(b"\x7f")) / len(data)) <= 0.94:
w.writeframes(data)
time.sleep(1 / (8000 / 800))
After then, I respond with write_audio due to command:
f = wave.open(file, 'rb')
frames = f.getnframes()
data = f.readframes(frames)
f.close()
print("FRAMES:",frames)
pcall.write_audio(data) # This writes the audio data to the transmit buffer
print("Data are in buffer and playing")
stop = time.time() + (frames / 8000) # frames/8000 is the length of the audio in seconds
while time.time() <= stop and pcall.state == call.CallState.ANSWERED:
time.sleep(0.1)
print("Message finished")
But, when I interrupt and speak while write_audio running, it detects after writing finished and reading starts.
For example:
Script: Hello, how can I help you?
Me: Turn on the lights. Script: Alright, I am turning... (I INTERRUPT IT and say "No, Close the lights") ... the lights. Anything else?
Me: Thank you. Script: (It reads audio like "No, Close the lights thank you"): Okay, I am closing the lights.
I used 1.6.7 and 2.0.0a5 and both versions didn't work.
I want to read audio only when I want to read, not previous voices.
Also, I tried blocking=False but it didn't work and also has many delay because of writing.
Thanks.
The text was updated successfully, but these errors were encountered:
Hello,
I am using read_audio function to do something then I respond with write_audio.
After then, I respond with write_audio due to command:
But, when I interrupt and speak while write_audio running, it detects after writing finished and reading starts.
For example:
Script: Hello, how can I help you?
Me: Turn on the lights.
Script: Alright, I am turning... (I INTERRUPT IT and say "No, Close the lights") ... the lights. Anything else?
Me: Thank you.
Script: (It reads audio like "No, Close the lights thank you"): Okay, I am closing the lights.
I used 1.6.7 and 2.0.0a5 and both versions didn't work.
I want to read audio only when I want to read, not previous voices.
Also, I tried blocking=False but it didn't work and also has many delay because of writing.
Thanks.
The text was updated successfully, but these errors were encountered: