sonicloud_opensdk README

项目的 README,来自 github.com/SonicloudTech/sonicloud_opensdk。合并为一个 markdown 文件:README.md。

SoniCloud Recorder SDK

Languages: English | 简体中文

A recorder card and a complete BLE integration reference.

SoniCloud Recorder is an open-source reference project for hardware vendors, software developers, and system integrators. It combines recorder hardware with BLE protocol SDKs, cross-platform integration samples, and a desktop demo to help teams move from device connectivity to recording, transfer, transcription, and product integration.

SoniCloud recorder card

Project overview

The project demonstrates a layered approach to recorder hardware integration: standard BLE commands, a vendor adaptation layer, and cross-platform SDK wrappers. The recorder card captures and stores audio; the SDK manages BLE sessions, protocol traffic, device state, and data streams; the application owns its UI, audio decoding, storage, transcription, and business integration. Differences between chipsets, including service UUIDs, characteristics, packetization, and private commands, remain inside the adapter layer.

What is included

Resource Audience Contents
Mobile SDKs Android, iOS, HarmonyOS, and Flutter developers Platform wrappers, BLE discovery and connection, recording control, real-time audio, file transfer, Wi-Fi, OTA, device information, and event callbacks
Windows/macOS demo Desktop application and tool developers Python BLE protocol implementation, command-line REPL, Web console, and recorder controls
Protocol and test material Teams that need hardware-level customization BLE GATT, frame format, CRC, file downloads, recording events, and compatibility rules
Integration guides Hardware vendors, app teams, and technical reviewers Multiplatform SDK integration and the standard BLE command architecture

Capabilities

Repository layout

sonicloud_opensdk/
├── pnote-android-sdk/                  # Android AAR
├── pnote-ios-sdk/                      # iOS static library and header
├── pnote-harmony-sdk/                  # HarmonyOS HAR SDK
├── pnote-flutter-sdk/                  # Pure-Dart Flutter plugin (BLE protocol, realtime audio stream, docs)
├── pnote-sdk-flutter-demo-main/        # Flutter integration demo (legacy, native-SDK based)
├── pnote-flutter-project/              # Flutter app project (recording + live transcription + AI summary/mind map)
├── pnote-web-win&Mac-demo/             # BLE REPL and Web demo
│   ├── recorder/                       # Protocol, BLE, device session, and Web backend
│   ├── web/                            # Front-end page
│   ├── tests/                          # Protocol and device-simulation tests
│   └── docs/协议.md                    # CB08 communication protocol V1.0
├── Speech-to-text—text-to-speech/      # Isolated offline ASR/TTS and mobile bridges
├── img/                                # Project images
│   ├── 录音卡片.png                     # Product image
│   ├── 硬件参数.png                     # Hardware specifications
│   └── 微信.png                         # Contact QR code
├── SDK 集成引导.docx                   # SDK integration guide
├── demo.mp4                            # Demonstration video
└── LICENSE                             # MIT License

Run the desktop demo in five minutes

Requirements: Python 3.10 or later, a working BLE adapter, and a recorder card that is ready to connect.

cd pnote-web-win&Mac-demo
python -m venv .venv
source .venv/bin/activate                 # Windows PowerShell: .venv\\Scripts\\Activate.ps1
pip install -r requirements.txt
python main.py --web

Open http://127.0.0.1:8000 in a browser. The web console supports Chinese and English; use the selector in the top-right corner to switch languages. You can also verify the command-line REPL:

record> scan
record> connect 0
record> smoke
record> list
record> download 0
record> transcribe 0

See the desktop demo README for the complete command list. Offline voice is isolated in Speech-to-text—text-to-speech; the Web page remains optional:

cd "../Speech-to-text—text-to-speech"
pip install -r requirements-python.txt
python scripts/fetch_voice_models.py --all
cd "../pnote-web-win&Mac-demo"
pip install -r requirements-web.txt
python -m unittest discover tests -v

Model archives are pinned in Speech-to-text—text-to-speech/models/manifest.json, downloaded from official sherpa-onnx releases, and verified with SHA-256 before extraction. Model weights are intentionally kept out of normal Git history. The existing SDK remains unchanged.

Windows/macOS Web demo

The desktop demo provides both a command-line REPL and a browser-based Web console for device discovery, connection checks, recording control, file downloads, WAV playback, and real-time streaming. Offline ASR/TTS is maintained separately under Speech-to-text—text-to-speech so the existing SDK remains unchanged.

SoniCloud recorder BLE console

Mobile integration

Before integrating, read the SDK integration guide for permissions, dependencies, initialization, callbacks, audio processing, resumable file transfer, and OTA acceptance testing. For the cross-vendor standardization model, see the protocol notes and documents included in this repository.

Flutter

Pure-Dart plugin (recommended) — pnote-flutter-sdk/ implements the full BLE protocol in Dart on top of flutter_blue_plus, with no native SDK dependency. Add it directly from this repository:

pnote_flutter_sdk:
  git:
    url: https://github.com/SonicloudTech/sonicloud_opensdk.git
    path: pnote-flutter-sdk

It covers scan/connect, device info, recording control, the realtime opus stream (recordDataStream), file list/download/delete, and an iOS-parity AppJson compatibility layer. See README.en.md for the full API reference and protocol cmd tables.

Legacy demo (native-SDK based):

cd pnote-sdk-flutter-demo-main
flutter pub get
flutter run

Use a physical device to verify Bluetooth, recording, Wi-Fi, and OTA. The main integration entry point is lib/provider_record_pen.dart; see the Flutter demo README.

Android

Copy the Android AAR to your app's app/libs or src/main/libs directory. Add the fileTree dependency and the SDK's RxJava, Retrofit, EventBus, and other required dependencies, then call:

PNote.init(context, deviceDataListener);
PNote.startSearch();
PNote.connectDevice(name, address);

Callbacks include JSON device events, real-time Opus data, and file Opus data. See the Android SDK guide for the complete API.

iOS

Add libPNote.a and PNode.h to Xcode, implement WindBleDelegate, and call APIs such as startSearch and connectDeviceAndAddress. See the iOS SDK guide for the complete API and OTA workflow.

HarmonyOS

The HarmonyOS SDK is distributed as har_recordersdk.har and currently targets HarmonyOS API 12 or later. Import the HAR package, request Bluetooth permissions, and connect with the deviceId returned by the scan callback. This deviceId may be a system-generated privacy identifier; the address field is for display only. Business results are returned asynchronously through DEVICE_DATA events.

Protocol implementation notes

See the protocol document for field definitions, command tables, captured frames, and compatibility rules.

Integration checklist

  1. Use the desktop demo with a real device to verify discovery, connection, time synchronization, a read-only check, and at least one file download.
  2. Request the required Bluetooth permissions for the target platform. Initialize the SDK, register device-event, real-time-audio, and file-data callbacks, and then start discovery.
  3. Connect with the identifier returned by the scan callback. After connection, synchronize time, then read battery, capacity, firmware version, and the file list.
  4. Convert callbacks into the application's event queue or state-management layer. A method call means that a request was submitted; completion is represented by an asynchronous event.
  5. Send 40-byte Opus frames to a dedicated decoder task. Finalize files on the completion event, record the offset, and validate size and decodability before showing them to users.
  6. Run OTA only after Wi-Fi/TCP is connected, an update is needed, and the battery is at least 20 percent. Mark the upgrade as failed if BLE or Wi-Fi disconnects; do not blindly resend the entire firmware.
  7. When adding a chipset or model, extend VendorAdapter, capability flags, and version negotiation instead of exposing vendor-private fields to application code.
  8. Never hard-code or commit cloud ASR keys, authorization codes, real recordings, or device identifiers. Redact logs and packet captures before sharing them.

Use cases

The project is suitable for meeting recording and note-taking, interviews, classroom training, content creation, inspection records, companion apps for smart hardware, corporate gift and promotional recorders, and other products that need to integrate multiple recorder chipsets into one application.

Hardware adaptation and support

Hardware integration typically follows this sequence: confirm capabilities → implement VendorAdapter → integrate the SDK → validate on real hardware. The hardware team should provide chipset capabilities, BLE services and characteristics, private commands, firmware versions, protocol material, and test scenarios. The adapter maps those differences to the standard interface; the application team then uses Android, iOS, HarmonyOS, or Flutter APIs to build the product workflow.

For hardware specifications, sample devices, the HarmonyOS SDK, complete protocol material, or technical support, contact SoniCloud. Include the target platform, expected volume, device model, firmware version, and intended use case.

SoniCloud contact QR code

Business & technical contact: [email protected]

License and usage boundaries

The example code is released under the MIT License. AAR files, static libraries, HAR packages, firmware, device-private protocols, and some documents may contain SoniCloud or vendor-owned material and are not necessarily open source. Redistribution and commercial use are governed by the accompanying package terms and applicable agreements.

Interfaces, command numbers, and behavior are defined by the current SDK, firmware, protocol version, and real-device validation results. The SDK does not replace application-side Opus decoding, file storage, permission handling, or security controls. Do not use private protocols with hardware or products without authorization.

Feedback and issues

When filing an issue, include the operating system and version, target platform, SDK/demo version, device firmware version, reproduction steps, and relevant logs or TX/RX frame hex. Redact serial numbers, addresses, authorization codes, recordings, and other real-device data before sharing it.

sonicloud_opensdk (SonicloudTech/sonicloud_opensdk)

正在搜索数据库…

这是什么?这是一个开放的 SDK 和参考实现,用于把蓝牙录音卡硬件设备(声云录音卡)接入你自己的应用,涵盖 BLE 协议、设备控制、实时音频、文件传输、OTA 更新和转写,并提供 Android、iOS、HarmonyOS、Flutter 以及 Windows/macOS 桌面端的示例。
这是我要集成的库,还是成品应用?它主要是一个 SDK(Android AAR、iOS 静态库、HarmonyOS HAR、Flutter 插件),外加一个 Windows/macOS 桌面演示应用和一个 Python 参考实现;你需要把 SDK 集成到自己的软件里,与单独的硬件产品通信。
怎么让桌面演示跑起来?安装 Python 3.10+,准备好可用的 BLE 适配器并让录音卡处于可连接范围内,然后运行 'pnote-web-win&Mac-demo' 文件夹中的桌面演示,它同时提供 CLI 交互界面和基于浏览器的网页控制台。
使用它需要真实的录音卡硬件吗?需要,你需要声云录音卡实体设备本身(样品和规格请联系 Anhui Sonicloud);Android 集成还需要添加 AAR 以及 RxJava、Retrofit 和 EventBus 依赖。
SDK 不会替我处理哪些事情?SDK 只给你原始的 16 kHz 单声道 Opus 音频帧,既不解码也不生成 WAV 头;OTA 固件更新必须通过 Wi-Fi/TCP 链路进行,因为纯 BLE 无法传输固件。
移动端集成支持哪些平台?移动应用支持 Android、iOS、HarmonyOS(API 12+)和 Flutter,另有 Windows/macOS 桌面演示用于 PC 端工具和测试。
VendorAdapter 层到底解决什么问题?Jieli、Lanxun、Bluetrum、BK 等不同 BLE 芯片厂商各自有不同的服务 UUID、特征值和私有指令;VendorAdapter 层吸收了这些差异,应用无论面对哪种芯片都使用同一套统一的 SDK 接口。
录音卡配合 SDK 实际能做什么?按键触发的录音控制、实时 Opus 音频流、可断点续传的文件列表和下载、基于 Wi-Fi 的文件和固件传输、设备信息查询(电量、固件、SN),以及在一次性下载约 900MB 模型之后的离线语音转文字。
BLE 协议是怎么构成的?它使用 GATT 服务 0xAE20,包含写特征 AE21、数据通知 AE22 和按键通知 AE23,采用 MAGIC+SEQ+CRC-16/XMODEM+LEN+TYPE/CMD/PARAMS 帧格式,并为分片的 BLE 包提供重组逻辑。
什么时候触发 OTA 固件更新才是安全的?只有在 Wi-Fi/TCP 链路已建立、确实需要更新版本且设备电量不低于 20% 时才触发;如果更新中途 BLE 或 Wi-Fi 断开,任务应标记为失败,而不是盲目重发整个固件。
大小
132.7 MB
星标
2.6K
更新
提交Nov 13
时长
3个月
提交 · 90 天