ec_setparm( )
Cautions | Example | Errors | See Also
Description
The ec_setparm( ) function configures the parameter of an open device that supports Continuous Speech Processing (CSP). This function sets one parameter value at a time on an open channel.
The same parameter IDs are available for ec_setparm( ) and ec_getparm( ).
The eclib.h contains definitions (#define) for these parameter IDs. All ec_setparm( ) parameter IDs have default values. If you don't use ec_setparm( ) to change the parameter values, the default values are used.
The following summarizes the parameter IDs and their purpose. The defines for parameter IDs are described in more detail following this table, in alphabetical order.
DXBD_RXBUFSIZE
(SpringWare boards only)
Bytes: 2
Default: 512
Attribute: R/W
Units: bytes
Range: 128-512For SpringWare boards only. These buffers are used to transfer data between the firmware and the driver.
For more information on setting buffer sizes, see the Continuous Speech Processing API Programming Guide.Note: Decreasing the size of the buffers increases the number of interrupts between the host application and the board, thereby increasing the load on both the host and on-board control processors.
Note: To modify the default value of 512, you must edit the voice.prm file. For details, see the installation and configuration guide.
DXBD_TXBUFSIZE
(SpringWare boards only
) Bytes: 2
Default: 512
Attribute: R/W
Units: bytes
Range: 128-512For SpringWare boards only. Sets the size of the firmware transmit (or play) buffers in shared RAM. These buffers are used to transfer data between the firmware and the driver.
Be sure that all channels on the board are idle before using this parameter; otherwise, unpredictable behavior may result.
For more information on setting buffer sizes, see the Continuous Speech Processing API Programming Guide.Note:Decreasing the size of the buffers increases the number of interrupts between the host application and the board, thereby increasing the load on both the host and on-board control processors.
Note: To modify the default value of 512, you must edit the voice.prm file. For details, see the installation and configuration guide.
DXCH_BARGEIN
Bytes: 2
Default: 0
Attribute: R/W
Values: 0 or 1Enables or disables barge-in in the application during prompt play when a CSP-supported data format is used. For a list of supported data formats, see the Continuous Speech Processing API Programming Guide.
The value 1 turns the feature on, and 0 turns the feature off.
DXCH_BARGEINONLY
Bytes: 2
Default: 1
Attribute: R/W
Values: 0 or 1Enables or disables generation of TDX_BARGEIN and TDX_PLAY events when a barge-in condition occurs. See Chapter, Events for a list of events.
The value 0 enables generation of both TDX_BARGEIN and TDX_PLAY events. (In doing so, you receive the TDX_PLAY event upon barge-in and can simply ignore the TDX_BARGEIN event in your playback state machine.)Note: When playing a prompt in synchronous mode, you must set DXCH_BARGEINONLY to 0.
The value 1, the default, enables generation of TDX_BARGEIN event only.
This parameter does not affect the setting of barge-in itself; see DXCH_BARGEIN.
DXCH_EC_TAP_LENGTH
(for SpringWare boards)
Bytes: 2
Default: 48
Attribute: R/W
Units: 0.125 ms
Values: 48 to 128For SpringWare boards. Specifies the tap length for the echo canceller. The longer the tap length, the more echo is cancelled from the incoming signal. However, this means more processing power is required.
The default value is 48 taps which corresponds to 6 ms. One tap is 125 microseconds (0.125 ms).Note: To use CSP in ASR applications, set this value to 128 taps (16 ms).
Note: If you use this parameter, you must specify this parameter BEFORE any other CSP parameter. Any time you specify DXCH_EC_TAP_LENGTH, other CSP parameters are reset to their default values.
Note: Do not specify ECCH_ECHOCANCELLER and DXCH_EC_TAP_LENGTH in your application for the same stream. Each parameter resets the other to its default value.
DXCH_EC_TAP_LENGTH
(for DM3 boards)
Bytes: 2
Default: 128
Attribute: R/W
Units: 0.125 ms
Value: 128For DM3 boards. Specifies the tap length for the echo canceller. The longer the tap length, the more echo is cancelled from the incoming signal. However, this means more processing power is required.
The default value is 128 taps which corresponds to 16 ms. This value can not be modified.DXCH_SPEECHNONPLAYTHRESH
(SpringWare boards only)
Bytes: 2
Default: -40
Attribute: R/W
Units: decibel milliwatts (dBm)
Range: +3 to -54 dBmSupported on SpringWare boards only. Specifies the minimum energy level of incoming speech necessary to trigger the voice activity detector. This value is used when a prompt has completed playing. You must supply the plus or minus sign with this value. DXCH_SPEECHNONPLAYTRIGG (SpringWare boards only)
Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 12 ms blocks
Range: 5-10Supported on SpringWare boards only. Specifies the number of 12 ms blocks whose speech energy is greater than the speech threshold required to trigger the voice activity detector (VAD). This value is used when a prompt has completed playing.
Note: This value must be less than or equal to the value of DXCH_SPEECHNONPLAYWINDOW.
DXCH_SPEECHNONPLAYWINDOW
(SpringWare boards only)
Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 12 ms blocks
Range: 5-10Supported on SpringWare boards only. Specifies the number of 12 ms blocks or frames which are surveyed to detect speech energy. This value is used when a prompt has completed playing.
Note: This value must be greater than or equal to the value of DXCH_SPEECHNONPLAYTRIGG.
DXCH_SPEECHPLAYTHRESH
Bytes: 2
Default: -40
Attribute: R/W
Units: decibel milliwatts (dBm)
Range: +3 to -54Specifies the minimum energy level of incoming speech necessary to trigger the voice activity detector. This value is used while a prompt is playing. You must supply the plus or minus sign with this value.
For more information on modifying these voice activity detector parameters, see the Continuous Speech Processing API Programming Guide.
On DM3 boards, specifying this parameter means that the VAD uses energy mode to determine the start of speech. For the VAD to use a combination of zero-crossing mode and energy mode, do not use this parameter; rather, set the ECCH_SVAD parameter to 0. In this case, the threshold value is set automatically by the VAD.Note: On SpringWare boards and DM3 boards, you can modify this parameter while recording or streaming is active.
DXCH_SPEECHPLAYTRIGG
(for SpringWare boards)
| Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 12 ms blocks
Range: 5-10
For SpringWare boards. Specifies the number of 12 ms blocks whose speech energy is greater than the speech threshold required to trigger the voice activity detector. This value is used while a prompt is playing.
Note: This value must be less than or equal to the value of DXCH_SPEECHPLAYWINDOW.
Note: You can modify this parameter while recording or streaming is active.
DXCH_SPEECHPLAYTRIGG
(for DM3 boards)
Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 10 ms blocks
Range: 5-10For DM3 boards. Specifies the number of 10 ms blocks whose speech energy is greater than the speech threshold required to trigger the voice activity detector. This value is used while a prompt is playing.
Note: This value must be less than or equal to the value of DXCH_SPEECHPLAYWINDOW.
Note: You can modify this parameter while recording or streaming is active.
DXCH_SPEECHPLAYWINDOW
(for SpringWare boards)
Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 12 ms blocks
Range: 5-10For SpringWare boards. During the playing of a prompt, this parameter specifies the number of 12 ms blocks or frames which are surveyed to detect speech energy.
Note: This value must be greater than or equal to the value of DXCH_SPEECHPLAYTRIGG.
Note: You can modify this parameter while recording or streaming is active.
DXCH_SPEECHPLAYWINDOW
(for DM3 boards)
Bytes: 2
Default: 10
Attribute: R/W
Units: integer of 10 ms blocks
Range: 5-10For DM3 boards. During the playing of a prompt, this parameter specifies the number of 10 ms blocks or frames which are surveyed to detect speech energy.
Note: This value must be greater than or equal to the value of DXCH_SPEECHPLAYTRIGG.
Note: You can modify this parameter while recording or streaming is active.
DXCH_SPEECHSNR
Bytes: 2
Default: -12
Attribute: R/W
Units: decibels (dB)
Range: 0 to -20 dBSpecifies the reciprocal of the signal to noise ratio (SNR) between the incoming speech energy and the estimated residual noise at the output of the echo canceller circuit.
SNR is the relationship of the magnitude of a transmission signal to the noise of a channel. It is a measurement of signal strength compared to error-inducing circuit noise.
In environments where the incoming signal is weak or has residual noise, you may want to adjust this value higher to reduce noise in the signal.
You must supply the minus sign with this value.Note: You can modify this parameter while recording or streaming is active.
ECCH_ADAPTMODE
(SpringWare boards only)
Bytes: 2
Default: 0
Attribute: R/W
Values: 0 or 1Supported on SpringWare boards only. Specifies the adaptation mode of operation for the echo canceller.
The echo canceller uses two operating modes, fast mode and slow mode. Regardless of the parameter value, the echo canceller always starts in fast mode (higher automatic gain factor) after it is reset, then switches to a slow mode (lower automatic gain factor).
When this parameter is set to 0, two factors are used in determining the switch from fast to slow mode: (1) Echo Return Loss Enhancement (ERLE) and (2) adaptation time.
When this parameter is set to 1, only the adaptation time factor is used. For more information on the echo canceller and adaptation mode, see the Continuous Speech Processing API Programming Guide.ECCH_ECHOCANCELLER
Bytes: 2
Default: 1
Attribute: R/W
Values: 0 or 1Enables or disables the echo canceller in the application.
The value 1 turns on the echo canceller, and the value 0 turns it off.Note: Because the echo canceller is enabled by default, you do not need to use this parameter to turn on the echo canceller in your application. Only use this parameter to turn off the echo canceller. You may want to turn off the echo canceller for evaluation purposes.
Note: For SpringWare boards, if you use this parameter, you must specify this parameter BEFORE any other CSP parameter. Any time you specify ECCH_ECHOCANCELLER, the tap length and other parameters are reset to their default values.
Note: For SpringWare boards, do not specify ECCH_ECHOCANCELLER and DXCH_EC_TAP_LENGTH in your application for the same stream. Each parameter resets the other to its default value.
ECCH_NLP
Bytes: 2
Default: 0
Attribute: R/W
Values: 0 or 1Turns non-linear processing (NLP) on or off. The value 0 (not 1) turns on the NLP feature, and 1 (not 0) turns it off.
NLP refers to comfort noise; that is, a background noise used in dictation applications to let the user know that the application is working.
For ASR applications, you must turn this feature off; that is, set ECCH_NLP = 1.ECCH_SVAD (DM3 boards only)
Bytes: 2
Default: 0
Attribute: R/W
Values: 0 or 1Supported on DM3 boards only. Specifies how the voice activity detector (VAD) detects the start of speech.
The value 0, the default, means that the VAD uses a combination of energy and zero-crossing mode (where energy level goes to zero for a time period) to determine the start of speech. The threshold is determined automatically by the VAD.
The value 1 means that the VAD uses energy mode only and the threshold value is set by the DXCH_SPEECHPLAYTHRESH parameter.ECCH_VADINITIATED
Bytes: 2
Default: 1
Attribute: R/W
Values: 0 or 1Enables or disables voice-activated record in the application. If enabled, recording or streaming of echo-cancelled data to the host application begins only after speech is detected.
The value 1 turns the feature on, and 0 turns the feature off.ECCH_XFERBUFFERSIZE
(for SpringWare boards)
Bytes: 2
Default: 16 kbytes
Attribute: R/W
Units: bytes
Range: 128 bytes to 16 kilobytes (in multiples of 128)For SpringWare boards. The size of the driver buffers on the receive side of a CSP-capable full-duplex channel. These buffers are used to transfer data between the driver and the host application.
This value is configurable per channel at run-time.
For voice-mail applications, the default of 16 kbytes is sufficient.
For ASR applications, you may need to set the buffer size lower to improve real-time processing and reduce latency. For more information on setting buffer sizes, see the Continuous Speech Processing API Programming Guide.Note: The smaller the buffer size, the more interrupts are generated to handle the buffers, and consequently the greater the system load.
In Linux, this parameter has limitations. The possible values are 1, 2, 4, 8 and 16 kbytes. By default, the amount of data passed to the user-defined callback function is fixed at 16 kbytes. You can only override this default per process by calling ec_setparm( ) BEFORE opening a channel: int size = 1024; /* or 2, 4, 8, 16 kbytes */...ec_setparm(SRL_DEVICE, ECCH_XFERBUFFERSIZE, &size)
Note: You must use SRL_DEVICE as the device name.
For more information on buffers and data flow, see the Continuous Speech Processing API Programming Guide.
ECCH_XFERBUFFERSIZE
(for DM3 boards)
Bytes: 2
Default: 16
kbytes
Attribute: R/W
Units: bytes
Range: 240 bytes to 16 kbytesFor DM3 boards. The size of the host application buffers on the receive side of a CSP-capable full-duplex channel. These buffers are used to transfer data between the firmware and the host application.
On DM3, the firmware buffer size is adjusted based on the value of ECCH_XFERBUFFERSIZE (the transfer buffer).
If the transfer buffer is less than or equal to 2 kbytes, then the firmware buffer is set to the same size as the transfer buffer.
If the transfer buffer is greater than 2 kbytes, then the firmware buffer is set to 2 kbytes. The content of multiple firmware buffers is accumulated in the transfer buffer before being written to file or provided to the application callback function.
The firmware buffer size cannot be greater than 2 kbytes.
This value is configurable per channel at run-time.
For ASR applications, you will need to set the buffer size lower to improve real-time processing and reduce latency.Note: The smaller the buffer size, the more interrupts are generated to handle the buffers, and consequently the greater the system load.
Cautions
- You must pass the value of the parameter to be set in a variable cast as (void *) as shown in the example.
- Before you use ec_setparm( ), the channel must be open.
- Certain parameters can be modified while an ec_reciottdata( ) or ec_stream( ) is in progress. These parameters are: DXCH_SPEECHPLAYTHRESH, DXCH_SPEECHPLAYTRIGG, DXCH_SPEECHPLAYWINDOW, DXCH_SPEECHSNR, ECCH_SVAD.
- In Linux applications that use multiple threads, you must avoid having two or more threads call functions that send commands to the same channel; otherwise, the replies can be unpredictable and cause those functions to time out. If you must do this, use semaphores to prevent concurrent access to a particular channel.
Example
#include <windows.h> /* include in Windows applications only; exclude in Linux */ #include <stdio.h> #include <srllib.h> #include <dxxxlib.h> #include <eclib.h> #include <errno.h> /* include in Linux applications only; exclude in Windows */ main() { int chdev, parmval; int srlmode; /* Standard Runtime Library mode */ /* Set SRL to run in polled mode. */ srlmode = SR_POLLMODE; if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) { /* process error */ } /* Open the board and get channel device handle in chdev */ if ((chdev = dx_open("dxxxB1C1",0)) == -1) { /* process error */ } /* Set up parameters */ /* Enable barge-in for this channel */ parmval = 1; if (ec_setparm(chdev, DXCH_BARGEIN, (void *)&parmval) == -1) { /* process error */ } /* Set up additional parameters as needed */ . . . }Errors
If the function returns -1, use ATDV_LASTERR( ) to return the error code and ATDV_ERRMSGP( ) to return a descriptive error message.
One of the following error codes may be returned:
See Also
- ec_getparm( )
- dx_getparm( )
- dx_setparm( )
Click here to contact Dialogic Customer Engineering
Copyright 2001, Intel Corporation