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

concurrent audio and distortion #37

Open
0x1stvan opened this issue May 28, 2024 · 4 comments
Open

concurrent audio and distortion #37

0x1stvan opened this issue May 28, 2024 · 4 comments

Comments

@0x1stvan
Copy link
Contributor

When integrating Dialogflow with Asterisk for voice interactions, there an issue where audio playback becomes distorted. This occurs specifically when a new transcript is added while the previous Dialogflow audio is still playing. The old audio continues to play concurrently with the new audio, resulting in an overlap that causes distortion.

@danjenkins
Copy link
Contributor

Hey @0x1stvan - Is this something you can make a pull request for? Need to clear the buffer when receiving new audio from dialogflow to clear down the previous unplayed audio - this isn't something we're working on currently unless someone wants to pay for consultancy on it.

@0x1stvan
Copy link
Contributor Author

Hey @0x1stvan - Is this something you can make a pull request for? Need to clear the buffer when receiving new audio from dialogflow to clear down the previous unplayed audio - this isn't something we're working on currently unless someone wants to pay for consultancy on it.

Hi @danjenkins , thanks for the quick reply. Tried to fix it, but i'm not really familiar with nodejs, if you can add me a hint how to do it i can create a pull request if working.

Can you please take a quick look to this issue also?
#20

It looks like this bug still there, setting singleutterance to true causes crash

@danjenkins
Copy link
Contributor

Yeah I need to look into the single utterance thing but ultimately I haven't looked at this app in a while.

On how to clear down the audio....

https://github.com/nimbleape/asterisk-dialogflow-rtp-audioserver/blob/master/lib/DialogFlowConnector.js#L178

Thats holding all of the previous timeouts but its a local variable to that function... so make it attached to the class so that you can then call

this.timeouts.forEach((ref) => {
                        clearTimeout(ref);
                    });

On line 178. instead of making an empty array you'll be clearing down the set of timeout refs

@0x1stvan
Copy link
Contributor Author

Thanks @danjenkins , added PR #39, can you check it?

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

No branches or pull requests

2 participants