smcameron / space-nerds-in-space

Multi-player spaceship bridge simulator game. Captain your starship through adventures with your friends. See https://smcameron.github.io/space-nerds-in-space
GNU General Public License v2.0
730 stars 75 forks source link

Text to speech not working while text_to_speech.sh works fine #92

Closed mueslo closed 7 years ago

mueslo commented 8 years ago

I have a text_to_speech.sh that works, but it seems it is never called.

smcameron commented 8 years ago

Is it in the bin directory?

the code that calls it is in snis_client.c and looks like:

    char command[PATH_MAX];
    char *snisbindir;
    char bindir[PATH_MAX];
    struct stat statbuf;
    int rc;

    /* This is all a little gross... */

    snisbindir = getenv("SNISBINDIR");
    if (!snisbindir) {
            snisbindir = STRPREFIX(PREFIX);
            snprintf(bindir, sizeof(bindir), "%s/bin", snisbindir);
    } else {
            strcpy(bindir, snisbindir);
    }

    /* test that snisbindir is actually a directory. */
    rc = stat(bindir, &statbuf);
    if (rc < 0) {
            fprintf(stderr, "Cannot stat %s: %s\n", bindir,

strerror(errno)); return; } if (!S_ISDIR(statbuf.st_mode)) { fprintf(stderr, "%s is not a directory.\n", snisbindir); return; } remove_single_quotes(text); sprintf(command, "%s/text_to_speech.sh '%s'", bindir, text); rc = system(command); if (rc != 0 && errno != ECHILD) { /* we have ignored SIGCHLD, so we get ECHILD here */ fprintf(stderr, "Shell command '%s' returned %d, errno = %d (%s)\n", command, rc, errno, strerror(errno)); }

If you look at the Makefile at what "make install" does, it should copy it into bin.

-- steve

On Sat, Oct 8, 2016 at 8:01 AM, mueslo notifications@github.com wrote:

I have a text_to_speech.sh that works, but it seems it is never called.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/smcameron/space-nerds-in-space/issues/92, or mute the thread https://github.com/notifications/unsubscribe-auth/AABdaAXh-l13e_k9ignDy3zBqLmkBLFaks5qx7BmgaJpZM4KRvep .

smcameron commented 8 years ago

Will close this in a day or two unless you say it still doesn't work.

On Sat, Oct 8, 2016 at 8:08 AM, Stephen Cameron stephenmcameron@gmail.com wrote:

Is it in the bin directory?

the code that calls it is in snis_client.c and looks like:

    char command[PATH_MAX];
    char *snisbindir;
    char bindir[PATH_MAX];
    struct stat statbuf;
    int rc;

    /* This is all a little gross... */

    snisbindir = getenv("SNISBINDIR");
    if (!snisbindir) {
            snisbindir = STRPREFIX(PREFIX);
            snprintf(bindir, sizeof(bindir), "%s/bin", snisbindir);
    } else {
            strcpy(bindir, snisbindir);
    }

    /* test that snisbindir is actually a directory. */
    rc = stat(bindir, &statbuf);
    if (rc < 0) {
            fprintf(stderr, "Cannot stat %s: %s\n", bindir,

strerror(errno)); return; } if (!S_ISDIR(statbuf.st_mode)) { fprintf(stderr, "%s is not a directory.\n", snisbindir); return; } remove_single_quotes(text); sprintf(command, "%s/text_to_speech.sh '%s'", bindir, text); rc = system(command); if (rc != 0 && errno != ECHILD) { /* we have ignored SIGCHLD, so we get ECHILD here */ fprintf(stderr, "Shell command '%s' returned %d, errno = %d (%s)\n", command, rc, errno, strerror(errno)); }

If you look at the Makefile at what "make install" does, it should copy it into bin.

-- steve

On Sat, Oct 8, 2016 at 8:01 AM, mueslo notifications@github.com wrote:

I have a text_to_speech.sh that works, but it seems it is never called.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/smcameron/space-nerds-in-space/issues/92, or mute the thread https://github.com/notifications/unsubscribe-auth/AABdaAXh-l13e_k9ignDy3zBqLmkBLFaks5qx7BmgaJpZM4KRvep .

mueslo commented 8 years ago

I'll try it tonight and get back to you, thanks for the speedy response!

mueslo commented 8 years ago

Okay, it does work, I just edited the wrong text_to_speech.sh, so it was using the one that hadn't been edited to work.

Feel free to close this issue, however, shouldn't the text-to-speech output be displayed to the COMMS station as text (e.g. in case TTS doesn't work or could not be understood)?

smcameron commented 8 years ago

shouldn't the text-to-speech output be displayed to the COMMS station as text (e.g. in case TTS doesn't work or could not be understood)?

Maybe. Directions to the computer can come from 3 places, comms, navigation, and (experimentally) voice command via speech-to-text (pocketsphinx with restricted vocabulary/training) and then via a fifo. But, it probably wouldn't hurt to have "the computer" speech replicated as text to the comms screen. There are probably a few complications as I know there are some customizations of the text to make pronunciation work better (e.g. "starbase" is rendered as "star base" to prevent it from saying "starbuss", and I feel like there are probably a few others like that but that's the only one I can remember off the top of my head.)

smcameron commented 8 years ago

Hmm, it's also complicated by the fact that the comms system is actually implemented like a chat system with channels. Every message on the comms screen is on a channel -- and any ship on that channel will get messages on that channel -- channel 0 is special -- all ships get whats on channel 0. But there currently isn't any channel that's just "only my ship". So if I just put "the computer" speech onto comms, any channel I pick potentially broadcasts to whichever ships are on that channel, which is a bit weird. So first, I'll have to implement some sort of "localship" type channel that it can transmit on. Not tonight though.

smcameron commented 8 years ago

Incidentally, speaking of the channel system used by comms, when you hail a starbase, what happens is it picks a random integer between 1 and ~4 billion and switches you to that channel, and you and the starbase communicate on this randomly chosen channel. Theoretically it's possible for two ships to coincidentally land on the same channel with a starbase (or, if cheating, for one team to deliberately switch to a channel being used by another team, if they can figure out a way to discover it, ie. planted spy who texts channel number to other team via cellular network), at which point... there will probably be some confusion, at best.