Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

vc

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 following examples show how to start voice coding for a maximum of 60 seconds using the ADPCM32 coding type and no automatic gain control:

load(int.CODETYPE, ADPCM32)
or(int.CODETYPE, NO_AGC)
vc(`b', 60, int.CODETYPE)

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.

Examples

In the following example, a beep sounds, then a phrase is coded for a maximum of 100 seconds using ADPCM at a rate of 32Kbps.

load (int.TIME,100)
vc ('p',int.TIME,ADPCM32)

In the following example, a phrase is coded for a maximum of 120 seconds using sub-band coding at a rate of 16Kbps. No beep sounds.

load(short.RATE,SBC16)
vc('b',120,short.RATE)

In the following example, the vc() instruction uses the optional wait_flag argument to allow voice coding and recognition at the same time.

#include "irDefines.h"
#include "/att/include/codestyle.h"
/* Answer phone */
tic('a')
/* Reserve a phrase */
phreserve(65535, 103, 20, ADPCM32)
jmp(r.0 < 0, L__quit)
load(int.PHRASE, r.1) /* phrase id */
load(int.TFILE, r.0) /* talk file number */
/* Play prompt. Must play prompt before voice coding
* is started. Coding and playing cannot be done
* simultaneously. This means that barge-in can't be
* done while coding and recognizing simultaneously.
*/
talk("5")
tflush(1)


/* no silence timeouts (or, silence timeouts must be
* significantly greater than getinput timeouts)
*/
vctime(0, 0)
/* set input timouts */
tttime(5, 5)
/* start coding with no wait.
*/
vc('b', 20, ADPCM32, 0)
/* get recognition input form caller. */
recog_start(IRD_WHOLE_WORD, US_4dig, 0)
getinput(ch.CI_VALUE, 4)
load(int.NUM_DIGS_GOT, r.0)
/* stop voice coding and wait for code complete*/
tstop(1)
/* return vales from tstop() are the same as for vc().
*/
load(int.PHRASE, r.0 )
load(int.LENGTH, r.1 )
load(int.STATUS, r.2 )
L__quit:
quit()

See also

� 2002 Avaya Inc. All Rights Reserved.