Step 1: The Raspberry image


#1

You will find here the steps to install an all-in-one raspberry image dedicated to sound control. If you want to add other functionalities to your speaker (say, a weather forecast) you can check a more advanced configuration here.

Let’s get started:

  • Download the snips spkr raspberry image here

  • Burn it to on a micro SD card that will go into your raspberry-pi

  • (some great tools are available online, but we liked etcher.io)

  • Plug your SD card in your raspberry and turn it on and wait a minute

  • for the raspi to boot.

  • SSH into your raspberry (id: pi, password: raspberry)

    ssh pi@spkr.local

  • Now onto the interesting part! Here’s how easy it is to add voice control to your speaker. 1/Retrieve the NLU engine from Docker

    `docker pull snipsdocker/platform``

  • Run the Snips NLU service at boot

    sudo systemctl enable spkr.snips-nlu.service

  • Reboot your Raspberry

Ok so now you have the brick of AI on your raspberry pi ready to be connected to its communication organs: ears (microphone), vocal chords (speaker), and lights (leds)…!


#2

Hello Snips Team,

I try to install spkr on my Rpi 3.

I follow instructions on this forum and on the Medium post.

Some steps need to be more precise, but finally I succeed to install everything (NLU engine, NLU service, mopidy, Google Speech…) without lights (all arduino suff). I rebooted.

I plugged my speaker and a USB microphone (poor quality)… and nothing… :frowning:

How can I can if engine is currently working, where are logs ? Maybe my microphone is too bad.

Thanks a lot for your support,

Renaud


#3

Hi @renaud !

We really appreciate you taking your shot at creating your own Spkr !

We are trying to improve the setup process so your feedback is very valuable.

When installing the Spkr image, you have two systemd services running in the background :

  • The spkr.snips.service which runs the Snips NLU engine along with a communication bus.
  • The spkr.python.service which interfaces the NLU engine responses with Mopidy and LEDs.

To debug the output of those services, you can issue a tail /var/log/daemon.log , or you can monitor it continuously with : tail -f /var/log/daemon.log .

You can restart services by issuing : systemctl restart spkr.python.service and/or systemctl restart spkr.snips.service

As for your microphone, here are some debugging steps that should get you further :

  • Make sure your device is recognised by the OS with the command : arecord -L
  • Adjust the recording level with the alsamixer, by going to the Capture section.
  • Try to record yourself with the arecord yourfilename.wav command.
  • If you can hear yourself with aplay yourfilename.wav then you are good to go !

Hope this will solve your issues !

Cheers !


#4

Thank you @Anthony for your answer and advices.

The microphone and the sound recording are OK (with arecord and aplay).

But when I speak on the microphone “hey snips”, nothing.

Here is logs :

May 12 23:16:51 spkr docker[408]: IOError: [Errno 2] No such file or directory: '/opt/snips/config/assistant/uuid' May 12 23:16:51 spkr docker[408]: 2017-05-12 23:16:51,989 INFO exited: intent_parser (exit status 1; not expected) May 12 23:16:53 spkr docker[408]: 2017-05-12 23:16:52,994 INFO spawned: 'intent_parser' with pid 611 May 12 23:16:54 spkr docker[408]: 2017-05-12 23:16:54,003 INFO success: intent_parser entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) May 12 23:16:55 spkr docker[408]: Traceback (most recent call last): May 12 23:16:55 spkr docker[408]: File "/opt/snips/hermes-py/main.py", line 141, in <module> May 12 23:16:55 spkr docker[408]: main(sys.argv[1:]) May 12 23:16:55 spkr docker[408]: File "/opt/snips/hermes-py/main.py", line 122, in main May 12 23:16:55 spkr docker[408]: intent_parser = IntentParser(assistant_path, mixpanel, get_uuid(assistant_path)) May 12 23:16:55 spkr docker[408]: File "/opt/snips/hermes-py/main.py", line 134, in get_uuid May 12 23:16:55 spkr docker[408]: with open(uuid_path, "w") as f:

I don’t know if you can help me with this.

For information, I use only a Rpi3 + USB microphone + analog speaker.
I don’t have Hifiberry.

Thanks a lot


#5

Hi @renaud !

This is a tricky bug : It seems that you don’t have an assistant.

What I suggest you do is :

  1. Retrieve the latest Docker image docker pull snipsdocker/platform
  2. Go over to the Snips SDK website
  3. Create an account and start creating your Snips assistant
  4. From here, you will be able to add every intent your speaker could need (playMusic, nextTrack,increaseVolume, etc …)
  5. Click on the “Download Assistant” button and follow the tutorial from here
  6. Once you copied your assistant to your raspberry Pi, reboot it !

It should work !
Keep us posted !


#6

Hello @Anthony

Thank you for your answer.

I’m going to do that. Can’t wait to test my custom snips assistant :slight_smile:

I’ll keep you posted,

Regards,

R.


#7

Hi all,

Tried to make a simple version with usb mic and connecting speakers to the 3.5mm jack similarly to what @renaud did.

From the logs I can see that it reacts to the wake word (yay!), and with aplay I tested that playing sound works.

To test it, I asked it to play something from my favourite artist. No audible response. Here’s the daemon.log:

Jul 13 20:54:36 spkr docker[411]: [17:54:36.579413] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: Timeout is reached. Going to Idle mode
Jul 13 20:54:36 spkr docker[411]: [17:54:36.579513] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish ASR(ToggleOff)
Jul 13 20:54:36 spkr docker[411]: [17:54:36.579557] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish Hotword(ToggleOn)
Jul 13 20:54:55 spkr docker[411]: [17:54:55.052255] #033[32mINFO #033[0m:#033[1msnips_hotword     #033[0m: Hotword detected
Jul 13 20:54:55 spkr docker[411]: [17:54:55.060537] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: State: Idle, incoming Message: Hotword(Detected)
Jul 13 20:54:55 spkr docker[411]: [17:54:55.060626] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish Hotword(Wait)
Jul 13 20:54:55 spkr docker[411]: [17:54:55.060664] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish ASR(ToggleOn)
Jul 13 20:54:55 spkr docker[411]: [17:54:55.060698] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish AudioServer(PlayFile)
Jul 13 20:54:55 spkr docker[411]: [17:54:55.060734] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: Current State: WaitingQuery
Jul 13 20:54:55 spkr docker[411]: [17:54:55.150596] #033[32mINFO #033[0m:#033[1msnips_asr         #033[0m: Listening
Jul 13 20:54:55 spkr docker[411]: [17:54:55.151258] #033[32mINFO #033[0m:#033[1msnips_audio_server #033[0m: using output "default" for "/usr/share/snips/dialogue/sound/start_of_input.wav", WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
Jul 13 20:54:55 spkr docker[411]: ALSA lib pcm_dmix.c:1072:(snd_pcm_dmix_open) unable to open slave
Jul 13 20:54:55 spkr docker[411]: Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Jul 13 20:54:55 spkr docker[411]: Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Jul 13 20:54:55 spkr docker[411]: Expression 'PaAlsaStreamComponent_Initialize( &self->playback, alsaApi, outParams, StreamDirection_Out, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2175
Jul 13 20:54:55 spkr docker[411]: Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840
Jul 13 20:54:55 spkr docker[411]: [17:54:55.152575] #033[31mERROR#033[0m:#033[1msnips_audio_server #033[0m: AudioServerError(Portaudio(BadIODeviceCombination), State { next_error: None })
Jul 13 20:54:55 spkr docker[411]: LOG (snips_stt[5.2.48~1-3505]:CompileLooped():nnet-compile-looped.cc:336) Spent 0.0574808 seconds in looped compilation.
Jul 13 20:55:00 spkr docker[411]: [17:55:00.278211] #033[32mINFO #033[0m:#033[1msnips_asr::asr    #033[0m: Source thread stop on push: "Full(..)"
Jul 13 20:55:02 spkr docker[411]: [17:55:02.975458] #033[32mINFO #033[0m:#033[1msnips_asr::asr    #033[0m: Endpoint detection.
Jul 13 20:55:03 spkr docker[411]: [17:55:03.167604] #033[32mINFO #033[0m:#033[1msnips_asr         #033[0m: Cleanup
Jul 13 20:55:03 spkr docker[411]: [17:55:03.167883] #033[32mINFO #033[0m:#033[1msnips_asr         #033[0m: Idle
Jul 13 20:55:03 spkr docker[411]: [17:55:03.200891] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: State: WaitingQuery, incoming Message: ASR(TextCaptured)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.201022] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish ASR(ToggleOff)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.201080] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish AudioServer(PlayFile)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.204893] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish NLU(Query)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.205035] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: Current State: WaitingIntent
Jul 13 20:55:03 spkr docker[411]: [17:55:03.291381] #033[32mINFO #033[0m:#033[1msnips_audio_server #033[0m: using output "default" for "/usr/share/snips/dialogue/sound/end_of_input.wav", WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
Jul 13 20:55:03 spkr docker[411]: ALSA lib pcm_dmix.c:1072:(snd_pcm_dmix_open) unable to open slave
Jul 13 20:55:03 spkr docker[411]: Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1736
Jul 13 20:55:03 spkr docker[411]: Expression 'AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1904
Jul 13 20:55:03 spkr docker[411]: Expression 'PaAlsaStreamComponent_Initialize( &self->playback, alsaApi, outParams, StreamDirection_Out, NULL != callback )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2175
Jul 13 20:55:03 spkr docker[411]: Expression 'PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2840
Jul 13 20:55:03 spkr docker[411]: [17:55:03.292773] #033[31mERROR#033[0m:#033[1msnips_audio_server #033[0m: AudioServerError(Portaudio(BadIODeviceCombination), State { next_error: None })
Jul 13 20:55:03 spkr docker[411]: [17:55:03.318269] #033[32mINFO #033[0m:#033[1msnips_queries     #033[0m: Cleanup
Jul 13 20:55:03 spkr docker[411]: [17:55:03.318371] #033[32mINFO #033[0m:#033[1msnips_queries     #033[0m: Idle
Jul 13 20:55:03 spkr docker[411]: [17:55:03.340657] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: State: WaitingIntent, incoming Message: NLU(IntentParsed)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.340955] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish Intent("PlayMusicCreativeWork")
Jul 13 20:55:03 spkr docker[411]: [17:55:03.341032] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: Current State: Idle
Jul 13 20:55:03 spkr docker[411]: [17:55:03.341066] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish ASR(ToggleOff)
Jul 13 20:55:03 spkr docker[411]: [17:55:03.341094] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish Hotword(ToggleOn)
Jul 13 20:55:16 spkr docker[411]: [17:55:16.579603] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish ASR(ToggleOff)
Jul 13 20:55:16 spkr docker[411]: [17:55:16.579709] #033[32mINFO #033[0m:#033[1msnips_dialogue::services#033[0m: publish Hotword(ToggleOn)
Jul 13 20:55:36 spkr docker[411]: [17:55:36.579668] #033[32mINFO #033[0m:#033[1msnips_dialogue::dialogue#033[0m: Timeout is reached. Going to Idle mode

What’s wrong?

Thanks in advance!


#8

Hello j24,

So sorry for the late reply!
The error you are having means that your mic is not available at the time of the recording. The weird part is that if the hotword is working, it is highly unlikely that the ASR won’t work either.

Check if another service is using your mic on your raspberry (mopidy comes to mind).

I would advise you to update our docker image
docker pull snipsdocker/platform
Also update your pi
sudo rpi-update

Also check that your .asoundrc is correctly configured.
Our wiki has more resources on how to setup your pi https://github.com/snipsco/snips-platform-documentation/wiki for additional information.

Cheers,


#9

Sadly I seem to have the same problem

  • say hotword

  • hear beep

  • say command

    [16:30:18.429556] INFO :snips_hotword_hermes: Hotword detected
    [16:30:18.479287] INFO :snips_dialogue::dialogue: State: Idle, incoming Message: Hotword(Detected)
    [16:30:18.479479] INFO :snips_dialogue::services: publish Hotword(Wait)
    [16:30:18.479560] INFO :snips_dialogue::services: publish Asr(ToggleOn)
    [16:30:18.479628] INFO :snips_dialogue::services: publish AudioServer(PlayFile)
    [16:30:18.479688] INFO :snips_dialogue::dialogue: Current State: WaitingQuery
    [16:30:18.589139] INFO :snips_asr_hermes : Listening
    [16:30:18.594014] INFO :audio_server_hermes : Playing “/usr/share/snips/dialogue/sound/start_of_input.wav” using output “default”, wav spec : WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
    [16:30:21.982204] INFO :snips_asr_lib::asr: Source thread stop on push: “Full(…)”

  • now there’s a huge delay, and ~20 seconds later the command is sent to mqtt (and my nodejs + mqtt script sends a reply and i hear it in the speakers)

    [16:30:42.171041] INFO :snips_asr_lib::asr: Endpoint detection.
    [16:30:42.582478] INFO :snips_asr_hermes : Cleanup
    [16:30:42.584781] INFO :snips_asr_hermes : Idle
    [16:30:42.672266] INFO :snips_dialogue::dialogue: State: WaitingQuery, incoming Message: Asr(TextCaptured)
    [16:30:42.672421] INFO :snips_dialogue::services: publish Asr(ToggleOff)
    [16:30:42.678509] INFO :snips_dialogue::services: publish AudioServer(PlayFile)
    [16:30:42.692863] INFO :snips_dialogue::services: publish Nlu(Query)
    [16:30:42.692993] INFO :snips_dialogue::dialogue: Current State: WaitingIntent
    [16:30:42.897321] INFO :audio_server_hermes : Playing “/usr/share/snips/dialogue/sound/end_of_input.wav” using output “default”, wav spec : WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
    [16:30:43.039581] INFO :snips_dialogue::dialogue: State: WaitingIntent, incoming Message: Nlu(IntentParsed)
    [16:30:43.044798] INFO :snips_dialogue::services: publish Intent(“ActivateObject”)
    [16:30:43.045002] INFO :snips_dialogue::dialogue: Current State: Idle
    [16:30:43.045063] INFO :snips_dialogue::services: publish Asr(ToggleOff)
    [16:30:43.045141] INFO :snips_dialogue::services: publish Hotword(ToggleOn)
    [16:30:43.041412] INFO :queries_hermes : Cleanup
    [16:30:43.050653] INFO :queries_hermes : Idle
    [16:30:43.208963] WARN :snips_tts_hermes : No language provided using default en-GB
    [16:30:43.481264] INFO :audio_server_hermes : Playing “tts-42” using output “default”, wav spec : WavSpec { channels: 1, sample_rate: 16000, bits_per_sample: 16, sample_format: Int }
    [16:30:45.218293] INFO :snips_dialogue::dialogue: State: Idle, incoming Message: Tts(SayFinished)
    [16:30:45.218389] ERROR:snips_dialogue::dialogue: Fails with DialogueError(Msg(“State not supported Idle, Tts(SayFinished)”), State { next_error: None }), going to idle state
    [16:30:45.218441] INFO :snips_dialogue::services: publish AudioServer(PlayFile)
    [16:30:45.222720] INFO :snips_dialogue::dialogue: Current State: Idle
    [16:30:45.222802] INFO :snips_dialogue::services: publish Asr(ToggleOff)
    [16:30:45.222849] INFO :snips_dialogue::services: publish Hotword(ToggleOn)
    [16:30:45.283782] INFO :audio_server_hermes : Playing “/usr/share/snips/dialogue/sound/error.wav” using output “default”, wav spec : WavSpec { channels: 2, sample_rate: 44100, bits_per_sample: 16, sample_format: Int }

The logs are continous (i split them up here - nothing is shown during the ~20 seconds gap).

Once it failed once, it will always fail until a reboot.

I installed the latest raspberry pi lite image today (on the pi 3), did apt-get update, apt-get upgrade, ran the install bash scrript, installed agent and run snips.

This happened first after almost 2 hours of continous running/usage with no issues (about a command every ~40 seconds).

The audio out is with the normal analog audio out on the pi.
The microphone is a usb to analog input dongle.

How can I debug this? I will try with another dongle and see if I can reproduce it.


#10

Hi,
i have 1 open issue with snips.
Snps understands the hotword snips, but nothing else.

Oct 11 07:44:13 spkr docker[494]: [05:44:13.264549] #033[32mINFO #033[0m:#033[1m snips_dialogue_hermes::dialogue#033[0m: Current State: WaitingQuery
Oct 11 07:44:13 spkr docker[494]: [05:44:13.318710] #033[32mINFO #033[0m:#033[1m snips_audio_portaudio#033[0m: Playing “/usr/share/snips/dialogue/sound/start_of_ input.wav” using output “default”, wav spec : WavSpec { channels: 2, sample_rate : 22050, bits_per_sample: 16, sample_format: Int }
Oct 11 07:44:46 spkr docker[494]: [05:44:46.574603] #033[32mINFO #033[0m:#033[1msnips_dialogue_hermes::dialogue#033[0m: Timeout is reached. Going to Idle mode

[05:58:17.176552] ERROR:snips_asr_google : Process exiting (Display(Error(SnipsAsrHermes(Error(SnipsAsr(SnipsAsrError(IoError(Error { repr: Os { code: 2, message: “No such file or directory” } }), State { next_error: None })), State { next_error: None })), State { next_error: None })))
2017-10-11 05:58:17,181 INFO exited: snips-asr-google (exit status 1; not expected)


#11

Apologies for seemingly stupid questions but am very new to Raspberry, Linux, Docker and all.
Am getting error when using Docker:
pi@spkr:~ $ docker pull snipsdocker/platform
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid

Similarly, I can’t get the platform package through Snips APT/Debian repository
pi@spkr:~ $ sudo apt-get install -y snips-platform-voice
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package snips-platform-voice


#12

I have the same error: Unable to locate package snips-platform-voice

Is there a different location or command to get the package?