流式音频分析

最近更新时间:2019-08-16 23:26:51

1. 接口描述

接口请求域名: tci.tencentcloudapi.com 。

分析音频信息

默认接口请求频率限制:100次/秒。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:TransmitAudioStream
Version String 公共参数,本接口取值:2019-03-18
Region String 公共参数,本接口不需要传递此参数。
Functions Function 功能开关列表,表示是否需要打开相应的功能,返回相应的信息
SeqId Integer 流式数据包的序号,从1开始,当IsEnd字段为1后后续序号无意义。
SessionId String 语音段唯一标识,一个完整语音一个SessionId。
UserVoiceData String 当前数据包数据, 流式模式下数据包大小可以按需设置,在网络良好的情况下,建议设置为0.5k,且必须保证分片帧完整(16bit的数据必须保证音频长度为偶数),编码格式要求为BASE64。
VoiceEncodeType Integer 语音编码类型 1:pcm。
VoiceFileType Integer 语音文件类型 1: raw, 2: wav, 3: mp3 (语言文件格式目前仅支持 16k 采样率 16bit 编码单声道,如有不一致可能导致评估不准确或失败)。
IsEnd Integer 是否传输完毕标志,若为0表示未完毕,若为1则传输完毕开始评估,非流式模式下无意义。
Lang Integer 音频源的语言,默认0为英文,1为中文
StorageMode Integer 是否临时保存 音频链接
VocabLibNameList.N Array of String 识别词库名列表,评估过程使用这些词汇库中的词汇进行词汇使用行为分析

3. 输出参数

参数名称 类型 描述
AsrStat ASRStat 返回的当前音频的统计信息。当进度为100时返回。
Texts Array of WholeTextItem 返回当前音频流的详细信息,如果是流模式,返回的是对应流的详细信息,如果是 URL模式,返回的是查询的那一段seq对应的音频的详细信息。
VocabAnalysisDetailInfo Array of VocabDetailInfomation 返回词汇库中的单词出现的详细时间信息。
VocabAnalysisStatInfo Array of VocabStatInfomation 返回词汇库中的单词出现的次数信息。
AllTexts String 音频全部文本。
AudioUrl String 临时保存的音频链接
RequestId String 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 流式音频分析示例

一个分片的流式音频分析

输入示例

https://tci.tencentcloudapi.com/?Action=TransmitAudioStream
&Functions.EnableVadInfo=true
&IsEnd=1
&SeqId=1&SessionId=testforsession
&UserVoiceData=SUQzBAAAAAAANFRDT04AAAAHAAADQmx1ZXMAVFNTRQAAAA8AAANMYXZmNTguMjMuMTAyAAAAAAAAAAAAAAD%2F81jAAAAAAAAAAAAASW5mbwAAAA8AAAASAAAITAAiIiIiIi8vLy8vLzw8PDw8SUlJSUlJVlZWVlZjY2NjY2NwcHBwcH19fX19fYqKioqKl5eXl5eXpKSkpKSksbGxsbG%2Bvr6%2Bvr7Ly8vLy9jY2NjY2OXl5eXl8vLy8vLy%2F%2F%2F%2F%2F%2F8AAAAATGF2YzU4LjQxAAAAAAAAAAAAAAAAJAOVAAAAAAAACEyULaIpAAAAAAAAAAAAAAD%2F8zjEABOylnQLRigAETO960QQJ6YQQPAYDTk8mTJ0YQIB9yBwCBwk5CEISd5zvIQjHDgoxzoQihwOEnOdyB8Pnf5CEb%2F%2FJ%2F%2Fkb%2F%2FQnIT%2F%2F%2FU4fOQPh84gcf%2F4fdgZFMFAgSI3tbm442AGGmn%2F8zjEEBkKUvpfi1AAfjskBZcKzUvSVbbkBJDYQQjiAjweEh5oMAAxlFw2k%2Bp54rlpkWD5QfurYURx1YQtGGn7mdM%2FVu3Rmq2QIhX7ZWx7%2F5Eex766IzR8OwyFiH5dn1HFKghCWjAD0l4f9zT%2F8zjEChdqDubXyzgA3lYDYbubfXyPI2D4dmug8D4iJZc9%2BYIwaBEHgPBor9R8YU890ucccaexjHjBqIc6aHHqb%2F%2F%2F%2F%2FsjrS1mImg2cCg1BlukfTFxC7PpC5FCF0fiWcCdCWNpdRAMYCcHqZf%2F8zjECxfpUu7%2BC9JQ7YQQxOR%2FiKEMUe%2F8q1hNE2EaKBQxc4SWEQlDQsCbSBBCTuqSolZZPPt2k1GqT2EbsZFLIkRIWmJpQqDAoCDv%2F%2FXtcHDDGBwHAIXU5FPmGNLVf%2BiOUgqkR5AiDr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qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo%3D
&VocabLibNameList.0=testlib2
&VoiceEncodeType=1
&VoiceFileType=3
&<公共请求参数>

输出示例

{
  "Response": {
    "RequestId": "205ca3bb-aa5d-4df8-97d1-06fa865f70d5",
    "Texts": [
      {
        "TextItem": {
          "Mbtm": 0,
          "Metm": 512,
          "Text": "Hey. ",
          "TextSize": 5,
          "Confidence": 0.038818073,
          "Tag": 0,
          "Words": [
            {
              "Mbtm": 70,
              "Metm": 430,
              "Text": "hey",
              "Wsize": 3,
              "Confidence": 0
            }
          ]
        },
        "Speed": 3.90625,
        "MaxVolume": 0,
        "MinVolume": 0,
        "AvgVolume": 0
      }
    ],
    "VocabAnalysisDetailInfo": null,
    "AsrStat": {
      "TotalDuration": 612,
      "SoundDuration": 512,
      "MuteDuration": 100,
      "VadNum": 1,
      "WordNum": 1,
      "AvgSpeed": 1.953125,
      "MaxVolume": 0,
      "MinVolume": 0,
      "AvgVolume": 0
    },
    "VocabAnalysisStatInfo": null
  }
}

5. 开发者资源

API Explorer

该工具提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力,能显著降低使用云 API 的难度,推荐使用。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
InternalError.StatusQueryFaceLibFailed 查询人脸库失败
InvalidParameter.InvalidLang 无效的语言类型,只支持0 英文,1 中文
InvalidParameter.InvalidSeqId 分片序号错误
InvalidParameter.ProcessUnReady 任务处理中,请稍后查询。
InvalidParameter.StatusJobFailed 任务执行失败,请确保拉流地址稳定
InvalidParameter.StatusJobNotFound 任务不存在
InvalidParameter.StatusJobUnfinished 任务未完成
InvalidParameter.StatusNoCameraFound 没有找到摄像头
LimitExceeded.StatusCameraCountOverMax 该教室的摄像头数量超出最大限制
ResourceNotFound.HLJobIdNotFound 无法找到精彩集锦任务ID,请确认输入JobId无误。
ResourceUnavailable.StatusQueryStreamFailed 提交任务时获取拉流地址失败,请确认该教室的摄像头都配置好