我尝试在 Raspberry PI 上使用 sox 录制声音失败:
pi@raspberrypi ~/tmp $ rec new.wav
Segmentation fault
玩也是如此:
pi@raspberrypi ~/tmp $ play test.wav
Segmentation fault
但它会为我转换文件:
pi@raspberrypi ~/tmp $ sox message.wav message.flac rate 16k
pi@raspberrypi /tmp $ mplayer message.flac
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
AUDIO: 16000 Hz, 2 ch, s16le, 160.0 kbit/31.26% (ratio: 20004->64000)
Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio)
==========================================================================
调试信息似乎没有提供大量信息:
pi@raspberrypi ~/tmp $ sox -V5 -d new.wav
sox DBUG formats: opening format plugin `lsx_amr_nb_format_fn': library 0x1af6308, entry point 0x4038f2c8
sox DBUG formats: opening format plugin `lsx_amr_wb_format_fn': library 0x1af6a80, entry point 0x4000ee10
sox DBUG formats: opening format plugin `lsx_ao_format_fn': library 0x1af71e0, entry point 0x4003ebb8
sox DBUG formats: opening format plugin `lsx_ffmpeg_format_fn': library 0x1af7918, entry point 0x403de914
sox DBUG formats: opening format plugin `lsx_flac_format_fn': library 0x1afe1e0, entry point 0x419f70a8
sox DBUG formats: opening format plugin `lsx_gsm_format_fn': library 0x1b0e570, entry point 0x403e8cf4
sox DBUG formats: opening format plugin `lsx_lpc10_format_fn': library 0x1b0e978, entry point 0x41a5dcc4
sox DBUG formats: opening format plugin `lsx_mp3_format_fn': library 0x1b0ed80, entry point 0x41a6bd1c
sox DBUG formats: opening format plugin `lsx_oss_format_fn': library 0x1b0fb00, entry point 0x41a77d74
sox DBUG formats: opening format plugin `lsx_pulseaudio_format_fn': library 0x1b0ff70, entry point 0x41ac9a80
sox DBUG formats: opening format plugin `lsx_sndfile_format_fn': library 0x1b153f8, entry point 0x41e98ec0
sox DBUG formats: opening format plugin `lsx_vorbis_format_fn': library 0x1b15830, entry point 0x41ad49ec
sox DBUG formats: opening format plugin `lsx_wavpack_format_fn': library 0x1b15c68, entry point 0x41ea57c8
sox INFO oss: OSS driver only supports bytes and words
sox INFO oss: Forcing to signed linear word
Segmentation fault
以下是一些可能有用的版本数据:
pi@raspberrypi ~/tmp $ sox --version
sox: SoX v14.4.0
pi@raspberrypi ~/tmp $ cat ~/.asoundrc
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:2,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
pi@raspberrypi ~/tmp $ uname -a
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux
答案1
这个 SoX 是基于 Debian 软件包的吗?因为问题看起来很像Debian 错误 #676167这是在版本 14.4.0-3 中引入并在 14.4.0-5 中修复的。
它还显示(从格式插件列表中)您没有libsox-fmt-alsa
安装该软件包,但您需要它来进行 ALSA 播放。
因此,您应该安装软件包libsox-fmt-alsa
并将其升级sox
到至少 14.4.0-5,或者设置环境变量AUDIODRIVER=alsa
作为解决方法。