Registering and logging in removes this ad.
Registering and logging in removes this ad.
mic on/mic off
I use DNS Pro with Aussie Language option...and Medical dictionaries on several HP Tablets as "fat clients" updating to a server running MS terminal server.
I work with clients simultaneously with using DNS to input my notes and as I am visually impaired, and can't read the screen unless close up, I have set up commands which initiate a spoken confirmation to let me know when the microphone is active. The commands I use are "Note take" "Note end" resulting in a synthesized voice saying respectively "mic on" "mic off".
When working "live" there is an appreciable lag time between issuing the command and hearing the confirmation via bluetooth headset, and this does result in having to modify how I use my speech....because it is hard to seamlessly hold two conversations in a natural way with both the computer and the client when on occaision you find out too late that the programme is still listening!
My understanding is that the command outsources the speech synth from windows and that the lag is caused by having to initiate the textstring to speech synth pathway on each instance that a TTS? command is used.
My question is......would it be possible to initiate a DNS command that in addition to turning on or off the microphone, played a system sound/sound bite using windows resources, which I guess should be low level and fast compared with running through the speech synth pathway.....My assumption is that system sounds are wav files or equivalent, and don't launch a player with a GUI or any of the resource hungry bells and whistles that voice synth would?
Anybody tried this...is it possible....is it fast....feasible??? any help or suggestions appreciated


You could certainly do this
You could probably do this with NatPython, using setMicrophoneState followed by getMicrophoneState and Playsound in your EndNote command and reversing the sequence for the StartNote. I have no idea if you can do this directly in Pro... although I am sure Knowbrainer will have an answer.
Mark
http://speechwiki.org/NL/NatLinkIndex.html
With natpython you can
With natpython you can already do things in the gotBegin function, which is executed as soon as sound is captured. So (sometimes long) before a recognition has taken place. This makes some things react faster.
Not everything can be done though in this function, so a definite answer requires more work.
Quintijn
Thankyou both MarkUK and
Thankyou both MarkUK and Quintijn....I haven't had a play with Natpython, and it sounds like I should definitely do so. I assume it sits between the user and DNS?
Visual and audible feedback
Just in case you might be interested in an exhaustive visual and audible mic state feedback, below you can find my AutoHotkey script that displays fat red/green bars at the top of the monitor when the microphone is off or on, respectively; and makes different sound feedback when the mic is switched on ("klick") or off ("klogg").
Hth,
David.P
; AHK Script to control the microphone state of NaturallySpeaking via hotkeys, display respective colored bars on top of the monitors and give audible feedback when switching microphone on or off
;###########################
; Header
;###########################
;#NoTrayIcon
;Critical
SetTitleMatchMode, 2
#SingleInstance force
#MaxHotkeysPerInterval, 800
CoordMode, Mouse, Screen
Send, {F10} ;Mic OFF
;###########################
; Create a GUI bar at the top of monitor 1
;###########################
Gui, -Caption +AlwaysOnTop +Disabled -SysMenu +ToolWindow
Gui, Show, NoActivate W400 H23 x640 y0
;###########################
; Create a GUI bar at the top of monitor 2
;###########################
Gui, 2: -Caption +AlwaysOnTop +Disabled -SysMenu +ToolWindow
Gui, 2: Show, NoActivate W400 H23 x1920 y0
;###########################
; Switch the bars to red
;###########################
Gui, Color, DC143C
Gui, 2: Color, DC143C
Color = Red
;###########################
; now wait for keys
;###########################
;###########################
; switch microphone OFF while NaturallySpeaking's Spell Dialog Box is present
;###########################
Loop
{
WinWait, Buchstabieren
Gosub, MicOff
WinWaitClose, Buchstabieren
Gosub, MicOn
actionoccurred = 0
}
Return
;###########################
; Modify Enter when NaturallySpeaking's Spell Dialog Box is present to prevent loss of focus after correction
;###########################
#IfWinActive, Buchstabieren
{
Enter::
Send, +{Tab}
Send, +{Tab}
Send, +{Tab}
Send, {Space}
Return
}
#IfWinActive
;###########################
; On Pause (custom hotkey issued e.g. by Mouse or Keyboard for Mic On/Off), if bar color is Red, switch Microphone ON and switch the bars to green
;###########################
Pause:: ; Mic ON
if (Color = "Red")
{
Gosub, MicOn
actionoccurred = 0
}
Else
;###########################
; If bar color is Green, switch Microphone OFF and switch the bars to red
;###########################
{
Gosub, MicOff
}
Return
/*
;###########################
;###########################
;###########################
; toggle Microphone state temporary while left mouse button down
;###########################
;###########################
; on LButtonDown start the timer "DoThisIfHeldDown"
;###########################
~*LButton::
; ToolTip, ButtonDown
MouseGetPos, MouseXPos1, MouseYPos1
SetTimer, DoThisIfHeldDown, 166
Return
;###########################
; on timer timeout,
; if mouse button is still down and mouse was not moved and if mic status bar color is green (i.e. if mic is on)
; reset timer, switch Microphone OFF and switch the mic status bars to red
;###########################
DoThisIfHeldDown:
SetTimer, DoThisIfHeldDown, Off
MouseGetPos, MouseXPos2, MouseYPos2
MouseDiff:= (Abs(MouseXPos2 - MouseXPos1) + (Abs(MouseYPos2 - MouseYPos1)))
; ToolTip, %MouseDiff%
If (MouseDiff < 3) and (Color = "Green")
{
Gosub, MicOff
timeroccurred = 1
}
Return
;###########################
; on LButtonUp, and if the timer had elapsed, reset the timer, switch Microphone ON and switch the bars to green
;###########################
~LButton up::
; ToolTip, ButtonUp
SetTimer, DoThisIfHeldDown, Off
If (timeroccurred = 1) and (Color = "Red")
{
Gosub, MicOn
timeroccurred = 0
}
Return
*/
;###########################
; Microphone ON while F7 down (emulates Press-to-Talk, but including control of the colored GUI bars)
;###########################
;###########################
; on F7 or RightShift,
; if mic status bar color is red (i.e. if mic is off)
; Microphone ON and switch the mic status bars to green
;###########################
*F7::
;RShift::
If (Color = "Red")
Gosub, MicOn
Return
;###########################
; on F7Up,
; switch Microphone OFF and switch the bars to red
;###########################
*F7 up::
;*RShift up::
If (Color = "Green")
Gosub, MicOff
Return
;###########################
;###########################
;###########################
/*
;###########################
; Middle Mouse button to easily toggle the Mic state except when in Firefox
;###########################
#IfWinNotActive Mozilla Firefox
MButton::
If (Color = "Red")
{
Send, {LButton}
Gosub, MicOn
}
Else
{
Send, {LButton}
Gosub, MicOff
}
Return
*/
#IfWinActive ; This puts subsequent remappings and hotkeys in effect for all windows.
;###########################
; edit current selection with NaturallySpeaking's Vocabulary Editor
;###########################
F12::Run, D:\Arbeit\Ressourcen\Vorlagen\Vokabular bearbeiten.ahk
;###########################
; Microphone off in MS Word after some scrolling
;###########################
#IfWinActive, Microsoft Word
~WheelUp::
~WheelDown::
if a_timesincepriorhotkey > 500 ; reset the count if 500ms passed since last scroll
count = 0
count++
;tooltip times turned:`n%count%`n(%a_priorhotkey%)
If (count > 25) and (Color = "Green")
{
Gosub, MicOff
count = 0
}
return
#IfWinActive ; This puts subsequent remappings and hotkeys in effect for all windows.
;###########################
; SUBROUTINES
;###########################
MicOff:
SoundPlay, C:\WINDOWS\Media\CLAVIN91.wav
Gui, Color, DC143C
Gui, 2: Color, DC143C
Sleep, 222
Send, {F10} ;OFF
Color = Red
Return
MicOn:
SoundPlay, C:\WINDOWS\Media\SYNBELE5.wav
Send, {F9} ;ON
Gui, Color, 98FB98
Gui, 2: Color, 98FB98
Color = Green
Return
Thankyou David.P ...I'll
Thankyou David.P ...I'll work my way through that
I don't use a mouse while working, and seeing the screen is a problem but the sound bites are what I had in mind
I appreciate your response
The following example from
The following example from the DNS Pro Help seems to have all the elements you need:
The following script turns off the microphone, plays the beep sound, waits for five seconds to ensure that the sound finishes playing, and turns the microphone back on
SetMicrophone 0
Beep
Wait 5
SetMicrophone 1
HTH
Bruce
Thanks Bruce...I will have a
Thanks Bruce...I will have a play with that as well....I can't remember what the original script was that the installer set up but have it in a file on one of the machines..so will check if they used that function.
Maybe I can choose to alter the "wait" command to the length of the sound and use a "Beep=new sound" or something to fine tune the response.
I know the local company programmers had some fun finding a method because turn on and turn off required different solutions....one using the DNS script and one using external MS commands to execute, and in the upgrade from DNS 9 to 9.5 the script changed. Maybe their solution was a clumbsy one or accesses Narrator in minimised form.
I also don't know if when the script executes it interrupts the DNS speech to text transcription or just the microphone state?
I think, but did not test
I think, but did not test explicit, that Bruce's macro stops all processing of natspeak for 5 seconds.
Quintijn
Quintijn, As stated, the
Quintijn,
As stated, the example is from the DNS Pro Help. If you coded a 5 second delay into a UniMacro script, it too would stop DNS processing for 5 seconds. (Duh.) If you coded a Wait of 0.001, it would stop processing for that fraction of second in either language.
What would have been more helpful to the OP would have been a discussion of how to vary the elements of the script to achieve a desired outcome.
Bruce
It's a KnowBrainer
It is easy
enough to add a command to play a wav file, beep or execute the text-to-speech
reader as we have done with our KnowBrainer
2007 Mic Off command. The time delay you are referring to is the one that
puts DNS into sleep mode or turns the microphone off; not the text-to-speech
reader. We haven't noticed any speed advantage when choosing a wav file over
the text-to-speech engine so we recommend the text-to-speech engine because of
the lower overhead and additional information. For example, when we say Mic Off,
NaturallySpeaking verbally says “sleeping”. HOWEVER, turning the microphone
back on with a verbal command is a little more tricky because you have to edit
the ~ C:\Documents and Settings\All Users\Application
Data\Nuance\NaturallySpeaking9\Data\Enx\dvcu\general\system.dvc file in Windows
XP and ~
C:\ProgramData\Nuance\NaturallySpeaking9\Data\Enx\dvcu\general\system.dvc file in
Windows Vista which is also included in KnowBrainer which responds with a
verbal “ready” acknowledgment. Note that only the professional versions of
NaturallySpeaking allow you to edit commands that deploy from the NaturallySpeaking’s
Asleep state. This capability is not available in the consumer versions of
NaturallySpeaking.
If you're wondering why we are carrying on so much about KnowBrainer, it isn't
just because we are the manufacturers of that product. KnowBrainer is freely
available to the physically disabled and it sounds like you might qualify. If
you do qualify, you won't need any of the other previous answers because these
commands are already included in KnowBrainer. Our What is
KnowBrainer PDF file includes additional information on KnowBrainer and a
form to obtain a free copy.
Lunis Orcutt - Developer of KnowBrainer &
Host
of the Http://www.KnowBrainer.com Speech Recognition Forum
many thanks for that....I'll
many thanks for that....I'll fill out the form and send it to you...it would make a huge difference to my work flow.
regards
John
How about this as a starter?
How about this as a starter? This is an original Joel Gould example, should be simple to put in a Python playsound command in at the relevent points.
Mark
#
# Python Macro Language for Dragon NaturallySpeaking
# (c) Copyright 1999 by Joel Gould
# Portions (c) Copyright 1999 by Dragon Systems, Inc.
#
# _globals.py
# Sample macro file which is active all the time (not application specific).
#
# April 25, 1999
# - packaged for external release
#
# March 3, 1999
# - initial version
#
############################################################################
#
# This is a sample grammar file. I have implemented some basic global
# commands for example purposes.
#
# This file is loaded automatically when the Python subsystem starts because
# its filename begins with an underscore (the signal for a global module).
#
# Please see the example wordpad.py for more comments.
#
import natlink
from natlinkutils import *
class ThisGrammar(GrammarBase):
# We create a simple grammar to illustrate a couple of basic ideas.
# You can say "Python microphone off" or "Python go to sleep" which
# have exactly the same effect as "microphone off" and "go to sleep".
#
# You can also say "Python stop listening" which simulates sleeping
# by putting the system into a state where the only thing which will
# be recognized is "Python start listening"
testGram = """
<micOff> = Python microphone off;
<sleep> = Python go to sleep;
<stop> = Python stop listening;
<notListening> exported = Python start listening;
<normalState> exported = <micOff> | <sleep> | <stop>;
"""
# Load the grammar and activate the rule "normalState". We use
# activateSet instead of activate because activateSet is an efficient
# way of saying "deactivateAll" then "activate(xxx)" for every xxx
# in the array.
def initialize(self):
self.load(self.testGram)
self.activateSet(['normalState'])
self.setExclusive(0)
# When words are recognized from the rule "micOff", this function gets
# called. We turn the microphone off.
def gotResults_micOff(self,words,fullResults):
natlink.setMicState('off')
# When words are recognized from the rule "sleep", this function gets
# called. We put the microphone in the speeling state. This will
# cause the built-in NatSpeak global commands module to activate a
# special "wake-up" state in exclusive mode. We have no control
# over this (although we could activate our own exclusive rule at the
# same time).
def gotResults_sleep(self,words,fullResults):
natlink.setMicState('sleeping')
# For the rule "stop", we activate the "notListening" rule which
# contains only one subrule. We also force exclusive state for this
# grammar which turns off all other non-exclusive grammar in the system.
def gotResults_stop(self,words,fullResults):
self.activateSet(['notListening'],exclusive=1)
# When we get "start listening", restore the default state of this
# grammar.
def gotResults_notListening(self,words,fullResults):
self.activateSet(['normalState'],exclusive=0)
#
# Here is the initialization and termination code. See wordpad.py for more
# comments.
#
thisGrammar = ThisGrammar()
thisGrammar.initialize()
def unload():
global thisGrammar
if thisGrammar: thisGrammar.unload()
thisGrammar = None