Webserver voices on RP

149 views
Skip to first unread message

Tom Emmelot

unread,
Mar 23, 2021, 7:43:24 AM3/23/21
to PicoChess

Hi all,
Got the long push for right click working.
Now I was looking why the voices not come up from the Web server, on an RP
Find out that someone added that part in app.js, but I don't know who did that.
If I look on the GitHub site of Jürgen that part is missing. No voices in that web server.

The part where it about:
var myvoice = "";
var voices = speechSynthesis.getVoices();
/* martin/molli: for Safari we need to pick an English voice explicitly,
   otherwise the system default is used */
for (i = 0; i < voices.length; i++) {
    if (voices[i].lang == "en-US") {
        myvoice = voices[i];
        break;
    }
}
function talk(text) {
    var msg = new SpeechSynthesisUtterance(text);
    msg.lang = "en-US";
    if (myvoice != "") {
        msg.voice = myvoice;
    }
    window.speechSynthesis.speak(msg);
}
talk("Hello, welcome to Picochess!");

function saymove(move, board) {
    var pnames = {
    "p": "pawn",
    "n": "knight",
    "b": "bishop",
    "r": "rook",
    "q": "queen",
    "k": "king",
    };
    talk(pnames[move.piece] + " from " + move.from + " to " + move.to + ".");
    if (move.color == "b") {
        var sidm = "Black";
    } else {
        var sidm = "White";
    }
    if (move.flags.includes("e")) {
        talk("Pawn takes pawn.");
    } else if (move.flags.includes("c")) {
        talk(pnames[move.piece] + " takes " + pnames[move.captured] + ".");
    } else if (move.flags.includes("k")) {
        talk(sidm + " castles kingside.");
    } else if (move.flags.includes("q")) {
        talk(sidm + " castles queenside.");
    }

    if (board.in_checkmate()) {
        talk("Checkmate!");
    } else if (board.in_check()) {
        talk("Check!");
    }
}
Is there anybody that this will work on the RP to?
Hope so, or explain how this can be done?

Here from you,
Kind regards,
Tom

RandyR

unread,
Mar 23, 2021, 9:59:46 AM3/23/21
to PicoChess
Hi Tom,

Dirk added that for v3. See para. 25 in this post. If you want to try Firefox, you can follow these instructions. I don't know if it will work or not. If it does, report back.

Randy

Tom Emmelot

unread,
Mar 23, 2021, 11:06:58 AM3/23/21
to PicoChess
I had already Firefox as my default browser, but no voice from the Web server. YouTube is doing well ;)

Kind regards,
Tom

Op dinsdag 23 maart 2021 om 14:59:46 UTC+1 schreef RandyR:

RandyR

unread,
Mar 23, 2021, 11:16:02 AM3/23/21
to PicoChess
That's too bad. I only have speech synthesis in Windows but I don't really need/use it as I always have a speaker plugged into the Pi.

Randy

RandyR

unread,
Mar 24, 2021, 12:15:25 PM3/24/21
to PicoChess
Hi Tom,

I just tested Firefox v86.0.1 (64-bit) in Linux Mint on my laptop and the speech synthesis is working. I wouldn't recommend it as it sounds too robotic.

Randy

Tom Emmelot

unread,
Mar 25, 2021, 6:15:08 AM3/25/21
to PicoChess
Hi Randy,
Spend 1 day to get it working, followed 20 different ways to get there to no avail!!! The most of them were from years back and still nobody can let it work the way it should!! Firefox looks in the map /etc/speech-dispatcher looking for speechd.conf and use that for creating speech. Tried almost every possible solution but did not get sound. On your Mint version I think it must work the same.
What you use there? I have 18 different  " .conf " now.

Kind regards,
Tom

Op woensdag 24 maart 2021 om 17:15:25 UTC+1 schreef RandyR:

RandyR

unread,
Mar 25, 2021, 9:37:00 AM3/25/21
to PicoChess
Hi Tom,

Attached is my speechd.conf on my laptop. 

Randy

speechd.conf

Tom Emmelot

unread,
Mar 25, 2021, 11:30:29 AM3/25/21
to PicoChess


Hi Randy,
Thanks again, what about your "espeak-ng.conf" file, nine looks strange to me.

Kind regards,
Tom

Op donderdag 25 maart 2021 om 14:37:00 UTC+1 schreef RandyR:

RandyR

unread,
Mar 25, 2021, 12:53:17 PM3/25/21
to PicoChess
Here it is, Tom.

Randy

espeak-ng.conf

Tom Emmelot

unread,
Mar 25, 2021, 4:31:27 PM3/25/21
to PicoChess
Hi Randy,
Was the same as mine, no "knisper" no noting.
So the Pi is not working the same, could be the sound system, what do you use, I use Pulse audio.

Kind regards,
Tom

Op donderdag 25 maart 2021 om 17:53:17 UTC+1 schreef RandyR:

RandyR

unread,
Mar 25, 2021, 5:20:59 PM3/25/21
to PicoChess
Linux Mint 20.1 on my laptop uses Pulse Audio as well.

Randy

Tom Emmelot

unread,
Mar 25, 2021, 6:00:52 PM3/25/21
to PicoChess
Hi Randy,

Now I am puzzled ..................
Go to bed, tomorrow I have https://www.repaircafe.org/
See what i can do there.....

Kind regards,
Tom



Op donderdag 25 maart 2021 om 22:20:59 UTC+1 schreef RandyR:
Reply all
Reply to author
Forward
0 new messages