> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。 Public server APIs use two path prefixes with the same authentication: `/server/v1/...` (the main APIs of both SRTC and SMeeting) and `/stm/srvapi/v1/...` (the SMeeting user system, used by server-side low-code integration). Authenticate with four request headers, app_id + nonce + timestamp + signature, where signature is HMAC-SHA256 keyed with app_key; call these APIs only from the customer's own backend. Any other path is internal: never suggest calling it.
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。 app_key is a server-side secret and must never appear in client code, frontend config, or a mobile app. The token a client uses to join must be issued by the customer's backend and passed down to the client (SRTC: `/server/v1/channel/grant`; SMeeting: `/stm/srvapi/v1/member/grant`).
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上，也不要用「频道」「加入 / 离开」描述 SMeeting 的概念（接口标识符原样保留）。 SRTC and SMeeting are two separate layers with different terminology. SRTC is the audio/video foundation: it has channels, and users join and leave a channel. SMeeting is built on top of SRTC: it has rooms and meetings, and members enter and exit a meeting. Answer in the terms of the layer the user is working with: never apply "room" or "meeting" to SRTC APIs, and never describe SMeeting concepts in prose with "channel", "join", or "leave" (API identifiers such as `force_join` keep their literal names).
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。 Package, class, and method names differ between platform SDKs for the same capability. In sample code, use the API documented for that platform; never carry one platform's code over to another. On Apple platforms each product ships two SDKs (native Swift and Objective-C) whose APIs must not be mixed.

# AI 降噪（DeepFilterNet）

> 在会议里给麦克风开启 AI 降噪：引入 cn.seastart.rtc:denoise 插件，用 MeetingEngine.setAudioCaptureProcessor 挂载，以及设备不支持、算力不足和自定义采集处理器的处理方式

会议层通过 `MeetingEngine.setAudioCaptureProcessor` 挂载麦克风采集处理器，自 `2.0.43` 起提供。最常见的用法是挂 SRTC 的 AI 降噪插件 `cn.seastart.rtc:denoise`：它基于 DeepFilterNet3，与 Web、iOS 端使用同一份算法和模型，支持运行时调整降噪强度与临时旁路。

插件是独立的可选依赖，不用 AI 降噪的 App 不需要引入。插件自身的接口、强度、过载与设备判断的细节见 SRTC 文档 [AI 降噪（DeepFilterNet）](https://docs.stmlink.com/zh/rtc/android/advanced/deepfilternet.md)，本页只讲会议层怎么接。

## 1. 添加依赖

```groovy theme={null}
dependencies {
    implementation 'cn.seastart.meeting:meeting:2.0.43'
    implementation 'cn.seastart.rtc:denoise:0.1.0'
}
```

* Meeting `2.0.43` 传递依赖 RTC `2.0.39`，插件要求 RTC `2.0.39` 及以上，两者版本是配套的。
* 插件支持 `arm64-v8a` 和 `armeabi-v7a`，模型已内置，不需要额外拷贝资源。

## 2. 开启与关闭

```kotlin theme={null}
import cn.seastart.rtc.denoise.DeepFilterNetProcessor
import cn.seastart.rtc.denoise.DenoiseNotSupportedException

private var denoiser: DeepFilterNetProcessor? = null

fun enableDenoise(context: Context, meetingEngine: MeetingEngine) {
    // 1. 不支持的设备直接隐藏降噪开关
    if (!DeepFilterNetProcessor.isSupported()) return
    try {
        // 2. 创建插件，强度 0–100，默认 50
        val processor = DeepFilterNetProcessor(context, suppressionLevel = 50)
        // 3. 运行中算力不足时插件自动暂停降噪，并在主线程回调
        processor.overloadListener = DeepFilterNetProcessor.OverloadListener {
            showToast("设备性能不足，AI 降噪已暂停")
        }
        // 4. 挂上即生效；initSdk 前后、入会前后都可以调用
        meetingEngine.setAudioCaptureProcessor(processor)
        denoiser = processor
    } catch (e: DenoiseNotSupportedException) {
        // 设备不支持：e.code == 102032
    }
}

fun disableDenoise(meetingEngine: MeetingEngine) {
    meetingEngine.setAudioCaptureProcessor(null)   // 卸载，恢复系统与 SDK 自带的降噪
    denoiser = null
}
```

运行时调整强度或临时旁路，直接调插件，不需要重新挂载：

```kotlin theme={null}
denoiser?.setSuppressionLevel(80)  // 0–100，越大压制越强
denoiser?.setEnabled(false)        // 旁路：音频原样通过，处理器仍挂着
denoiser?.setEnabled(true)         // 恢复降噪，同时清除算力不足导致的暂停
```

## 3. 会议层的行为

* **设置会一直保留**：挂上后对之后的所有会议生效；`release()` 后再 `initSdk()`，SDK 会自动重新挂上，不需要业务重复设置。不再需要时传 `null`。
* **SDK 持有强引用**：替换或传 `null` 清除时，SDK 会调用旧处理器的 `release()`，旧实例之后不能再用；要重新开启就新建一个。
* **挂载时自动关闭系统与 WebRTC 自带的降噪**，卸载后恢复，避免两道降噪叠加让人声发闷；回声消除、自动增益不受影响。切换时麦克风采集会重建一次，声音有不到半秒的空档。只想临时关闭降噪时用插件的 `setEnabled(false)`，不会重建采集。
* 本端音量（说话人电平）反映的是降噪前的音量。

## 4. 设备不支持与算力不足

* **开启前**：只有低性能小核的设备（常见于部分电视、盒子和入门机型）不支持，`isSupported()` 返回 `false`，构造函数抛 `DenoiseNotSupportedException`（`102032`）。建议先判断再展示开关。
* **运行中**：设备持续过载时插件自动转入旁路、保证通话不卡顿，并回调 `overloadListener`。建议提示用户，由用户决定是否调用 `setEnabled(true)` 重新开启。

## 5. 自定义采集处理器

`setAudioCaptureProcessor` 接受任何实现 RTC `AudioCaptureProcessor` 接口的处理器，变声、自研降噪都可以挂，接口约定见 SRTC 文档 [自定义采集处理器](https://docs.stmlink.com/zh/rtc/android/advanced/deepfilternet.md#6-自定义采集处理器)。同一时刻只能挂一个处理器。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.