1

I'm trying to use the Text To Speech program balabolka and it's command line version Balcon on my machine running ubuntu 20.04.1 LTS through ssh. First I downloaded balcon from http://www.cross-plus-a.com/fr/bconsole.htm, Then after some research I managed to get it to work, this required installing Wine, winetricks, Microsoft speechPlatformRuntime, speechsdk and msxml6. I also installed some SAPI 5 TTS voices. I followed the steps described in Wine: How to use SAPI 5 voices for TTS application “Balabolka”?

I use this command line when testing:WINEPREFIX="$HOME/prefix32" wine "$HOME/prefix32/drive_c/Program Files/balcon/balcon/balcon.exe" -f text.txt -n Daniel_Full_22kHz -w audiooutput.wav

This command works perfectly when run directly on the host machine however my goal is to run this command through ssh from another machine. for testing purposes I tried an ssh connection directly from windows commandline and also using python + paramiko.

here's the strange part: After rebooting the Ubuntu machine the first try using any of the mentionned methods succeeds however the subsequent tries always fails.

when using the direct ssh connection in windows cmd, I get the following error:

~$ WINPREFIX="$HOME/prefix32" wine "$HOME/prefix32/drive_c/Program Files/balcon/balcon/balcon.exe " -f text.txt -n Daniel_Full_22kHz -w audiooutput.wav 0009:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0009:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly. 0009:err:ole:CoGetClassObject class {d941651c-44e6-4c17-badf-c36826fc3424} not registered 0009:err:ole:create_server class {d941651c-44e6-4c17-badf-c36826fc3424} not registered 0009:err:ole:CoGetClassObject no class object {d941651c-44e6-4c17-badf-c36826fc3424} could be created for context 0x5 0009:err:ole:CoGetClassObject class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:CoGetClassObject class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:create_server class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:CoGetClassObject no class object {cb96b400-c743-11cd-80e5-00aa003e4b50} could be created for context 0x7 Error: voice not selected

The error indicates an issue with the $DISPLAY environment variable. using echo $DISPLAY I found that the variable is not set in the ssh console, so I set it using export DISPLAY=:0 the value :0 is obtained by running echo $DISPLAY localy on the ubuntu ssh server. After this modification all subsequent tries works fine.

I tried to do the same using python+paramiko, here's my script:

import os
import shell
import paramiko

def connectSSH(key,host,user): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) print("connecting") c.connect( hostname = host, username = user, pkey = k ) ftp_client = c.open_sftp() print("connected") filet = open("./text.txt","w") filet.write("Hi this is a text to speech test with daniel voice") filet.close() ftp_client.put("./text.txt","./text.txt") env_dict = {"DISPLAY":":0"} cmd = "WINPREFIX="$HOME/prefix32" wine "$HOME/prefix32/drive_c/Program Files/balcon/balcon/balcon.exe " -f %s -n %s -w %s" % ("kesra2.txt", "Daniel_Full_22kHz","audiooutput.wav") print(cmd) stdin,stdout,stderr=c.exec_command(cmd,environment=env_dict) print(stdout.readlines()) print(stderr.readlines()) ftp_client.get("audiooutput.wav","audiooutput.wav") ftp_client.close()

At first I got the same $DISPLAY error so I added it using env_dict = {"DISPLAY":":0"} and allowed this variable modification on the server sshd config, but now I always get the error:

0009:err:ole:CoGetClassObject class {d941651c-44e6-4c17-badf-c36826fc3424} not registered 0009:err:ole:create_server class {d941651c-44e6-4c17-badf-c36826fc3424} not registered 0009:err:ole:CoGetClassObject no class object {d941651c-44e6-4c17-badf-c36826fc3424} could be created for context 0x5 0009:err:ole:CoGetClassObject class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:CoGetClassObject class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:create_server class {cb96b400-c743-11cd-80e5-00aa003e4b50} not registered 0009:err:ole:CoGetClassObject no class object {cb96b400-c743-11cd-80e5-00aa003e4b50} could be created for context 0x7 Error: voice not selected

the last part of the error Error: voice not selected is not significant since the same cmd works in the other cases, Something else is failing but I can't find it. Also I don't understand why the first try after a reboot of the server works fine regardless of the method (ssh console or python + paramiko)

I tried using paramiko's invokeshell() with the same results

Any help will be much appreciated

1 Answers1

1

After further research it seems the issue is related to the "WINEPREFIX" variable. by moving it inside env_dict and using absolute path the issue is no longer reproductible

env_dict = {"DISPLAY:":0", "WINEPREFIX":"absolute/path/to/prefix"}