Snips detects the wake word but not capturing the Voice - caused by: UnanticipatedHostError

#1

I can see snips detecting the hot word but noting happens later. When I checked the logs of audio server it shows “caused by:have gone UnanticipatedHostError”. Need help to understand what could have gone wrong here?!

Below is the log from the SAM Watch command.
[13:34:38] [Hotword] detected on site default, for model hey_snips
[13:34:38] [Asr] was asked to stop listening on site default
[13:34:38] [Hotword] was asked to toggle itself ‘off’ on site default
[13:34:38] [Dialogue] session with id ‘7ec61909-5426-490b-af91-b3527c076b26’ was started on site default
[13:34:38] [AudioServer] was asked to play a wav of 41.1 kB with id ‘da39d8a1-14b8-4727-bcd7-9b00db4ee778’ on site default

Below is the journal log of Audio Server
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: INFO:snips_audio_portaudio : Playing “da39d8a1-14b8-4727-bcd7-9b00db4ee778” using output “default”, wav spec: WavSpec { channels: 2
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: Expression ‘alsa_snd_pcm_hw_params_set_buffer_size_near( self->pcm, hwParams, &bufSz )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, li
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: Expression 'PaAlsaStreamComponent_FinishConfigure( &self->playback, hwParamsPlayback, outParams, self->primeBuffers, realSr, outputLaten
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatenc
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: thread ‘ai.snips.audio.portaudio.player’ panicked at ‘called Result::unwrap() on an Err value: “SendError(…)”’, ERROR:snips_audio_s
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: -> caused by: UnanticipatedHostError
Nov 06 13:34:38 raspberrypi snips-audio-server[541]: libcore/result.rs:945:5

0 Likes

The session was ended because one of the component didn't respond in a timely manner
#2

Hello,

this is mostly caused by the snips-audio-server not being able to play the request wav.

this happen when the sample rate of the audio output is not matching the requirement or when there is not audio output device at all .

You can confirm the above by deactivating the snips audio feedback in the snips-dialogue of the /etc/snips.toml file :

[snips-dialogue]
# resources = "/usr/share/snips/dialogue"
# session_timeout = 15
# lambda_timeout = 5
# retry_count = 3
sound_feedback_disabled_default = true
0 Likes

#3

Thanks marc for the help, after disabling the sound feedback the SNIP was able to listen and capture the text perfectly.

Coming to the audio part, it works perfectly fine when I use sam to check “sam test speaker”. Its probably to do with sampling rate mismatch as indicated by you. Where can I check and correct this setting. FYI am using Google Voice HAT hardware that comes along with Google AIY Kit.

Are better how can I go about debugging this issue, where should I look for details of the failure.

0 Likes

#4

Hello @sharu

I’m facing the exact same error as you, on a Pi Zero satellite. The hat is raspiaudio, but is detected in the system as Google Voice HAT.
Disabling feedback solves problem too, but we obviously need feedback :slight_smile:

Did you find any way to fix this issue ?

0 Likes

#5

Only new to this, but on my install tts audio has sample rate of 16000 and single channel, whereas feedback has sample rate of 20500 and two channel.

I resampled feedback to 16000, 1 channel and now it all works. Obviously not ideal solution but I don’t yet get alsa resampling which should sort it automatically

0 Likes

#6

Could you help us with how you managed to resample feedback ?

0 Likes

#7

Can someone help us with this problem ? I am not using Snips anymore just because of this.

0 Likes

#8

I also had this problem on a Pi Zero W satellite. I haven’t found the time yet to search for the root of this problem, but @barry’s suggestion worked for me as a temporary workaround.

If anyone else runs into this problem (@poutounours, are you still there?), try this (after installing SoX with sudo apt install sox) to convert the audio files to a sample rate of 16k and one channel:

cd /usr/share/snips/assistant/custom_dialogue/sound
for i in *.wav; do sox $i -r 16k -c 1 $i; done

Note that the sound files are overwritten every time you update your assistant or install a new assistant. So you have to redo this then.

1 Like

#9

Not sure about other hats. But for Google AIY make sure you have config file /etc/asound.conf and it looks as follows:

options snd_rpi_googlevoicehat_soundcard index=0

pcm.softvol {
    type softvol
    slave.pcm dmix
    control {
        name Master
        card 0
    }
}

pcm.micboost {
    type route
    slave.pcm dsnoop
    ttable {
        0.0 30.0
        1.1 30.0
    }
}

pcm.!default {
    type asym
    playback.pcm "plug:softvol"
    capture.pcm "plug:micboost"
}

ctl.!default {
    type hw
    card 0
}

After that reboot the device. Also make sure that the confirmation sounds files are in their original format and not down-converted per koan instructions.

0 Likes

#10

When you have a 2mic respeaker hat for the Pi (on a Pi Zero W)

this seems to work

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

The asound.conf produced by the install script of the driver and/or (?) the snipsledcontrol install script does not seem to work.

0 Likes