DavidKinder / Windows-Glk

Windows implementation of Andrew Plotkin's Glk specification.
MIT License
10 stars 3 forks source link

Speech and sound improvements #6

Open DavidKinder opened 5 years ago

DavidKinder commented 5 years ago

Suggestions from Nikita Tseykovets:

mcgsegur commented 11 months ago

How about change the TTS part to make it much more "friendly" and "dynamic" ( allowing you to 'barge in' when what to skip "text speaking" by issuing a command before the end of last "text queued for speaking") and avoid getting bored by listening to the same text "over and over":

typedef enum SPEAKFLAGS {
  SPF_ASYNC = (1L<<0),
  SPF_PURGEBEFORESPEAK = (1L << 1)
} SPEAKFLAGS;

Add "clock_t m_lastSpoken=0;" just after "static TextToSpeech SpeechEngine;" in GlkTalk.h

Change in "void TextToSpeech::Speak(LPCSTR speech)" and "void TextToSpeech::Speak(LPCWSTR speech)"

   if (clock() - m_lastSpoken > CLOCKS_PER_SEC/4) { // 0.25 sec interval
        m_Voice->Speak(unicode, SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL);
    }
    else {
        m_Voice->Speak(unicode, SPF_ASYNC, NULL);
    }
    m_lastSpoken = clock();

That's all... and have a much better experience with the voice synthesis (I hope).