Speech-dispatcher in snapd?

Hi there,

I wonder if there’s currently a way to enable support for speech-dispatcher in a snap? I’m currently working with an application that allows speech synthesis using libspeechd/speech-dispatcher, but when I run the application via an snap package, no speech synthesis is available.

Am I missing a plug here?

To be clear, it sounds like you are building your own application that wishes to use libspeechd, is that correct?

If so, have you tried running your snap in devmode? I.e. snap install --devmode *.snap after building it with snapcraft?

Yes, that’s correct. I’m packaging an application that provides speech synthesis via libspeechd.

Unfortunately, installing the snap with --devmode enabled doesn’t work. The application starts, but no available “speeches” are detected. I’m using core18 and I added libspeechd2 to the staging packages.

I wonder if the application needs some additional permissions to access speech-dispatcher?

How does libspeechd2 detect available speeches? I’m unfamiliar with that library, but if your snap is in devmode, I think it’s highly unlikely that you are hitting a confinement issue, since all confinement is essentially turned off with devmode.

Okay, thanks for the confirmation that --devmode rules out confinement issues. I investigated a little more and I noticed that speech-dispatcher needs to run as a service while using the application. Under normal conditions, speech-dispatcher will automatically run if it’s requested, so I think that won’t work within a snap package and I need to add the service manually.

I already have an idea on how to solve this, I’ll keep you posted. Thanks for the input though!

Okay, it seems that I’m quite lost at this point.

Even though I added nearly every package that has something to do with libspeechd to the build- and staging-packages, I can’t get it to run. Now, it basically complains that the application can’t communicate with the libspeechd socket.

I guess I have to do some symlink trickery here regarding the sockets…

Were you able to get something working?

Hi @galgalesh - sorry, I just noticed that I never replied here once I solved the issue.

What I did was to ship an own instance of speech-dispatcher directly in the snap and starting it via a special launcher script. This approach is possible in my case since we need a launcher script anyways, so no additional “overhead” needed to be added. Since I also know how the TTS stuff of the application is implemented, I know which packages to ship, so I didn’t need to worry about the whole interfaces and just need the audio-playback plugin.

This is how I did it:

Initially, I tried to hook up the snap to the host systems speechd service, but we can’t guarantee that every system have this installed.

In my opinion, having speechd available as a snap interface would be pretty neat.

1 Like