t4ngo / dragonfly

ARCHIVED! - Speech recognition framework allowing powerful Python-based scripting and extension of Dragon NaturallySpeaking (DNS) and Windows Speech Recognition (WSR)
GNU Lesser General Public License v3.0
364 stars 82 forks source link

Dragonfly latency #48

Open techtonik opened 8 years ago

techtonik commented 8 years ago

What is the delay (lag) between speaking a command and recognizing it?

In other words, how many commands is it possible to execute in one second? Does Dragonfly provide any capabilities to measure this lag (latency) between spoken sound and executed command?

synkarius commented 8 years ago

Can you clarify your question? I've executed literally hundreds of Dragonfly commands in less than a second via unit tests, but obviously no one can speak that many in such a short time.

Also, I'm not sure what you mean about network latency. Dragonfly doesn't send anything to any computer other than the one it is installed on (barring sending keystrokes into virtual machines, etc.). Maybe you're thinking of Aenea? Or the Ruby Dragonfly?

techtonik commented 8 years ago

@synkarius I've updated the question.

synkarius commented 8 years ago

Ah. The lag between speaking and execution depends on hardware, and the complexity of the Grammar(s) you have active. After upgrading my soundcard, there was a noticeable decrease in lag, sometimes by as much as a second. Complex CCR commands might take longer to be recognized too. Usually though, on my I3 processor / 16GB RAM / SoundBlaster E1 external card, the delay is about half a second.

As for measuring the lag, I am unaware of any such tools.

synkarius commented 8 years ago

It may also be worth mentioning-- by using CCR commands, though the total time for a series of commands will be greater than one second, your commands per second will be higher. Meaning, if you speak single commands, you'll be able to speak one or two per second. Speaking strings of commands, you might average more like 3-4.

techtonik commented 8 years ago

Thanks for the explanation. It would be nice to see this documented or even better - visualized, but that is not trivial. Inkscape / D3.js madskilz are required. =)

jgarvin commented 8 years ago

Interesting note about the external sound card. I noticed a significant latency improvement moving from a XLR->USB adapter to a XLR->3.5mm adapter (plugged in to motherboard's onboard sound), but I'm running dragonfly inside a VirtualBox VM on Ubuntu, and it could be the USB audio layer on Linux is slow. Did you get the card specifically to help latency? On Dec 23, 2015 4:50 PM, "anatoly techtonik" notifications@github.com wrote:

Thanks for the explanation. It would be nice to see this documented or even better - visualized, but that is not trivial. Inkscape / D3.js madskilz are required. =)

— Reply to this email directly or view it on GitHub https://github.com/t4ngo/dragonfly/issues/48#issuecomment-167004613.

synkarius commented 8 years ago

@jgarvin, yes. Anything is better than the integrated Realtek cards I've got both at work and at home. I could have gotten internal cards, but I change hardware a lot and USB travels better.

techtonik commented 8 years ago

Interesting, is there any way to get quantitative data about latency in addition to subjective measurement?

synkarius commented 8 years ago

One route might be to look at the callbacks assigned in _load_grammar in dragonfly/engines/backend_natlink/engine.py. You could decorate them such that they report their times to some global object.

jgarvin commented 8 years ago

I'm trying out one of the sound blaster e's and I've noticed the app has a lot of potential configuration options for echo cancellation, noise reduction, "smart volume", etc. What settings do you use? Or do you just shut it all off? On Dec 23, 2015 7:12 PM, "David Conway" notifications@github.com wrote:

@jgarvin https://github.com/jgarvin, yes. Anything is better than the integrated Realtek cards I've got both at work and at home. I could have gotten internal cards, but I change hardware a lot and USB travels better.

— Reply to this email directly or view it on GitHub https://github.com/t4ngo/dragonfly/issues/48#issuecomment-167017321.

synkarius commented 8 years ago

I left everything as the defaults, except for the Advanced Options, in which I specified that I wanted the headset mic to use the headset microphone.

Also possibly relevant though: I've noticed that DNS gets lower recognition accuracy if your mic volume is too high, so I have a batch script constantly running which sets the volume to 20%. (YMMV.) For some reason, every time I switch DNS off and on (the red icon to the green in DNS 12.51), DNS resets my mic volume to 100%.