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( "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!
Upgrade to ARC Pro
Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro
1) As far as I know there is no command which will wait until a sound file is finished. It may be possible to use the Sound servo (EZB) control and use the variable which it stores the sound level as, so something like;
2) Set up a random number generator and use that in the ControlCommand?
Add some ifs and save the picked tracks as variables so they aren't repeated?
Error for that line, not defined. This is with a version 3 EZb, not a v4.
I should have added I tried that with a variable already. I too thought GetRandom might be a good solution.
It might be that what I'm asking for is not possible at this time, which is ok.
I have 8 tracks (haha 8-track) (ok, technically 9 tracks) and this works MUCH better than Track_Random
With the V3, use the V3 sound servo control and the V3 sound servo variable. You may need to adjust it from 0 if there is background noise etc. but the principle should work.
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!
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.
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.
Possibly something to do with the RepeatWhile may work... I'll do some playing later and see what I can figure out.
I'll have to think on that too!
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.
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.
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)