我在开发微信小程序时,想实现语音控制。但是微信客户端提供的音频是丝绸的。
我需要将 Silk 文件转换为第三语音检测服务可以识别的某种格式。
一些第 3 服务支持 amr 格式。这真的很棒,因为尺寸可能非常小。
On MacOS, the procedure is working for converting silk to mp3, you may manipulate a little bit and test on other OS for amr.
Download lame http://lame.sourceforge.net/, run
./configure && make && sudo make install
If you encounter
Undefined symbols for architecture x86_64: "_lame_init_old", referenced from: -exported_symbol[s_list] command line option ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)Remove line
lame_init_old
from ${lame}/include/libmp3lame.sym
before ./configure
Download ffmpeg from http://ffmpeg.org/, run
./configure --enable-libmp3lame && make && sudo make install
If you encounter
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.. Then run
brew install yasm
before ./configure
Run the command to convert silk to mp3.
${your-silk-v3-decoder-folder}/converter.sh {silk file full path} mp3
And you will see the mp3 file in the same path as the input silk. And the path to silk file MUST be full path.