阅读336 返回首页    go 阿里云 go 技术社区[云栖]


OPUS格式语音编解码__一句话识别_语音识别(ASR)_智能语音交互-阿里云

简介

Opus编码器 是一个有损声音编码的格式,由互联网工程任务组(IETF)进来开发,适用于网络上的实时声音传输,标准格式为RFC 6716。Opus 格式是一个开放格式,使用上没有任何专利或限制。

  • Bitrates from 6 kb/s to 510 kb/s
  • Sampling rates from 8 kHz (narrowband) to 48 kHz (fullband)
  • Frame sizes from 2.5 ms to 60 ms
  • Support for both constant bitrate (CBR) and variable bitrate (VBR)
  • Audio bandwidth from narrowband to fullband
  • Support for speech and music
  • Support for mono and stereo

Why Opus?

why opus

OPUS 在NLS服务中的使用

目前我们的Android 和 iOS客户端sdk中集成了OPUS编码(encoder)功能。根据我们的参数进行语音编解码,可以做到大概9:1的语音压缩比,能够有效的节省传输带宽和响应时间。

在使用Java SDK时,SDK本身不支持OPUS的编解码,用户可以根据本文档的设置自行进行编码,将生成的opu格式的文件通过SDK做语音识别。

下载

opus更详细的说明请参考 https://www.opus-codec.org/

opus版本请使用1.0.3以上版本 https://www.opus-codec.org/downloads/older.shtml.en ,下载libopus Source code。

接口说明: https://www.opus-codec.org/docs/html_api-1.0.3/index.html

主要参数配置

Encoder配置:

  1. //encoder's settings
  2. OpusEncoder *pOpusEnc = opus_encoder_create(16000, 1, OPUS_APPLICATION_VOIP,&error); // 初始化操作.创建编码器
  3. opus_encoder_ctl(pOpusEnc, OPUS_SET_VBR(1)); //可变比特率
  4. opus_encoder_ctl(pOpusEnc, OPUS_SET_BITRATE(27800)); //比特率设置为27800
  5. opus_encoder_ctl(pOpusEnc, OPUS_SET_COMPLEXITY(8));
  6. opus_encoder_ctl(pOpusEnc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE)); //信号类型
  7. opus_int32 opus_encode ( OpusEncoder * st,
  8. const opus_int16 * pcm,
  9. int frame_size,
  10. unsigned char * data,
  11. opus_int32 max_data_bytes
  12. ) //Encodes an Opus frame.
  13. void opus_encoder_destroy ( OpusEncoder * st )//释放编码器

Decoder 配置

  1. //decoder's settings
  2. OpusDecoder* opus_decoder_create (16000,
  3. int 1,
  4. int * error
  5. ) //创建解码器
  6. int opus_decode ( OpusDecoder * st,
  7. const unsigned char * data,
  8. opus_int32 len,
  9. opus_int16 * pcm,
  10. int frame_size,
  11. int decode_fec
  12. ) //解码操作
  13. void opus_decoder_destroy ( OpusDecoder * st ) //释放解码器

最后更新:2016-11-24 11:23:48

  上一篇:go iOS SDK__一句话识别_语音识别(ASR)_智能语音交互-阿里云
  下一篇:go API使用__录音文件识别_语音识别(ASR)_智能语音交互-阿里云