Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing tweaks to improve bot accuracy #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zacharyliu
Copy link

During some experimentation using Nexmo with Amazon Lex, we found that it was difficult to have a fluid two-way conversation with the bot. We would encounter issues such as double responses, commands getting cut off, and unpredictable delays.

The lex-connector server currently processes both the user's command and Lex's response in the same thread. This means that incoming speech was not being processed while a response was playing. It seemed that this caused commands to get queued up. If you weren't completely silent while Lex was playing its response, then any noise in the meantime might get misinterpreted as a command, leading to a confusing conversation. The inherent delay in the phone connection also made this worse, since it made it hard to tell which command led to which response.

This PR moves the processing of a Lex response to a background thread, so that incoming speech data can be processed from the buffer. Incoming speech, however, is discarded while a response is playing and for another 0.5 seconds afterwards (accounting for the phone delay), so that nothing the user says during a response might cut it off.

Another tweak is to maintain a few frames at the beginning of a silent segment indicating the end of a command. Sometimes the tail end of a spoken command would get interpreted as "silence" and got cut off.

@tbass134
Copy link
Contributor

tbass134 commented Sep 18, 2017

Thanks @zacharyliu this looks great! @sammachin Can you take a look at this PR?

@baffleinc
Copy link

+1 for a merge!!!

@natsu90
Copy link

natsu90 commented Dec 9, 2017

+1

@mheap mheap changed the base branch from master to main February 2, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants