Author Topic: quick input very slow  (Read 1692 times)

IvanS

  • Newbie
  • *
  • Posts: 11
quick input very slow
« on: August 26, 2023, 06:22:35 AM »
I try to pass unrecognized phrases to my program to (try) process it there.  So next to the normal commands, I want to use VoiceAttack as speech-to-text to send to my app.

I've done it with the "Execute a command each time a phrase is unrecognized" option.   The implementation works (tested in Notepad), but the characters appear VERY slow

Hold keys down is set to 0.005 and wait between keys to 0.002 seconds.  So theoretically it should 'type' at roughly 140 (1.0 / 0.007) characters per second, but it's more like just 5 characters a second.

Are there any other settings that slow quick input down ?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: quick input very slow
« Reply #1 on: August 26, 2023, 06:42:12 AM »
That is abnormal.

With those timing settings, it takes about half a second to type "This is a test" into Notepad on my machine, as shown (you may need to click the attachment for the animation to work).


Though, in the context of sending input to an application, typing is out would be one of the most inefficient methods.

You could use an inline function and utilize one of the many available inter-process communication methods available in .NET, instead.

If it absolutely needs to be passed into a text input field, pasting by using the "Set a Text Value to the Windows Clipboard" action and a keypress action that presses and releases Ctrl-V (or Shift-Insert) would be much quicker than typing, even at normal speeds.

IvanS

  • Newbie
  • *
  • Posts: 11
Re: quick input very slow
« Reply #2 on: August 26, 2023, 01:28:48 PM »
Thanks!

For quick testing, I changed it to "Write Text to a File", which is indeed way faster.  I can let my program monitor the file.

It's not the ideal solution.  Especially on an SSD it's not a good idea to constantly write/overwrite the same file.  Some other form of inter program communication would be better.  I've seen that VA can be launched from the command line, sending it's log to stdout.  So it might be possible to start it a a process from my app and grab the output.  Just need to check what exactly goes into the log and whether that setup works.  But for the time being, the text file is the easy solution for testing. 

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: quick input very slow
« Reply #3 on: August 28, 2023, 12:41:51 PM »
There are absolutely better ways for you to pass data from the VoiceAttack application to a 3rd party application which you wrote.  First I'd ask which language that application is written in, as I'm only familiar with a few languages with C# being my strongest.  When I have to pass raw dictation audio and instructions to process them from VoiceAttack to my 3rd party application (OpenAI_NET), I am using named pipes to send and receive data back and forth between them.  This process uses OpenAI Whisper to accurately transcribe what was said, then sends that back to the VoiceAttack application for further actions.

I am using a plugin written for VoiceAttack to achieve this, rather than an inline function in C#, though this could be done through an inline function in C# via `using System.IO.Pipes`.

Alternatively, the command line options can pass data back to VoiceAttack, and you can try to use STDOUT but it is not exactly designed to hand off data in the manner you are describing.

You are correct that trashing a disk with writes (regardless of SSD/NVMe) is not ideal when there are numerous other options available.  I really think you should look into using named pipes, it's fairly easy to set up a sender and a listener on each side, and then you can be tossing data back-and-forth like a pro with very little latency and only using System Memory instead of Disks.

Best wishes and good luck with your project!!  ;D

edit: Here is the "Piping.cs" code of my OpenAI Plugin and its companion OpenAI_NET application in C#: 
https://github.com/SemlerPDX/OpenAI-VoiceAttack-Plugin/blob/master/OpenAI_VoiceAttack_Plugin/service/Piping.cs
https://github.com/SemlerPDX/OpenAI-VoiceAttack-Plugin/blob/master/OpenAI_NET/service/Piping.cs

IvanS

  • Newbie
  • *
  • Posts: 11
Re: quick input very slow
« Reply #4 on: August 28, 2023, 01:50:04 PM »
Thank you very much for your reply. 

Indeed named pipes or sockets would be a good way to implement things.  Also, VA (thru Windows speech) doesn't do a very good job at recognizing things which aren't in the commands list. Probably also because English isn't my native language.  It isn't too bad, but I speak it very little so definitely with an accent.

So Whisper would probably do a much better job, because that's just the reason I'd be using it for: trigger actions with known commands and pass unrecognized stuff to let my app figure out what is to do with it, if anything. 

I'm just wondering what the lag I should expect between sending voice data to whisper and receiving the result. Most sentences will be in the 3 to 7 second ballpark.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: quick input very slow
« Reply #5 on: August 29, 2023, 12:00:23 PM »
I'm just wondering what the lag I should expect between sending voice data to whisper and receiving the result. Most sentences will be in the 3 to 7 second ballpark.

Typically a second or few for a return from Whisper for short sentences.  That being said, rarely the OpenAI systems can become overloaded with requests given how popular this tech has become and the more programs and apps use the OpenAI API, but not frequently.