Integration Steps
1. Configure the Authorization File config.txt
Fill in the appID and appSecret provided by the business.
appId=xxxxxxx
appSecret=xxxx2. Run the Demo to Confirm if the SDK Complies with System Architecture Standards
- windows: Run run.bat
- linux: Run soe.sh
If it cannot run or an exception error occurs, please contact the support personnel directly.
3. Check the c_demo.c File to View the Specific Calling Logic
- audio/: Audio and text used during testing
- lib/*.so: Contains runtime dynamic link libraries
- config.txt: Configuration authorization information
4. Other Configurations (Optional)
-
Configure API address Call the
setServerAPI(host)method. For example:setServerAPI('api.xxxxx.com') -
Configure internationalization language (i.e., language for error messages) Call the
setI18n(lang)method. For example:setI18n('en')
5. Calling Steps
Parameter Description
| Parameter Name | Type | Description | Default Value |
|---|---|---|---|
| langType | String | Language option, English: en-US Japanese:ja-JP | Required |
| format | String | Audio format, currently supports wav/mp3 | Required |
| sampleRate | int | Audio sample rate (Hz), currently only supports 16000 | Required |
| looseness | int | Scoring leniency, range: 0-9, the higher the value, the more looser | 4 |
| connectTimeout | int | Connection timeout (seconds), range: 5-60 | 15 |
| responseTimeout | int | Response timeout (seconds), range: 5-60 | 15 |
| scale | int | Scoring system, range: 1-100 | 100 |
| ratio | float | Scoring adjustment coefficient, range: 0.8-1.5 up to 3 decimal places | 1 |
| paramsJson | string | Evaluation parameters, refer to the question type parameter section in DolphinSOE Question Type Documentation | Required |
| userId | string | userId | None |
| evaluateMode | int | Online evaluation value 1 | Required |
| maxPrefixSilenceMs | int | Threshold for detecting initial silence in voice input (milliseconds), range [0-30000]. A Warning event is returned if the duration of silence exceeds this threshold after recording starts. If the parameter value is set to 0 or the parameter is not provided, the initial silence detection feature is not enabled. | 0 |
| maxSuffixSilenceMs | int | Threshold for detecting trailing silence in voice input (milliseconds), range [0-30000]. The evaluation automatically ends if the duration of silence at the end of the sentence exceeds this threshold. If the parameter value is set to 0 or the parameter is not provided, the trailing silence detection feature is not enabled. | 0 |
| connti | int | Whether to enable detection of connected speech and missing bursts, default is 0, only for English When connti is 0, it is not enabled When connti is 1, it is enabled | 0 |
| mini | int | Default is 0, returns full data, when set to 1, only returns simplified data (total score, fluency, accuracy, completeness, etc.) | 0 |
| precision | string | Set scoring precision, default is 0, supports only 0, 0.1, 0.25, 0.5, 1. If the set value is not one of these, it is treated as 0 | 0 |
- Set the parameters to the Params structure and pass them into start.
- If required parameters are missing or exceed the range, they will return error codes and messages in
onError. - If optional parameters are missing, default values will be taken; if values exceed the range, default values will be taken, and warnings will be returned in
onWarning. - When passing wav audio, you need to read audio data multiple times and call feed multiple times; when passing mp3 audio, you need to read all file data at once and call feed.
For specific call example code, please refer to c_demo.c
Interface Documentation
start
| Function Prototype | char* start(char* appId, char* appSecret, struct Params* cParams, void* userData, onStartSuccess startSuccess, onResult result, onWarning warning, onError error); |
|---|---|
| Description | Start evaluation |
| Input Parameters | appId appSecret params: Evaluation parameters, refer to Parameter DescriptionuserData: User data startSuccess: Start success callback, need to send audio data in the callback result: Evaluation result callback warning: warning callback error: error callback |
| Return Value | Connection ID string |
| Usage Instructions | Start evaluation |
feed
| Function Prototype | void feed(char* connId, char* data, int length) |
|---|---|
| Description | Send audio data |
| Input Parameters | connId: Connection ID data: Audio data length: Data length |
| Return Value | None |
| Usage Instructions | Call multiple times after starting the evaluation |
stop
| Function Prototype | void stop(char* connId) |
|---|---|
| Description | Stop evaluation |
| Input Parameters | connId |
| Return Value | None |
| Usage Instructions | Stop evaluation |
onStartSuccess
| Function Prototype | void onStartSuccess(void* userData) |
|---|---|
| Description | Connection service successful callback |
| Input Parameters | userData: User data |
| Return Value | None |
| Usage Instructions | Callback method, passed into start |
onResult
| Function Prototype | void onResult(void* userData, const char *msg) |
|---|---|
| Description | Evaluation result callback |
| Input Parameters | userData: User data msg: Scoring data |
| Return Value | None |
| Usage Instructions | Callback method, passed into start |
onWarning
| Function Prototype | void onWarning(void* userData, const char *code, const char *msg) |
|---|---|
| Description | Warning callback |
| Input Parameters | userData: User data code: Error code msg: Error message |
| Return Value | None |
| Usage Instructions | Callback method, passed into start |
onError
| Function Prototype | void onError(void* userData, const char *code, const char *msg) |
|---|---|
| Description | Error callback |
| Input Parameters | userData: User data code: Error code msg: Error message |
| Return Value | None |
| Usage Instructions | Callback method, passed into start |
Response Results
Refer to the evaluation result section in DolphinSOE Question Type Documentation.
Status Code Table
Please refer to the Status Code document.
Frequently Asked Questions
- What audio formats are supported by voice evaluation?
Supports mp3, wav, and pcm. However, for mp3 format, you need to input the entire file at once (i.e., call feed once).
- Error codes and related solutions
For an introduction to error codes, please check the Status Code document.
- Supported question types, text, audio duration limit, result, and the meaning of each field
For supported question types, text, and audio duration limits, please check the Question Type document and Parameter Introduction document.
- Why is there no audio URL in the return result, or why is the audio URL empty?
For online evaluation, you need to pass audioUrl=true before the evaluation, then the audioUrl will be returned in the result.
- How long is the evaluation audio address stored?
Audio is retained for 30 days by default, it is recommended to download it to your server for long-term preservation.