Git Product home page Git Product logo

Comments (19)

pflammertsma avatar pflammertsma commented on June 8, 2024 3

@Fleker The problem is not the output volume of Google Assistant; it's the output of the speaker itself. Performing a test with the step2-volume-control module, the initial volume is max, yet it's played so quietly it can almost not be heard except in a completely quiet environment.

Nevertheless, I've tried your suggestion, instructing it to set max volume:

02-15 10:19:42.410 1393-1393/com.example.androidthings.assistant I/AssistantActivity: setting volume to: 15
02-15 10:20:04.521 1393-1449/com.example.androidthings.assistant I/AssistantActivity: assistant request text: set the volume to max
02-15 10:20:04.556 1393-1449/com.example.androidthings.assistant I/AssistantActivity: assistant volume changed: 100

Indeed this had no effect.

I've tried the following myself:

  • Booting into Raspbian and testing the AIY Voice Kit; as others have pointed out, the ALSA drivers play sound very loud over the speaker. I did not adjust the hardware in any way between Raspbian and Android Things.
  • I wrote a simple project that plays a generated tone using the Voice HAT pin assignments over a Max98357A (so using BCM16). I generated the tone at max volume, playing at 16 bit PCM with the waveform from -32768 to 32767. Testing the AudioTrack logic on my phone this is so loud I'm worried it damages the speaker. On the AIY kit running Android Things, it's again extremely quiet.
  • I looked into the AIY implementation, thinking perhaps the amp needs to be powered, but as I pointed out in the Android Things project, issue #54: a comment in VoiceHat.openDac() specifically states:

On the VoiceHat, the GAIN_SLOT pin on the DAC is not connected.

I've only tested using a Raspberry Pi 3 running iot_rpi3 0.6.1-devpreview (Android 8.1.0).

from androidthings-googleassistant.

leonrinkel avatar leonrinkel commented on June 8, 2024 1

I just assembled a brand new kit and flashed the latest version of Android Things. android-things/sample-googleassistant works fine without any audio issues. The sample code from this repo works too, but I'm having low-volume and cracking audio issues.

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

Can you remove the LED blinking in the audio response and see if that works?

Can you verify that the speaker hardware is connected well?

from androidthings-googleassistant.

joerick avatar joerick commented on June 8, 2024

I've just double-checked and the connections look good, and the AIY demo works ok.

I disabled blinking (by removing the mLed initialization code), but that doesn't seem to make a difference. I see there are some more changes on master, I'll try them now.


EDIT: same problem with latest master 🤔

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

Does this problem occur with all three steps, or just the second?

from androidthings-googleassistant.

joerick avatar joerick commented on June 8, 2024

All three

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

Do you experience the same behavior if you try with the Google Assistant sample?

I have not seen this kind of behavior before, but if it's consistent on all versions of this code then it should be easily reproducible.

from androidthings-googleassistant.

joerick avatar joerick commented on June 8, 2024

Apologies, I'll have to revisit this in the new year, I've left it at work, and I'm away for Christmas!

from androidthings-googleassistant.

almighty972 avatar almighty972 commented on June 8, 2024

Hello, same issue for me regarding the low-volume .
I used the sample-googleassistant (master branch).
By the way, I didn't found any branch with the v1alpha2 version of the google assistant proto models, so I had to upgrade to the v1alpha2 embedded proto.

For the low volume, I tried to use the adb shell service call audio 3 i32 3 i32 100 i32 1 (based on Oreo android.media.IAudioService interface) but nothing has changed.

from androidthings-googleassistant.

ashdavies avatar ashdavies commented on June 8, 2024

I'm having the low volume issue, but I'm not sure at what point it started, on the first assembly it was fine, then after getting the wifi sorted and trying again it's super quiet. This codebase has crackling audio after issuing a command and the androidthings sample, does not, however both and very quiet.

from androidthings-googleassistant.

pcarff avatar pcarff commented on June 8, 2024

I am having the same audio issues and crackling. I build the Raspbian version and the audio was awesome. Using the same hardware I changed out the SD card with Android Things and am now having audio issues.

from androidthings-googleassistant.

amardeepjaiman avatar amardeepjaiman commented on June 8, 2024

I am also facing the same issue on Android things version 0.6 preview. On raspbian version the sound is fine. But on android things its very low.

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

You should be able to tweak the volume using the code in Step 2.

from androidthings-googleassistant.

ashdavies avatar ashdavies commented on June 8, 2024

@Fleker tweak the volume to more than 100% ?

from androidthings-googleassistant.

amardeepjaiman avatar amardeepjaiman commented on June 8, 2024

step2 ?

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

Maybe the issue is relating to the data being sent from the board over the I2S line. If it's not being sent at a high volume it will not be rendered very loud when the peripheral receives the data either.

from androidthings-googleassistant.

pflammertsma avatar pflammertsma commented on June 8, 2024

How can I troubleshoot the data being sent? From the Android SDK side, I've set the AudioTrack volume to max as well as producing a waveform at maximum amplitude.

In the meantime I have purchased a separate Max98357 amp and will wire this tomorrow. If it exhibits the same behavior, at least this way I can attempt enabling gain (as the Voice HAT's gain pin isn't even attached to the solder point).

from androidthings-googleassistant.

pflammertsma avatar pflammertsma commented on June 8, 2024

To be clear, the following volume related fields are set.

On the AudioTrack:

audioTrack?.setVolume(AudioTrack.getMaxVolume())

On the AudioManager:

val manager = this.getSystemService(Context.AUDIO_SERVICE) as AudioManager
manager.setStreamVolume(AudioManager.STREAM_MUSIC,
        manager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0)

On the PCM waveform:

val valueShort = (Math.sin(j.toFloat() / steps.toFloat() * Math.PI * 2f) * Short.MAX_VALUE).toInt()
recordedBytes.put((valueShort shr 8 and 0xFF).toByte())
recordedBytes.put((valueShort and 0xFF).toByte())

I don't think the output volume is the problem here as if there's something wrong with the sample, surely all devices would exhibit the same behavior. Does it play loudly for you, @Fleker?

from androidthings-googleassistant.

Fleker avatar Fleker commented on June 8, 2024

I've been talking with some other engineers about a potential fix based on the way that audio is handled in Android. I'll be taking a look at this again, as well as a potential fix, today or tomorrow.

The implementation is the sample for both the codelab and sample, so we can use the issue in the sample to discuss this shared issue.

androidthings/sample-googleassistant#54

from androidthings-googleassistant.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.