Hints on how to perform an action a variable number of times?

702 views
Skip to first unread message

RJS

unread,
Apr 20, 2016, 12:24:33 PM4/20/16
to VoiceAttack
Hi all. Just purchased, so I'm new to the software. Loving it so far!

Posting here because I need help with performing an action a variable number of times.

I'm trying to use it with video editing so I can stop having to remember the bazilions of keyboard shortcuts.

When scrubbing through footage, I (for example) can press the RIGHTARROW key to advance the timecode 1 second, so I made a command called SCRUB, which presses the right arrow key one time, when I say "scrub", which moves the frame forward one second in time. That part works fine.

Now I want to be able to say things such as

"SCRUB 120" and have VA realise that I want to advance 120 seconds, and execute my SCRUB command 120 times (ie 120 right arrow key presses),
"SCRUB 10" to advance 10 seconds etc...

and other similar commands eg BACK 120, BACK 10 etc.

Is this possible and if so, can some kind person please step me through how to do it?

Cheers
RJ



Message has been deleted

Jan P

unread,
Apr 20, 2016, 2:57:31 PM4/20/16
to VoiceAttack
Hi, maybe you can use this as a starting point:

https://groups.google.com/d/msg/voiceattack/CI1jLDToIFM/bZ9dLxkSym8J

RJS

unread,
Apr 20, 2016, 10:28:46 PM4/20/16
to VoiceAttack
Thanks. It seems like a starting point, but I was surprised how many commands were needed to cope with numbers up to 100.

Is there no way to have a keypress executed within a loop (or similar construct) and simply perform the loop the appropriate number of times?

Gary

unread,
Apr 21, 2016, 12:35:32 AM4/21/16
to VoiceAttack
Commands can be repeated a certain number of times by selecting the, 'this command repeats x times' option on the command screen.  Also, the release version allows for jumping to markers with conditions and the beta: http://www.voiceattack.com#getVA allows for conditional looping.  Also in the beta, there are dynamic commands with number ranges and tokens that allow you to strip out the numeric parts of commands.  Lots of different ways to skin the same cat.

Hope that helps!

Gary

Pfeil

unread,
Apr 21, 2016, 12:41:45 AM4/21/16
to VoiceAttack
The loop can work as such:

Marker: ScrubLoop
Begin Small Integer Compare : [ScrubCount] Does Not Equal 0
    Press Right key and hold for 0,06 seconds and release
    Set small int (condition) [ScrubCount] value as decremented by 1
    Jump to Marker: ScrubLoop
End Condition

If you set the SmallInt value "ScrubCount" to any value above 1 this will work. Now, in theory, this should work:

Set small int (condition) [ScrubCount] value to the converted value of {TXTNUM:'{CMD}'}

But it throws "Small integer token could not be converted : {TXTNUM:'{CMD}'}". I don't know why.

Either way, this still requires a command like "Scrub [1..120]" which will spawn a massive list of permutated commands that the speech engine has to deal with, so it's not ideal.

The alternative would be to use a wildcard and "{CMD_AFTER}", but then you get numbers as text ("one" instead of "1") that you need to deal with.

Hopefully this gives you some idea of the options, anyway.

Rod Smith

unread,
Apr 21, 2016, 9:50:01 AM4/21/16
to voice...@googlegroups.com
Gary,
Thanks for the reply, but I kinda feel you didn't get the specific thing I was asking for.

I'm aware that you can repeat a command x times, but as I mentioned, I need to repeat it a _variable_ number of times, rather than specifying a pre-determined number.

Also, when you speak about the 'release version', what do you mean? I have already purchased a key, if that's what you mean.

"lots of ways to skin a cat" as you say, but as I'm not a coder, I was hoping someone who knows VA well could give "specific steps/examples" on how to use dynamic commands etc to solve this particular problem.
Cheers,
RJ

--

---
You received this message because you are subscribed to a topic in the Google Groups "VoiceAttack" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/voiceattack/5GNcSLtH5_U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to voiceattack...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rod Smith

unread,
Apr 21, 2016, 10:01:27 AM4/21/16
to voice...@googlegroups.com
Pfeil,
I think I see what you're suggesting, but wont that also need lots of commands to cover each of the numbers between 1 and 120 (like the one Jan P attached)? And if so, I guess I'd be limited to using numbers in the range that's been pre-defined.

I'm starting to see that the thing i had in mind can't be done without pre-defining a command for each number in the range 1 .. n

I was hoping to be able to say something like:

"SCRUB (scrubcount)"

'where scrubcount is any spoken number' which we convert to an integer

then just have a loop, similar to what you suggest, decrementing by one each time until we jump out of the loop when the count reaches 0.

but I have no idea why the "Small integer token could not be converted : {TXTNUM:'{CMD}'}" error you describe is happening either...

if anyone knows how to fix this, any chance of an upload with a command set i can import, to see how it's done?

--

Pfeil

unread,
Apr 21, 2016, 12:10:13 PM4/21/16
to VoiceAttack
Yes, as I've said, it would need a command for every number(more accurately a recognised phrase for each number triggering the same command). The reason you'd want this is that the speech engine is much better in matching speech to a list of phrases, rather than freely interpreting what you're saying.



The alternative would be to use a wildcard and "{CMD_AFTER}", but then you get numbers as text ("one" instead of "1") that you need to deal with.

You can work around this by converting text to integers within the command using conditions:

Begin Text Compare : [{CMD_AFTER}] Equals 'One'
   
Set small int (condition) [ScrubCount] value to 1
Else If Text Compare : [{CMD_AFTER}] Equals 'Two'
   
Set small int (condition) [ScrubCount] value to 2
Else If Text Compare : [{CMD_AFTER}] Equals 'Three'
   
Set small int (condition) [ScrubCount] value to 3
Else If Text Compare : [{CMD_AFTER}] Equals 'Four'
   
Set small int (condition) [ScrubCount] value to 4
Else If Text Compare : [{CMD_AFTER}] Equals 'Five'
   
Set small int (condition) [ScrubCount] value to 5
Else If Text Compare : [{CMD_AFTER}] Equals 'Six'
   
Set small int (condition) [ScrubCount] value to 6
Else If Text Compare : [{CMD_AFTER}] Equals 'Seven'
   
Set small int (condition) [ScrubCount] value to 7
Else If Text Compare : [{CMD_AFTER}] Equals 'Eight'
   
Set small int (condition) [ScrubCount] value to 8
Else If Text Compare : [{CMD_AFTER}] Equals 'Nine'
   
Set small int (condition) [ScrubCount] value to 9
Else If Text Compare : [{TXTNUM:'{CMD_AFTER}'}] Does Not Equal ''
   
Make sure the value is a number at all
   
Set small int (condition) [ScrubCount] value to the converted value of {TXTNUM:'{CMD_AFTER}'}
End Condition


This makes the command work fine for "Scrub 1" to "Scrub 9". However, any number higher than that won't work because "{TXTNUM:'{CMD_AFTER}'}" doesn't seem to work.

In addition, this is where the weakness of the speech engine becomes clear; "Eight" can become "eighths", whereas "six" is often recognised as "sex". This may depend on engine training and the accuracy of your own pronunciation, but don't expect too much consistency.

Gary

unread,
Apr 23, 2016, 1:43:11 PM4/23/16
to VoiceAttack
Scrub [1..120] will create 120 commands, but if that profile has under, say, 10k commands it would probably be ok load-wise.  It would be way more accurate, as it is creating exact phrases to recognize (it's the balance we have to strike... either questionable accuracy or ungodly profile sizes).

I'll look at the {CMD_AFTER} issue with the wildcards.  Something else to consider in this case would be {TXTNUM}:

Set commandVariable to '{CMD}'
Set intVariable to converted value of {TXTNUM:commandVariable}    (TXTNUM currently only works on variables, so you have to do the curly shuffle here)

Loop intVariable times  (will require yet another variable for the loop)... (((('add variable to command screen repeat count' now on todo list)))
   Do something
End Loop

Hope that helps a bit!

Gary

Pfeil

unread,
Apr 23, 2016, 7:17:02 PM4/23/16
to VoiceAttack
Ah, I see.

Is there a way to tell which Tokens accept Tokens without testing every single one?

In the documentation, all I can see in that section related to Tokens is:

{TXTREPLACE:variableName} - This will return the text variable's value with the text indicated in from as to. For example: Token, 'myToken' value set to, 'This is a test'.

{TXTREPLACE:myToken:test:monkey} renders as 'This is a monkey'.


Which suggests Tokens can be used, except in this case "myToken", which is said to be a Token, is not in curly braces.

This section:


{TXTNUM:variableName} - This will attempt to remove all characters except numeric

(0-9, ., -).


Also lists the input as "variableName", like for many tokens, including {TXTREPLACE:} which does(As an exception?) supposedly work with Tokens.

I don't feel it's entirely clear.

Gary

unread,
Apr 23, 2016, 8:53:34 PM4/23/16
to VoiceAttack
I think the only tokens that really takes text are {EXP} and {TXTRANDOM} (not even sure why they are that way... must have seemed good at the time) .  The other tokens that take variable names could accept a token as the variable name.  However, the problem is that it all needs to be reworked to recursively process inner tokens, as what is happening right now is simple find and replace.  You just don't know which order the tokens are being replaced.  {EXP} is processed last, preceded by {TXTRANDOM}, but that still does not help with nested tokens contained in the value parameters.  It's in the higher end of the todo list.

I'll go back and fix the verbiage for the description of that token.  It's worded wrong.  The word, 'token' should be, 'variable'. Thanks for finding that ;)


Gary

Rod Smith

unread,
Apr 24, 2016, 12:20:31 AM4/24/16
to voice...@googlegroups.com
'add variable to >command screen repeat count'

Yes, this! Seems this is the ideal way to handle this kind of situation. Thanks for adding it to the to-do list. Looking forward to seeing it in there are some point in the future :)

Gary

unread,
Apr 24, 2016, 4:46:43 PM4/24/16
to VoiceAttack
This can be done now, but you'll need to use the beta and use a loop:

Set int variable myInt to 0

Loop while myInt < 120
   
   Do stuff here

   Set myInt to Increment myInt by 1

End Loop
To unsubscribe from this group and all its topics, send an email to voiceattack+unsubscribe@googlegroups.com.

Rod Smith

unread,
May 25, 2016, 5:54:52 AM5/25/16
to VoiceAttack
Sorry for the delay replying. This sounds great! How do I go about getting the beta? And any idea when this will make it into the release version? I'm using 1.5.8 and the 'check for updates' tells me it's the current version.

Gary

unread,
May 25, 2016, 12:26:00 PM5/25/16
to VoiceAttack
The beta can be found here:  http://www.voiceattack.com/beta

I don't have an ETA on the release just yet.  Still fixing and creating problems ;)  Also, the, 'check for updates' is only checking for release versions (otherwise there would be a meltdown).

Hope that helps!

Gary
To unsubscribe from this group and all its topics, send an email to voiceattack+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to a topic in the Google Groups "VoiceAttack" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/voiceattack/5GNcSLtH5_U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to voiceattack+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages