短音频语音翻译

服务概述

  • 云上曲率的语音翻译,采用新一代NMT神经网络机器翻译技术,集成高精准度的语音识别和翻译能力,提供离在线融合解决方案。
  • 60s以内短音频的语音翻译,同步返回结果

服务申请

语音翻译API采用全流程自助申请的模式。在云上曲率官网(https://www.ilivedata.com/) 注册并激活账号后,在控制台创建语音翻译的项目,即可获得pid和服务密钥。

如需开通更多服务,可在管理控制台-总览页面开通其他服务。

接入方式

参数规范

请求URL: https://speech.ilivedata.com/api/v1/speech/translate

HTTP请求头

请求头 描述
Content-Type application/json;charset=UTF-8 请求体类型
Accept application/json;charset=UTF-8 接受的返回类型
X-AppId 例:1000 项目或应用的唯一标识符
X-TimeStamp 例:2020-09-01T07:06:55Z 请求的UTC时间戳。需要把时间戳按W3C标准格式化,例如: 2010-01-31T23:59:59Z. (http://www.w3.org/TR/xmlschema-2/#dateTime)。
Authorization 例:Njl86M/jY6zZaZoGhZdGO+GI/8+yGFECusGH1yQHUFE= 签名值

请求方法:POST

请求体:

参数 子参数 必需 描述
speechLanguageCode 必需 音频对应的语种 支持语种
textLanguageCode 必需 翻译对应的目标语种 支持语种
audio 必需 Base64格式的音频文件
config codec 可选 编码格式,支持AMR_WB、OPUS、PCM、AMR。如未指定则默认使用AMR_WB
sampleRateHertz 可选 采样率,AMR只支持8000,其他编码格式只支持16000。
userId 可选 唯一的终端用户ID。 用户ID应当不超过32个字符。
alternativeLangCodes 可选 候选语种数组,最多支持传入4个候选语种 支持语种
textToSpeech 可选 语音到语音的翻译开关 True/False,默认为 False
textToSpeechConfig outputFormat 可选 选择输出合成音频编码,候选为pcm、mp3、opus,默认为pcm
voiceGender 可选 指定合成声音的性别 0-女生音色 / 1-男生音色,默认为 0

请求体示例

Request Sample

{
  "speechLanguageCode": "zh-CN",
  "textLanguageCode": "en",
  "config": {
        "codec": "OPUS",
        "sampleRateHertz": 16000
  },
  "audio":"T2dnUwACAAAAAAAAAAAd8pVTAAAAAGsIvpMBE..."
}

请求签名:

当用户请求Speech Recognition API时,可以使用appId和secretKey对请求做签名,当API收到带签名信息的请求之后,将使用相同的算法验证签名,如果发现签名不一致,API将会返回401给用户。

如果API验证签名一致,且appId对应的用户有权限操作请求的资源,则请求成功,否则API返回401。

通过 HTTP 请求 Header 发送签名

方法: 在请求中加入名为 Authorization 的 Header,值为签名值。如下:

Authorization: Njl86M/jY6zZaZoGhZdGO+GI/8+yGFECusGH1yQHUFE=

签名计算方法

1.构造规范化的请求字符串(Canonicalized Query String)

将请求体JSON字符串以UTF-8字符编码做sha256编码后转换为16进制字符串(注意不是Base64)

CanonicalizedQueryString = hex(sha256(jsonBody))

2.构造被签名字符串 StringToSign ("\n” 代表ASCII里的换行符)

StringToSign = HTTPMethod + "\n" +
               HostHeaderInLowercase + "\n" +
               HTTPRequestURI + "\n" +
               CanonicalizedQueryString <从上一步得到> + "\n" +
               "X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
               "X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER

HTTPRequestURI是请求URI的绝对路径,不包含请求串。如果HTTPRequestURI为空,也要保留一个正斜杠 ( / )

使用 HMAC-SHA256 协议创建基于哈希的消息身份验证代码 (HMAC),然后计算签名。

3.StringToSign作为签名字符串,secretKey作为秘钥,SHA256作为哈希算法

有关 HMAC 的更多信息,请参阅 https://tools.ietf.org/html/rfc2104

4.将上一步的结果转换为BASE64串

5.将BASE64串放入HTTP请求Header的Authorization

签名示例

下面是appId & secretKey & audio的示例

appId=1000
secrectKey=****
audio_base64="IyFBTVItV0IKJFACQCLrVZflEqx2xCbkB6pst/TYz3z1zlzeTPXgvU5/1vL8JXZG7HAk8BjHC86gmnGNH8QWhxO5mEyWGtFkq9CouG9SOClwaOr9Kt0RNSmbeCTHbGX+taLPQd+7HdvywAGxCDPMFlPqnFHjydnHiiXHyU1VTsE/nKrYJOJK2LIhWO6gG64xtXJCruyM6SEWkOoNxv5FxHJl1F7mtQgFoSgrOqgkjRrt+LCU5rF/9UcBdY34U1kQYcIeO841udarlTvFettHh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mExSqrZ0MKOgton6vtm7pTKUJloJMAEkk1GKp/ga1tAjdKPY/L0v1ko4sbgq47huRpJH6UmI/XPBEcUQPgk0EAwnw8UsGL67mBiZxK/EZJe89EHSvi+235wm56rC8QB5zabV/ITECTAPwhJBN2CJVAChJIrrY/ZV7HUmwviXnS/arHvUksO9HVs0QO/gsMoJMAAQIYP/KJweAwItfYnhMIqwesmEN0WhQljpTwcl+xVbt0BXznfVGgkwkoksm90tQKYLlSptNDuInbqIQ3cG0oPy2vZBqINUX5FPDzfxpLHqCTAGDrxE5DSYdvDlX+vKyU5G/leMiOJ5V1khqjUMg9KZR/0BCyQMcWAJMJIKr8TludlEm3kZLWHlykLnk5ZEbxHmPKma1V2k5oc1+YYFMU0iwAkwEhYY6EYAyAaIPSSbzzY0tCZLLyU0UckIpa0RctSngWZ8lCqWRaw8CTASHvUBlqgA10CJdcUpRVVmD0D9PxvSBkYn5QYvaSkqBg5HBfjslsgJMgUG6QGkgkzHyhI3QJER9Iv4oXcbSa1HMZLd/nFknbJO4msJ9ZvaXgkwDoT7mAmSFM7LURoMWZQri+3DVmvrfvAO4LTuB/tNL4msGfncPVh6CTADjKtDbLHMT9U788m5u2rYTB834Ii6PcNHSMFtnOZy5hq0PUiFuvwJMAd4n4vdjNlGXacF/8FLrNCzdpT5a46AxBpmd0Kv+TlrtdZGf2XrVAkwHjW1R8u82GaT+7aNMILakfO7pFYRP3mfDi8z5adRos7S2Yq3eqIYCTBHc1gGYiaJV39YgfBFuk8eWY0JYrZuSd7cMSNrYTMcDvArF6c0qU4JOOUMGROqL7g2jDkAIbhXE9MX3tQBaLfy2Bep0j6c6PSmxX1ApQ+NMAkwEmYs7UAcnUf78lOMztwHjhmjkHxmV2gcpWg3hzgtbW7gVN/fEEG+CTwBPCuBCj74D3WSIMaqu7unq0OquBJjCpU4olkDAYYoBwJvFpASOTo"

下面是示例请求体

{"speechLanguageCode": "zh-CN", "textLanguageCode": "en", "config": {"codec": "AMR_WB", "sampleRateHertz": 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aJV39YgfBFuk8eWY0JYrZuSd7cMSNrYTMcDvArF6c0qU4JOOUMGROqL7g2jDkAIbhXE9MX3tQBaLfy2Bep0j6c6PSmxX1ApQ+NMAkwEmYs7UAcnUf78lOMztwHjhmjkHxmV2gcpWg3hzgtbW7gVN/fEEG+CTwBPCuBCj74D3WSIMaqu7unq0OquBJjCpU4olkDAYYoBwJvFpASOTo", "userId": "12345678"}

生成CanonicalizedQueryString

3ff89070a25e4091c94f03ad3cf014d712aaf9e069ef654b0e7e58b2b4550e31

生成StringToSign

POST
speech.ilivedata.com
/api/v1/speech/translate
3ff89070a25e4091c94f03ad3cf014d712aaf9e069ef654b0e7e58b2b4550e31
X-AppId:1000
X-TimeStamp:2021-01-12T07:38:29Z

HMAC计算得到的签名

1nNkKezG9XgkbCau9aENhDDRJhoTMHAI85NnjY+Mm4k=

HTTP响应

字段名 子字段名 描述
errorCode 0表示成功
errorMessage 错误消息
translation source 音频源语言
target 文本目标语言
sourceText 从音频中识别出的文本
targetText 翻译后目标语言后的文本
targetAudio 翻译后对应的语音

响应示例

Sample Response

{
    "errorCode": 0,
    "translation": {
        "source": "zh-CN",
        "target": "en",
        "sourceText": "你好!",
        "targetText": "Hello!",
        "targetAudio": "https://xxxx"
    }
}

错误码

HTTP状态码 错误码 错误消息
200 0 no message
429 1104 Out of Rate Limit
429 1105 Out of Quotas
405 1004 Method Not Allowed
411 1007 Not Content Length
400 1002 API Not Found
400 1003 Bad Request
400 2000 Missing Parameter
400 2001 Invalid Parameter
400 2002 Invalid Request
400 2102 Input Too Long
400 2109 Speech Recognition Failed
400 2110 File is invalid
400 2111 Failed to download file
400 2112 TaskId is invalid
401 1102 Unauthorized Client
401 1106 Missing Access Token
401 1107 Invalid Token
401 1108 Expired Token
401 1110 Invalid Client
401 2003 Invalid Scope
401 2004 Unsupported Response Type
401 2100 Translation Failed
401 2101 No Match
401 2102 Input Too Long
401 2103 Detection Failed
401 2104 Language Not Supported
401 2105 Normalization Failed
401 2106 Inappropriate Word Used
401 2107 Invoke Service Failed
401 2108 Service Unavaliable