30 sec + delay between wake word and recording

Hi, I’ve been taking my first crack at a raspberry pi project and built a mycroft/homeassistant setup. It works, but has strange lag between the wake word and recording. It detects the wake word right away, and responds instantly if I get the voice command when it’s actually recording. Is there a timeout set somewhere? I would expect to be able to say commands after a slight pause from the command word.

I apologize if this is common knowledge, most my searches came up with response to commands lag not recording lag.

What kind of pi?
Can you check the logs to see if there’s anything interesting in them?

It’s a pi4, I think I may have figured out the problem late last night.

Mycroft is trying to get audio out and eventually times out and starts recording. It logs “Failed to drain stream” after the pause and starts recording right away after that. Something is outputting constant bit of white noise from boot up, so I think I need to go over my steps in installing my respeaker-2 hat.

Definitely not common knowledge, would be interested to hear if you worked out what was going on?

Unfortunately I’m not sure, I decided to wipe the system and start over. This time there is no delay and no constant white noise. Now I just need to start collecting more than just a smart plug to control with it.

Great to hear that a fresh install got it working though :slight_smile:

I’m having exactly the same problem with same config (Pi4 + ReSpeaker HAT). I’d rather fix it before wiping the system.

Unfortunately there’s no way to tell what exactly causes the “Failed to drain stream” error. Is there any way to make logging more verbose?

I’m just getting some ALSA errors like this on startup:

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

But the audio test goes fine (apart from a slight delay before the playback), Mycroft speaks back just fine, and playing random WAV/MP3 files works fine.

It looks like the lag happens when Mycroft should play its “listening” bleep. Do you know where in the code that happens and if it differs from the response playback (which works fine)?

Using the configuration from here: Picroft + rpi4 + Respeaker Mic Array v2.0 - Audio issues solved the problem for me. However, I had to comment out the “alternate sample rate” (I guess everything gets upsampled to 48k?), otherwise the TTS wouldn’t work.

1 Like

Hey, thanks for reporting back your findings. It will hopefully help others if they are facing a similar issue.

If it’s a common issue then we could try and configure it as such during the setup wizard.