This topic describes how to install a software development kit (SDK) to use the features of Tingwu.
SDK to install | Description |
Alibaba Cloud SDK | To perform offline transcription of audio and video files and create real-time recordings, you must first install this Alibaba Cloud SDK. Then, you can use API operations to manage offline and real-time tasks and query their status and results. |
Intelligent Speech Interaction real-time transcription SDK | When you use real-time recording, create a real-time task and then install this real-time transcription SDK. This SDK does not include audio collection. Use it to collect and push real-time audio streams and receive real-time transcription results. |
Install the Alibaba Cloud SDK
Both versions of this product (Tingwu/2022-09-30 and Tingwu/2023-09-30) use the ROA signing style for their OpenAPI operations. For more information about signing, see ROA request body and signing mechanism. You can download the Tingwu SDK, which is an encapsulation of OpenAPI, from Tingwu OpenAPI SDK. You can also download the native Alibaba Cloud OpenAPI SDK for various languages from Alibaba Cloud SDK.
Before you use an API, you must prepare your account credentials and AccessKey. This lets you access the API using client tools, such as an SDK or a command-line interface (CLI). For more information, see Create an AccessKey. The following sections describe how to install and use the Alibaba Cloud SDK for common programming languages.
Java
The Java SDK supports Java 8 and later. You can find the version number on the Maven website. When you add the dependency, replace `the-latest-version` in the installation command with the latest version number.
You can add the Alibaba Cloud SDK to your Java project in one of the following ways. You can also download the complete Java sample code to continue the integration.
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>the-latest-version</version>
</dependency>// see https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core
implementation group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: 'the-latest-version'Python
You can run the following command to install aliyun-python-sdk-core using pip.
pip install aliyun-python-sdk-coreGo
The Alibaba Cloud Go SDK supports Go 1.7 and later. You can install it in one of the following ways.
To install using glide:
glide get github.com/aliyun/alibaba-cloud-sdk-goTo install using go vendor:
go get -u github.com/aliyun/alibaba-cloud-sdk-go/sdkC++
You can run the following command to install the Alibaba Cloud C++ SDK. You can also install it manually by following the instructions in the Alibaba Cloud SDK documentation.
git clone https://github.com/aliyun/aliyun-openapi-cpp-sdk.git
cd aliyun-openapi-cpp-sdk
sudo sh easyinstall.sh coreAfter the compilation is complete, you can download the complete C++ sample code to continue the integration.
Install the Intelligent Speech Interaction real-time transcription SDK
When you perform real-time recording, you use Alibaba Cloud OpenAPI operations to create, query, and end real-time tasks. You must also collect, push, and recognize audio streams in real time. You can use the real-time transcription SDKs described in this section to perform these actions. These SDKs do not include audio collection.
Java
You can add the Intelligent Speech Interaction real-time transcription SDK to your Java project.
<dependency>
<groupId>com.alibaba.nls</groupId>
<artifactId>nls-sdk-transcriber</artifactId>
<version>2.2.9</version>
</dependency>Go
You can add the Intelligent Speech Interaction real-time transcription SDK to your Go project.
To install using glide:
glide get github.com/aliyun/alibaba-cloud-nls-go-sdkTo install using go vendor:
go get -u github.com/aliyun/alibabacloud-nls-go-sdkPython
You can download nls-1.1.0-py3-none-any.whl and run a pip command to install the Intelligent Speech Interaction real-time transcription SDK.
pip install nls-1.1.0-py3-none-any.whlC++
The C++ SDK required for Tingwu real-time transcription is precompiled and included in the sample code package. You can use it directly. Alternatively, you can download the open source code of the SDK and compile it yourself.
Android
Decompress the ZIP package. The SDK package is in AAR format and is located in the
app/libsfolder. Integrate this AAR package into your project as a dependency. To use the Android C++ connection type, you can find the dynamic library and header files in the android_libs and android_include folders of the ZIP package.Use Android Studio to open the project and view the sample code. The sample code for real-time speech recognition is in the RealtimeMeetingActivity.java file. Replace the URL and run the code.
iOS
Decompress the ZIP package. Add the nuisdk.framework file from the ZIP package to your project. Then, in the Build Phases of your project, add nuisdk.framework to Link Binary With Libraries.
Use Xcode to open the project. The project provides sample code and ready-to-use utility classes for operations such as audio playback, recording, and file management. You can copy the source code directly into your project. The sample code for real-time transcription is in the RealtimeMeetingViewController file. Replace the URL and run the code.
Harmony
Category | Compatibility |
System | Supports HarmonyOS Next 5.0 API LEVEL 12 DevEco Studio version 5.0.3.403 to 5.0.3.700 |
Architecture | arm64-v8a |
Integrate the SDK as an arkts HAR package. Decompress the ZIP package. The nuisdk-release/neonui.har file is the HAR package generated by the SDK. Import and call this file in your project. To use the HarmonyOS Next C++ connection type, you can find the dynamic library and header files in the harmonyos_libs and harmonyos_include folders of the ZIP package.
To import the HAR package:
Place the HAR package in the project folder. For example, if the entry module calls the package, the path is entry/libs/neonui.har.
Modify the oh-package.json5 file of the entry module. Add the dependency for the neonui.har package to the "dependencies" field.
"dependencies": { "package": "file:libs/neonui.har" }In the entry module folder, run the command to install the dependency package.
cd entry ohpm installRecompile the project.
Use DevEco Studio to open the project in the harmony_nlsdemo folder and view the sample code. The sample code for real-time stream ingest is in the RealtimeMeeting.ets file. Replace the URL and run the code.
Flutter
Decompress the ZIP package. For usage instructions, see the usage example in example/lib/main.dart and the README.md file.