Prosody speech processing: API: sm_listen_for

Prototype Definition

int sm_listen_for(struct sm_listen_for_parms *listenp)

Parameters

*listenp
a structure of the following type:
typedef struct sm_listen_for_parms {
	tSMChannelId channel;					/* in */
	enum kSMToneDetection {
		kSMToneDetectionNone,
		kSMToneDetectionNoMinDuration,
		kSMToneDetectionMinDuration64,
		kSMToneDetectionMinDuration40,
		kSMToneEndDetectionNoMinDuration,
		kSMToneEndDetectionMinDuration64,
		kSMToneEndDetectionMinDuration40,
		kSMToneLenDetectionNoMinDuration,
		kSMToneLenDetectionMinDuration64,
		kSMToneLenDetectionMinDuration40,
		kSMToneDetectionAsListenFor,
	} tone_detection_mode;					/* in */
	tSM_INT active_tone_set_id;				/* in */
	enum kSMDigitMapping {
		kSMNoDigitMapping,
		kSMDTMFToneSetDigitMapping,
	} map_tones_to_digits;					/* in */
	tSM_INT enable_cptone_recognition;			/* in */
	tSM_INT enable_grunt_detection;				/* in */
	tSM_INT grunt_latency;					/* in */
	double min_noise_level;					/* in */
	double grunt_threshold;					/* in */
	tSM_UT32 grunt_holdoff;					/* in */
} SM_LISTEN_FOR_PARMS;

Description

This call controls the simple tones, call-progress tones and digits that may be recognised on the specified channel channel.

It may be called at any time to alter the tone and digit recognition properties for a particular channel.

Contact Aculab technical support for details of an application library which can detect pulse-dialled digits.

The parameters tone_detection_mode and active_tone_set_id determine if and by what criteria simple tones are recognised on the input channel. If tone detection is enabled then any simple tone that occurs on the channel and that meets the recognition criteria will be notified to the application.

In order to be recognised, a tone must be a member of the input tone set active_tone_set_id (see Prosody speech processing: pre-loaded input tones for predefined tone sets, and sm_add_input_tone_set() for application defined tone sets). It must also fulfil the criteria for the specified mode (see Prosody speech processing: pre-loaded input tones for more details).

When a tone is recognised, the recognition event associated with the channel is set and the application can then retrieve a tone identifier for the recognised tone by calling sm_get_recognised(). However if map_tones_to_digits is set to a value of kSMDTMFToneSetDigitMapping then when a tone occurs on the channel corresponding to a DTMF digit, sm_get_recognised() reports the digit directly, with the mapping between DTMF tones and DTMF digits already done.

If enable_cptone_recognition is set to a non-zero value, then any call-progress tone that occurs on the channel and that corresponds to a member of set of call-progress tones currently recognisable by the module will be notified to the application. See Prosody speech processing: pre-loaded call-progress tones, for a list of default set of call-progress tones recognisable by the module. To alter the default set of recognisable call-progress tones, see the calls sm_reset_input_cptones() and sm_add_input_cptone().

Note that call-progress tone detection may not be used simultaneously with tone or digit detection on the same channel.

If enable_grunt_detection is set to a non-zero value, then the application will be notified when the signal energy on the input channel goes above an adaptive threshold, which is grunt_threshold above the estimated ambient background noise level. The application will be notified again when this signal burst ends. The grunt_latency parameter, if non-zero, enables holding back of the "end of grunt" notification by grunt_latency milliseconds so if the signal restarts during this period, a premature "end of grunt" notification is not given. The grunt detection algorithm makes the assumption that there is activity on the line at initialisation. Therefore, the first notification will always be an "end of grunt". If the line is silent when grunt detection is enabled, an "end of grunt" notification will happen within grunt_latency milliseconds from the start. For natural speech grunt_latency should be set to 1000 milliseconds or longer.

If a recognition event has been previously associated with channel (see sm_channel_set_event()), then the driver will notify the application with that event whenever one of the above is recognised on the input channel.

Fields

channel
The channel on which to listen.
tone_detection_mode
The tone detection to enable, if any. If a tone detection is to be used, the module td must have been downloaded. One of these values:
kSMToneDetectionNone
Simple tones never recognised.
kSMToneDetectionNoMinDuration
Simple tone detection enabled, no minimum period. If the correct frequencies are detected with the correct signal to noise ratio, twist, etc. for however short a duration, the tone is considered to be present and is recognised.
kSMToneDetectionMinDuration64
Simple tone detection enabled, tone must be valid for minimum period to be detected. If the tone is valid for 64mS it will definitely be detected. Tones of shorter duration between 32mS and 64mS may be detected but cannot be guaranteed. The minimum duration of a tone can be increased by setting the parameter kAdjustToneSetIntParamIdMinOnTime with sm_adjust_input_tone_set().
kSMToneDetectionMinDuration40
This mode uses a slightly more complex algorithm for analysing duration of a valid tone, and enables robust detection of tones with duration as short as 40mS.
kSMToneEndDetectionNoMinDuration
This mode is like kSMToneDetectionNoMinDuration but application notified when end of tone detected.
kSMToneEndDetectionMinDuration64
This mode is like kSMToneDetectionMinDuration64 but application notified when end of tone detected.
kSMToneEndDetectionMinDuration40
This mode is like kSMToneDetectionMinDuration40 but application notified when end of tone detected.
kSMToneLenDetectionNoMinDuration
This mode is like kSMToneEndDetectionNoMinDuration but returns additional tone duration information to application.
kSMToneLenDetectionMinDuration64
This mode is like kSMToneEndDetectionMinDuration64 but returns additional tone duration information to application.
kSMToneLenDetectionMinDuration40
This mode is like kSMToneEndDetectionMinDuration40 but returns additional tone duration information to application.
kSMToneDetectionAsListenFor
This mode is only valid when specified in the parameters for sm_record_start() and a tone detection mode is currently active on the same channel, started by sm_listen_for(). Any tones detected on the same channel as the recording will be eliminated from the recorded data.
active_tone_set_id
The tone set for tone detection.
map_tones_to_digits
Indicator of whether tone detection should convert the result into a digit or not. One of these values:
kSMNoDigitMapping
Report tone IDs.
kSMDTMFToneSetDigitMapping
Report tones as digit codes.
enable_cptone_recognition
Indicator of whether detection of call-progress tones is to be enabled (non-zero) or not (zero).
enable_grunt_detection
Indicator of whether grunt detection is to be enabled (non-zero) or not (zero). If enabled, this requires the module grunt to have been downloaded.
grunt_latency
The duration of silence (in mS) required before a signal is considered to be silent.
min_noise_level
The minimum level, in dBm0, that the noise estimate of the grunt detector may reach. The default is -55 dBm0. Only used if enable_grunt_detection is non zero. Requires the module grunt.
grunt_threshold
The threshold, in dB, above the noise estimate of the grunt detector at which a signal is considered present. The default is 15 dB. Only used if min_noise_level is non zero. Requires the module grunt.
grunt_holdoff
The period, in ms, following start of speech, to disable updating the estimate of the background noise energy (a non-zero period, typically 1000ms, can be required when long periods of uninterrupted speech are expected). Requires the module grunt.

Returns

0 if call completed successfully, otherwise a standard error such as:


This function is part of the Prosody speech processing API.