Picotts on RPi throws an error

  • Platform information:
    • Hardware: Raspberry Pi 3 b+
    • OS: Docker on raspbian stretch lite
    • openHAB version:openHAB 2.5.0.M3 Milestone Build
  • Issue of the topic:
    I run openhab in a docker container on my RPi 3 b+. I wanted to add local voice control so added a microphone and speaker to the RPi and installed Snips-ai on the same RPi. This much works well for me till now. Now I want to add “picotts” to speak out sentences from the connected speaker output. So I installed the addon named “picotts” and in the rules, added the command say as below:
rule "Snips"
    Item SnipsIntent received update
    var String sessionId = transform("JSONPATH", "$.sessionId", SnipsIntent.state.toString);
    sessionId = "{ \"sessionId\":\""+ sessionId + "\" }"
    val actions = getActions("mqtt","mqtt:broker:brokerthingid")
    say("Hi! this is a voice test");

The rest of the rule runs well(except the say command), but no speech comes out of the speaker. In the logs following error is thrown

2019-09-18 12:50:30.374 [WARN ] [core.voice.internal.VoiceManagerImpl] - Error saying ‘Hi! this is a voice test’: org.eclipse.smarthome.core.audio.AudioException$
org.eclipse.smarthome.core.voice.TTSException: org.eclipse.smarthome.core.audio.AudioException: Error while executing '[Ljava.lang.String;@8a0$
at org.openhab.voice.picotts.internal.PicoTTSService.synthesize(PicoTTSService.java:73) ~[?:?]
at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.say(VoiceManagerImpl.java:219) ~[?:?]
at org.eclipse.smarthome.model.script.actions.Voice.say(Voice.java:121) ~[?:?]
at org.eclipse.smarthome.model.script.actions.Voice.say(Voice.java:40) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: org.eclipse.smarthome.core.audio.AudioException: Error while executing ‘[Ljava.lang.String;@8a087a
at org.openhab.voice.picotts.internal.PicoTTSAudioStream.createInputStream(PicoTTSAudioStream.java:64) ~[?:?]
at org.openhab.voice.picotts.internal.PicoTTSAudioStream.(PicoTTSAudioStream.java:45) ~[?:?]
at org.openhab.voice.picotts.internal.PicoTTSService.synthesize(PicoTTSService.java:71) ~[?:?]
… 31 more
Caused by: java.io.IOException: Cannot run program “pico2wave”: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:621) ~[?:?]
at java.lang.Runtime.exec(Runtime.java:486) ~[?:?]
at org.openhab.voice.picotts.internal.PicoTTSAudioStream.createInputStream(PicoTTSAudioStream.java:58) ~[?:?]
at org.openhab.voice.picotts.internal.PicoTTSAudioStream.(PicoTTSAudioStream.java:45) ~[?:?]
at org.openhab.voice.picotts.internal.PicoTTSService.synthesize(PicoTTSService.java:71) ~[?:?]
… 31 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:?]
at java.lang.UNIXProcess.(UNIXProcess.java:247) ~[?:?]

Am I missing some vital steps or has it something to do with the docker install of openhab(which I am using) or maybe due to it being a milestone build???

Your post has no details

1 Like

Okay I will try giving more details as much as I can. Pardon me for my mistakes. I am pretty new to openhab.

Hi, I edited the post a bit to explain the issue I face. Please point me in the right direction.

I tried to search as much as i could about “tts” and also specifically “picotts” but there are not many posts about that in the forums. Searched the openhab documentation but not even lucky there.
Seems like picotts is meant to be up and running just after installing the addon. There is no mention of the error I am facing on the internet.
So I guess maybe its because of running the setup on docker or maybe because of this being a milestone build.

picotts itself is working on my RPi.
Tested with the following commands.
pico2wave -w hello.wav “Hello”
aplay /home/pi/hello.wav

This speaks Hello from the attached speaker.

But openhab is not able to access that with the command “Say” as it throws error.
So maybe an issue definitely due to the docker install.

I have no experience with Picotts or say, but I think there may be some confusion about how Docker works.

The openHAB container does not have access to anything on your host unless you explicitly give it access to it. And it doesn’t have access to any software on your host at all. If you are running Oh in Docker, you need to install Picotts in the Docker Image the openHAB container is based upon. Furthermore, you need to give the container access to the sound device on your host.

tl;dr, the container can’t see picotts. That’s part of the point of running in containers.

Docker on Raspberry … That does not make sense … 1GB RAM …

To get this work… you must install pico tts inside the openhab docker.

You must build custom image or the better way with cont-init.d Script

Thanks a lot for the answer.

Yeah, surprizing works well. Initially tried this setup to get into openhab stuff. But since then I have found it making my life easy to manage things.

Thanks, I 'll try learning about that thing and maybe implement that soon.