Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Alexa sample not starts after instaliation #1372

Closed
2 of 8 tasks
handysofts opened this issue May 31, 2019 · 17 comments
Closed
2 of 8 tasks

Alexa sample not starts after instaliation #1372

handysofts opened this issue May 31, 2019 · 17 comments

Comments

@handysofts
Copy link

handysofts commented May 31, 2019

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
2019-05-31 21:19:54.927 [ 1] I PortAudioMicrophoneWrapper:PortAudio suggestedLatency has been configured to :Seconds=0.150000
2019-05-31 21:19:54.927 [ 1] C PortAudioMicrophoneWrapper:Failed to open PortAudio default stream:errorCode=-9996
2019-05-31 21:19:54.927 [ 1] C PortAudioMicrophoneWrapper:Failed to initialize PortAudioMicrophoneWrapper
2019-05-31 21:19:54.929 [ 1] C SampleApplication:Failed to create PortAudioMicrophoneWrapper!
2019-05-31 21:19:54.931 [ 1] 5 DefaultClient:DirectiveSequencerShutdown

What is the expected behavior?

It is working in the same Raspberry for Google assistant

What behavior are you observing?

Failed to create to SampleApplication!

Provide the steps to reproduce the issue, if applicable:

Tell us about your environment:

What version of the AVS Device SDK are you using?

  1.13.0

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more:

Tell us about your OS (Type & version):

  • Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
@mvelegon-amzn
Copy link
Contributor

Hi @handysofts thanks for reaching out.

From the error you posted it looks like portaudio is throwing an Invalid Device error:
PortAudioMicrophoneWrapper:Failed to open PortAudio default stream:errorCode=-9996

This usually happens if the sample rate negotiations fail. Could you please follow the troubleshooting guide here:https://github.com/alexa/avs-device-sdk/wiki/Troubleshooting-Guide Please follow the section under Raspberry Pi and see if it fixes the issue.

@handysofts
Copy link
Author

Thanks for quick response. But the same devices(microphone and headphone) works in the same Raspberry for Google Assistant. Also I checked your link and tested, I can hear a tone. But there wasn't any step to check microphone, maybe SampleSDK can't find my microphone? sound confs are below:

$ less /home/pi/.asoundr

pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
  }
}

$ less third-party/alexa-rpi/config/asound.conf

pcm.!default
{
  type plug
  playback.pcm {
    type hw
    card 0
    device 0
  }
  capture.pcm {
    type plug
    slave {
      pcm {
        type hw
        card 1
        device 0
      }
    }
  }
}

@celinval
Copy link
Contributor

celinval commented Jun 4, 2019

Hi @handysofts, can you please try to run the following commands to test your microphone?

arecord -f S16_LE -c1 -r16000 -d 5 > /tmp/test.wav
aplay /tmp/test.wav

This will try to record the audio using the same parameters as the sample application.

Thanks!

@handysofts
Copy link
Author

Hi @celinval ,

thanks for your advice. It is working, I mean records and plays what it recorded. But no success on Alexa :(

pi@raspberrypi:~ $ arecord -f S16_LE -c1 -r16000 -d 5 > /tmp/test.wav
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
pi@raspberrypi:~ $ aplay /tmp/test.wav
Playing WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono

@khassel
Copy link

khassel commented Jul 7, 2019

can reproduce this after upgrading to the latest kernel.

Found a fix setting environment variable PA_ALSA_PLUGHW=1. May this helps.

@caleighatamazon
Copy link
Contributor

Hi there, sorry for our late response on this. Are you still having problems?

@lucarosellini
Copy link

I am having the same problem on SDK v1.15.0, I get:
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923

I followed the guide available here:

and I am running the SampleApp with PA_ALSA_PLUGHW=1

@caleighatamazon
Copy link
Contributor

Hi @lucarosellini, I think the link is missing for the guide you followed. Could you please share it again?

What command are you using to start the sample app?

Also, did you complete our "Test the Microphone" step in https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide#test-the-microphone ?

Audio configuration depends on your device's particular hardware so it can be tricky for us to debug, since we don't have your exact device on hand. I also recommend that you search through our previous closed issues to see if anyone else's solutions work for you. I tried searching for your error ("alsa_snd_pcm_hw_params_set_period_size_near") and several related issues came up, like #1366 .

We'll keep working on it with you, though!

@lucarosellini
Copy link

lucarosellini commented Nov 18, 2019

Hello @caleighatamazon, sorry for the late reply. I've followed this guide: https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide

The command used to launch the sample app is:
PA_ALSA_PLUGHW=1 ./SampleApp/src/SampleApp ./Integration/AlexaClientSDKConfig.json /home/pi/sdk-folder/inputs/ INFO

I also started from scratch and following the guide using the setup.sh script here: https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide-with-Script

Here the command used is simply sudo bash startsample.sh which, in turns, calls:
PA_ALSA_PLUGHW=1 ./SampleApp "/home/pi/sdk-folder/build/Integration/AlexaClientSDKConfig.json" "/home/pi/sdk-folder/third-party/alexa-rpi/models" DEBUG9

The result is the same, I always get the error I posted previously. I using a Raspberry v1 on Raspbian stretch.
Please find the full startup logs here: https://pastebin.com/igNRfYkv

@womw
Copy link
Contributor

womw commented Nov 18, 2019

hey @lucarosellini have you tried the steps in troubleshooting? https://github.com/alexa/avs-device-sdk/wiki/Troubleshooting-Guide#raspberrypi

@lucarosellini
Copy link

Hello @womw, yes I did, it seems my issue is not listed there.

@priceey
Copy link

priceey commented Nov 27, 2019

I'm also experiencing this.

Does anyone have a work around?

@lucarosellini
Copy link

@priceey after some tinkering, I determined the "Illegal instructions" is not related to the "Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923" message.
The latter looks like it's just a warning related to the kernel version I am using, I downgraded the RASPi firmware and that message disappeared but I still had the generic "Illegal instruction" error.

It seems during the execution flow we hit some assembly instruction not compatible with the CPU. If I am not wrong, the only bit of code not compiled on the board itself is the third party Sensory wake word engine, which is closed source code. From the sensory documentation it looks like their code is not compatible with RASPi v1, which is the board I am using.

@priceey
Copy link

priceey commented Nov 27, 2019

oh game over then.

That's a shame.

Thanks for the update.

@ereich1217
Copy link

You may want to switch to Kitt.AI KWD engine which is built from source on the target device.

https://github.com/kitt-ai/snowboy

@kclchan
Copy link
Contributor

kclchan commented Feb 22, 2020

I am closing this issue due to inactivity. Please feel free to re-open it if it has been closed in error.

@kclchan kclchan closed this as completed Feb 22, 2020
@jonsmirl
Copy link

jonsmirl commented May 2, 2020

I just encountered this error on the Rasp Pi Quick start. After spending a while trying to debug it, I finally figured out that it is simply complaining that there is no microphone installed on the system. The error is because it can't open an ALSA input device. I plugged a mic in and the error went away.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests