一般在对音频做识别之前,都要对音频数据做预处理,那这样就少不了会设置同一个采样率,我这里是把采样率设为16k。
环境:linux7.4
查看音频信息
soxi abc.wav
soxi查询某个详细信息语法如下
Usage: soxi [-V[level]] [-T] [-t|-r|-c|-s|-d|-D|-b|-B|-e|-a] infile1 ...
-V[n] Increment or set verbosity level (default is 2)
-T With -s, -d or -D, display the total across all given files
-t Show detected file-type
-r Show sample-rate
-c Show number of channels
-s Show number of samples (0 if unavailable)
-d Show duration in hours, minutes and seconds (0 if unavailable)
-D Show duration in seconds (0 if unavailable)
-b Show number of bits per sample (0 if not applicable)
-B Show the bitrate averaged over the whole file (0 if unavailable)
-e Show the name of the audio encoding
-a Show file comments (annotations) if available
例如,我要查看abc.wav的采样率
soxi -r abc.wav
48000#结果
下面就可以进行修改采样率了
方法一:用sox
sox abc.wav -r 16000 abc-16k.wav #abc-16k.wav是转换后的名字,16000改为你想要的采样率
方法二:用ffmpeg
ffmpeg -i abc.wav -ar 16000 abc-16k.wav
参考:
https://blog.csdn.net/chenxieyy/article/details/51506766
网友评论