
I'm just not finding what I'm looking for so I have two questions I need to ask:
1.) I want to be able to pause speech recognition for the duration of a sound file being played and I don't want to specify the amount of time. For example if I play a sound file and want to pause the speech recognition for 9 seconds I know I can do it like so:
ControlCommand( "Speech Recognition", PauseMS, 9000)
What I want is something more like:
#this plays a song from my Music sound board
ControlCommand("Music", Track_0)
ControlCommand( "Speech Recognition", Pause, until end of Track_0)
Is that possible?
2.) When you play a random track, is there a method to grain the value of the random track? For example this will play a random track from my sound board:
ControlCommand("Answer to Bender", Track_Random)
I've noticed the Track_Random often selects the same track. What I want to be able to do is discover the number of the random track - use the value to set a variable - then use that variable to ensure a different track is select the next time the script is ran. It doesn't look like there is a way to grain the number of the Track_Random (or at least it might not be documented)?
Thank you all in advance for your advice and suggestions!
@Rich, it's really close to working. Here is my code to pause the speech recognition during sound file play back from a sound board and using the Sound Servo(pc):
The sleep statements are in there to give the music a couple of seconds to start. It does set the state of speech recognition to paused, but only for a couple of seconds because the sound the Sound servo takes in is audio from the PC mic so the sound from my PC speakers have to be loud enough to keep the value above a value of 0 and the sound level even turned up would not keep the value from falling down to 0.
I did increase update speed to 4000(ms) and moved the mic right next to a speaker - do this the above script did exactly what I wanted, an automated pause of speech recognition during sound file playback.
For testing / proof of concept this worked. For practical use I don't think it will perform as I was hoping. If the sound source could be selected, between mic and the PC's own sound output we'd be in business!
And that solution, even if the Sound servo (PC) had the option to intake only the PC's own output it would not work for sound files with any pauses or moments with no sound in it.
Just thinking out loud, it probably needs a solution built in .NET because playing the sound file is an underlining .NET windows function and .NET must have a method to know when a sound files ends, other wise windows media player would not know when to play another track or file.
I just found an example of the how use .NET to detect when the end of a file is played.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562692(v=vs.85).aspx
That's just a shout out to the EZ-Robot crew incase they feel that might be a handy feature to add in the future.
So basically, the repeatuntil needs to be until the sound level is 0 for x number of seconds ideally. I'll have to think about how to do that (I'm sure it's possible somehow).
Possibly something to do with the RepeatWhile may work... I'll do some playing later and see what I can figure out.
<sound level is 0 for x number of seconds> Ahhh.....hum....yes...Hummmmmmmm lol I'll have to think on that too!
I keep coming up blank on the $soundlevel = 0 for x seconds code. I have a few ideas but so far they have all had their own little problems... possibly because my eyelids are very heavy. I'll give a couple of other ideas a shot tomorrow though.
I'm sure something can be figured out using the RepeatWhile() command along with the $seconds variable or a simple counter variable and some $x = $x+1 with sleeps.
I'll have another look at it once I've had some much required sleep if you don't come up with anything in the mean time.
I'm going to mark this as solved, because we more or less determined what can and can't yet be done in the scripting.
Thank you Rich for your ideas and work around. I think I'm going to try to make a 3rd party app that monitors the actually speaker output from the PC and uses that to send a variable to ARC. I need to develop this function for some other ideas I have as well.
I'll work on a script of some kind soon I've just been very busy recently with work, sorting out my house and a few other things so I've had to put EZ-Robot stuff to the side temporarily. I'm confident something can be done to monitor the sound through the sound servo control's variable and some kind of timing script or counter which monitors and detects a longer dip in volume (therefore indicating sound has finished).
Failing that, the sleep() command along with accurate timing could always work. It may mean adding more and more scripts and triggering sounds via ControlCommand to run the script that plays the sound followed by a sleep of the same length as the sound... The "ScriptStartWait" function of ControlCommand would be ideal as this pauses the script calling the ControlCommand until the script started has finished (see my Ping Roam 2.0 for examples of ScriptStartWait)