androidthings / sample-googleassistant

Google Assistant API sample for Android Things
Apache License 2.0
467 stars 147 forks source link

Audio clipping #43

Open Fleker opened 7 years ago

Fleker commented 7 years ago

(Conversation carried on from #23)

@mhanuel26 you can check out this StackOverflow answer to play simple sounds on a device

proppy commented 7 years ago

@mhanuel26 can you confirm which hardware you were using?

plattysoft commented 7 years ago

I do have quite a horrible audio when using this project, not sure if it is a hardware or a software problem.

I am using the AIY kit with a Raspberry PI 3 running Android Things 5.1

The audio gets choppy almost every time, I tried doubling the buffer size but didn't seem to make a difference.

plattysoft commented 7 years ago

Some more info here: I tried the AIY image and run the test sound. The speaker worked fine.

It looks like a bug on the VoiceHAT driver of the speaker.

Let me know if there is something I can test to help with this.

mhanuel26 commented 7 years ago

@proppy Sorry for my late response, I am using the AIY google kit with raspberry pi3 and android things preview 5.1, similar to @plattysoft

Fleker commented 7 years ago

Can you disable the LED blinking on receiving audio samples and see if that resolves your issue?

ronjdaugherty34 commented 7 years ago

I was having the same problem with audio clipping too. I resolved it by removing the code in the ConversationCallback method section public void onAudioSample(). During the response from the assistant, it's constantly toggling the LED on and off which was slowing down the speech,

Fleker commented 7 years ago

I have also seen the behavior. Removing the code at https://github.com/androidthings/sample-googleassistant/blob/master/app/src/main/java/com/example/androidthings/assistant/AssistantActivity.java#L162 resolved it.

Perhaps it's a threading issue. I've made the change at some point in the staging repo.

plattysoft commented 7 years ago

Thanks! I'l try it and let you know, but it sounds likely that the LED is the cause.

plattysoft commented 7 years ago

Indeed it worked! I'm thinking on writing a fix for this that makes the led blink but in another way, if i do it I'll send a PR. In the meantime I suggest disabling the blinking. A lot of this kits started shipping past week and it will be very annoying if people keeps finding this issue.

Fleker commented 7 years ago

There is the change in staging, but it has not been pushed yet. Though the issue seems to be handled, this issue will remain open until the changes are public.

plattysoft commented 7 years ago

I actually sent a PR just now for another blinking solution :) Will check staging branch. Thanks

Fleker commented 7 years ago

There's a branch we have internally for changes. But we'll take a look at your PR.