The vc instruction codes a phrase and stores it in a talkfile.
Synopsis
vc(flag,type.time,type.rate [, wait_flag ])
Description
The vc instruction codes speech into a phrase in a talkfile. For the flag.type argument, 'b' (for begin coding) is accepted. Another character value, 'p' (for prompt) may be used with the speech resource to play a short beep just before voice coding starts. Note that this beep must be included in the prompt, either as a separate phrase or as part of the phrase.
The type.time argument specifies the maximum duration, in seconds, of the coding session. A value n for type.time specifies a coding session lasting up to n seconds. A value of -1 or 0 for type.time specifies the default maximum duration of 45 seconds. Coding can be terminated at any time by entering a touch tone.
The type.rate argument specifies the coding rate in kilobits per second. The valid coding types and rates are defined in the header file codestyle.h. If the value given for this argument is not a valid rate or type, the instruction fails. In addition to coding types, two modifiers are defined in codestyle.h that can be used to turn off silence trimming (NO_SIL) and automatic gain control (NO_AGC) during voice coding. To use these features, the corresponding modifier must be ORed together with the coding type.
The default value for the optional wait_flag argument is 1, which causes vc() to return when voice coding is complete. If this argument is used with a value of 0, vc() returns immediately after voice coding has started, allowing the script to execute more instructions while doing voice coding. This is useful for doing voice coding and speech recognition (with the getinput() instruction) simultaneously. The script can record what the caller is saying while it is being recognized.
When voice coding is started without waiting for completion, vc() returns a value of 0 in register 0 (r.0). Voice coding must be stopped at a later time by the tstop() instruction with the optional wait_flag argument set to1 to get the return values (r.0, r,1, and r.2) from the completed voice coding.
If the vc instruction is successfully completed, it returns the phrase id in register 0. If the vc instruction is not successfully completed, it returns a negative value in register 0. A -1 in register 0 means coding failed, -2 means the initial silence timeout set by vctime was exceeded. When voice coding is started without waiting for completion, vc() returns a value of 0 in register 0. Register 1 contains the recorded message length in seconds. Register 2 is set to 1 if coding completes normally, 2 if coding is terminated by touch tone, and 3 if the intermediate silence timeout set by vctime is exceeded.
See also