Ang-YC / wx-voice

Convert audio files between Tencent apps (Weixin / Wechat, QQ) and Silk codec with other general formats such as MP3 and M4A
MIT License
146 stars 32 forks source link

能不能加入直接导出PCM格式的选项呢? #6

Closed paraself closed 5 years ago

paraself commented 6 years ago

很多场景都是需要直接处理PCM数据的。例如百度的语音服务,讯飞的语音服务。看了下源码,目前也是先转成了pcm再转成其他的格式的。能不能直接添加导出pcm的选项呢?

Ang-YC commented 6 years ago

有道理,我会在这1-2天内更新,感谢您的支持!=)

paraself commented 6 years ago

你好,请问能不能最近加一下呢?刚好需要用一下您这个工具呢。谢谢啦!

Ang-YC commented 6 years ago

刚刚发布了新版本 (0.2.1),并具有了这项功能(不好意思拖到现在,但欠东西不好欠过年,哈哈)

代码例子:

const WxVoice = require('wx-voice');
var voice = new WxVoice("temp");

voice.decode("input.silk", "output.pcm", { format: "pcm", frequency: 16000 });

指令例子:

wx-voice decode -i input.silk -o output.pcm --frequency 16000
paraself commented 6 years ago

哈哈,谢啦,有空试验一下。 另外想问一下,有没有可能直接在前端用JS解码silk呢?小程序里,目前做语音识别,都是要先传到自己的服务器,然后在服务器上转码再发给百度。