在用arecord录制音频时,我试图更改默认的采样率。
当前,当运行arecord test.wav时,速率为8000 Hz:
arecord test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono我可以使用rate标志--rate 44100更改采样率:
arecord --format S16_LE --rate 44100 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono但是当我改变asound.conf的速率时,它对记录没有影响(速率保持在8000 Hz)。我是不是遗漏了什么?
我的asound.conf:
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one
# use samplerate to resample as speexdsp resample is bad
defaults.pcm.rate_converter "samplerate"
pcm.!default {
type asym
playback.pcm "playback"
capture.pcm "capture"
}
pcm.playback {
type plug
slave.pcm "dmixed"
}
pcm.capture {
type plug
slave.pcm "array"
}
pcm.dmixed {
type dmix
slave.pcm "hw:wm8960soundcard"
ipc_key 555555
}
pcm.array {
type dsnoop
slave {
pcm "hw:1,0"
format S16_LE
rate 44100
channels 1
}
ipc_key 666666
}arecord -L输出
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
eci
eco
usbstream:CARD=Headphones
bcm2835 Headphones
USB Stream Output
sysdefault:CARD=wm8960soundcard
wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
Default Audio Device
dmix:CARD=wm8960soundcard,DEV=0
wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
Direct sample mixing device
dsnoop:CARD=wm8960soundcard,DEV=0
wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
Direct sample snooping device
hw:CARD=wm8960soundcard,DEV=0
wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
Direct hardware device without any conversions
plughw:CARD=wm8960soundcard,DEV=0
wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0
Hardware device with all software conversions
usbstream:CARD=wm8960soundcard
wm8960-soundcard
USB Stream Output如何在使用PJUSA(PJSIP)时更改默认的arecord示例率:
PJUSA在启动时初始化ALSA:
11:56:12.951 alsa_dev.c ..ALSA driver found 32 devices
11:56:12.951 alsa_dev.c ..ALSA initializedalsa_dev.c位于pjproject/pjmedia/src/pjmedia-audiodev/alsa_dev.c
在第270行中设置了默认的采样率:
/* Set the default sample rate */
adi->default_samples_per_sec = 8000;只需将值更改为所需的采样率(麦克风必须能够达到该采样率)。
发布于 2021-06-23 17:33:23
阅读它编写的arecord文档(请参阅man arecord),
-r、--rate=#<Hz>采样率(赫兹)。默认利率是8000赫兹。...
所以您可以看到,速率不是通过asound.conf来控制的;它是使用这个命令行标志来控制的。
https://unix.stackexchange.com/questions/655483
复制相似问题