閱讀336 返回首頁    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)_智能語音交互-阿裏雲