Author Topic: TTS Phrase Completion Event  (Read 1074 times)

0 Members and 1 Guest are viewing this topic.

John Smith

  • Jr. Member
  • **
  • Posts: 18
  • Karma: 1
    • View Profile
TTS Phrase Completion Event
« on: December 09, 2021, 10:37:54 PM »
Здравствуйте. При использовании TTS мне нужна следующая последовательность действий:
— нажать клавишу
— запустить TTS.Speak
— после окончания работы TTS отпустить клавишу

Сейчас отпускание клавиши я делаю по таймеру, что приводит к паузам, потому что фразы разной длины. Есть ли возможность, после окончания фразы в TTS генерировать событие, по которому можно выполнить какое-либо действие?
« Last Edit: December 09, 2021, 10:41:26 PM by John Smith »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: TTS Phrase Completion Event
« Reply #1 on: December 14, 2021, 02:48:26 AM »
Sorry for the late response.


You have to use the "TTS.SpeakSync" action insteed of "TTS.Speak" in your command followed by "DxInput.KeyUp".
With TTS.SpeakSync, VC will wait until speaking is complete before continuing to the next action - that is all.




Kalle
***********  get excited and make things  **********

John Smith

  • Jr. Member
  • **
  • Posts: 18
  • Karma: 1
    • View Profile
Re: TTS Phrase Completion Event
« Reply #2 on: December 16, 2021, 11:50:45 AM »
Спасибо, но при таком подходе Voxcommando перестаёт реагировать на все мои действия до тех пор, пока TTS не завершит чтение фразы.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TTS Phrase Completion Event
« Reply #3 on: December 16, 2021, 02:01:11 PM »
Use TTS.SpeakSync (this forces VC to wait for the speech action to finish before going to the next action) and also rename your command name so that it starts with ++ so that it will run in its own thread.  Only use this technique when you really need to.  Using it for all your commands can lead to confusion and instability.

Or if you want to use events, just look at the history window and you will see all events that are generated.  There are events automatically generated for TTS.start and TTS.stop

https://voxcommando.com/mediawiki/index.php?title=Events

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: TTS Phrase Completion Event
« Reply #4 on: December 17, 2021, 01:52:46 AM »
@John Smith
My suggestion was exactly according to your requirements  ;)
***********  get excited and make things  **********

John Smith

  • Jr. Member
  • **
  • Posts: 18
  • Karma: 1
    • View Profile
Re: TTS Phrase Completion Event
« Reply #5 on: December 19, 2021, 11:43:19 AM »
После окончания работы TTS, команда «Test» срабатывает с задержкой в две с половиной секунды. В чём может быть причина такой большой задержки?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: TTS Phrase Completion Event
« Reply #6 on: December 20, 2021, 03:22:45 AM »
You can try James suggestion with my command above by renaming the command so that it starts with ++
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TTS Phrase Completion Event
« Reply #7 on: December 21, 2021, 11:51:30 AM »
После окончания работы TTS, команда «Test» срабатывает с задержкой в две с половиной секунды. В чём может быть причина такой большой задержки?

The event is fired with a slight delay intentionally.  Using the ++ method is probably preferable for what you are trying to accomplish.
« Last Edit: December 28, 2021, 10:26:25 AM by jitterjames »