# Linux / Windows SDK

> Fill in the appID and appSecret provided by the business.

Source: https://soe.dolphinvoice.ai/en/docs/sdk/linux

## Integration Steps

### 1. Configure the Authorization File config.txt

Fill in the appID and appSecret provided by the business.

```txt
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

![](https://cdn.dolphinvoice.ai/doc/soe/linux.svg)

**Parameter Description**

| Parameter Name | Type | Description | Default Value |
| :- | :- | :- | :- |
| langType | String | Language option, English: en-US<br />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](https://soe.dolphinvoice.ai/en/docs/mode/intro) | 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.<br /> 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.<br /> 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<br />When connti is 0, it is not enabled<br />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<br />appSecret<br />params: Evaluation parameters, refer to `Parameter Description`<br />userData: User data<br />startSuccess: Start success callback, need to send audio data in the callback<br />result: Evaluation result callback<br />warning: warning callback<br />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<br />data: Audio data<br />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<br />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<br />code: Error code<br />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<br />code: Error code<br />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](https://soe.dolphinvoice.ai/en/docs/mode/intro).

## Status Code Table

Please refer to the [Status Code](https://soe.dolphinvoice.ai/en/docs/sdk/status_full) 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).

2. **Error codes and related solutions**

> For an introduction to error codes, please check the [Status Code](https://soe.dolphinvoice.ai/en/docs/sdk/status_full) document.

3. **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](https://soe.dolphinvoice.ai/en/docs/mode/intro) document and [Parameter Introduction](https://soe.dolphinvoice.ai/en/docs/mode/common) document.

4. **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.

5. **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.