Docs menu
Docs

Linux / Windows SDK

View Markdown

Integration Steps

1. Configure the Authorization File config.txt

Fill in the appID and appSecret provided by the business.

appId=xxxxxxx
appSecret=xxxx

2. 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 NameTypeDescriptionDefault Value
langTypeStringLanguage option, English: en-US
Japanese:ja-JP
Required
formatStringAudio format, currently supports wav/mp3Required
sampleRateintAudio sample rate (Hz), currently only supports 16000Required
loosenessintScoring leniency, range: 0-9, the higher the value, the more looser4
connectTimeoutintConnection timeout (seconds), range: 5-6015
responseTimeoutintResponse timeout (seconds), range: 5-6015
scaleintScoring system, range: 1-100100
ratiofloatScoring adjustment coefficient, range: 0.8-1.5 up to 3 decimal places1
paramsJsonstringEvaluation parameters, refer to the question type parameter section in DolphinSOE Question Type DocumentationRequired
userIdstringuserIdNone
evaluateModeintOnline evaluation value 1Required
maxPrefixSilenceMsintThreshold 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
maxSuffixSilenceMsintThreshold 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
conntiintWhether 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
miniintDefault is 0, returns full data, when set to 1, only returns simplified data (total score, fluency, accuracy, completeness, etc.)0
precisionstringSet 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 00
  • 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 Prototypechar* start(char* appId, char* appSecret, struct Params* cParams, void* userData, onStartSuccess startSuccess, onResult result, onWarning warning, onError error);
DescriptionStart evaluation
Input ParametersappId
appSecret
params: Evaluation parameters, refer to Parameter Description
userData: 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 ValueConnection ID string
Usage InstructionsStart evaluation

feed

Function Prototypevoid feed(char* connId, char* data, int length)
DescriptionSend audio data
Input ParametersconnId: Connection ID
data: Audio data
length: Data length
Return ValueNone
Usage InstructionsCall multiple times after starting the evaluation

stop

Function Prototypevoid stop(char* connId)
DescriptionStop evaluation
Input ParametersconnId
Return ValueNone
Usage InstructionsStop evaluation

onStartSuccess

Function Prototypevoid onStartSuccess(void* userData)
DescriptionConnection service successful callback
Input ParametersuserData: User data
Return ValueNone
Usage InstructionsCallback method, passed into start

onResult

Function Prototypevoid onResult(void* userData, const char *msg)
DescriptionEvaluation result callback
Input ParametersuserData: User data
msg: Scoring data
Return ValueNone
Usage InstructionsCallback method, passed into start

onWarning

Function Prototypevoid onWarning(void* userData, const char *code, const char *msg)
DescriptionWarning callback
Input ParametersuserData: User data
code: Error code
msg: Error message
Return ValueNone
Usage InstructionsCallback method, passed into start

onError

Function Prototypevoid onError(void* userData, const char *code, const char *msg)
DescriptionError callback
Input ParametersuserData: User data
code: Error code
msg: Error message
Return ValueNone
Usage InstructionsCallback 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

  1. 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).

  1. Error codes and related solutions

For an introduction to error codes, please check the Status Code document.

  1. 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.

  1. 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.

  1. 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.