sample-googleassistant icon indicating copy to clipboard operation
sample-googleassistant copied to clipboard

Problem with MP3 output, multiple conversations ?

Open kamil-kierski opened this issue 5 years ago • 2 comments

Hello guys,

I'm having problems using the androidthings example from Google, when I set output to MP3, most of the responses are working well and as expected but sometimes for example when I say "Say something short", "Say something long" the Assistant API is acting strange, I'm getting way too many responses and "conversations?"

The log says that it's finishing conversation many times, I got this event fired many times...

2019-05-22 17:28:19.323 17562-17709/com.example.androidthings.assistant 
D/AudioTrack: stop() called with 280 frames delivered
2019-05-22 17:28:19.323 17562-17709/com.example.androidthings.assistant 
I/AudioTrack: Skip ramp
2019-05-22 17:28:19.333 17562-17562/com.example.androidthings.assistant 
I/AssistantActivity: assistant conversation finished
2019-05-22 17:28:19.335 17562-17709/com.example.androidthings.assistant 
D/EmbeddedAssistant: Received response: # 

See the attached log: Embedded assistant log

Is is the API bug? Or something's wrong with the configuration ?

I'm using the latest code from here: androidthings-googleassistant

The problem does not exist when the output encoding is set to LINEAR16.

EDIT:

I believe that this part causes problems:

if (value.getAudioOut() != null) {
   if (mAudioOutSize <= value.getAudioOut().getSerializedSize()){
   mAudioOutSize = value.getAudioOut().getSerializedSize();
   } 
   else {
   mAudioOutSize = 0;
   onCompleted();
   }
}

This was some nasty way on determining the end of the assistant response, works well for PCM because chunks were always the same size and the last was smaller, but for the MP3 the chunk sizes aren't equal, they look random.

Any better way to determine the end of audio response ?

kamil-kierski avatar May 22 '19 16:05 kamil-kierski

The current implementation works with the default output as configured in the sample. I don't know with regards to mp3.

Fleker avatar May 23 '19 13:05 Fleker

The current implementation works with the default output as configured in the sample. I don't know with regards to mp3.

That's right. It's not a bug of the implementation. Please move it to questions as it is a question regarding modification of this implementation.

Regards, Kamil

kamil-kierski avatar May 23 '19 13:05 kamil-kierski