我正在编写一个pipewire节点(pipewire版本1.0.0)来同时播放声音并从麦克风录制,音频规格为8kHz采样率,1通道和
SPA_AUDIO_FORMAT_S16
格式。该应用程序可以运行并且还可以播放/录制声音。问题是我启用 libpipewire-module-echo-cancel
并将其配置为使用 webrtc 消除声学回声,因为听不到或记录不到声音。我还更改了应用程序以连接 Echo Cancellation Sink
和 Echo Cancellation Source
节点。管道图似乎没问题:
pw-top的输出:(随着时间的推移
Echo Cancellation Source
和Echo Cancellation Playback
有误差)
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
S 28 0 0 --- --- --- --- 0 Dummy-Driver
S 29 0 0 --- --- --- --- 0 Freewheel-Driver
R 48 2048 48000 6.5ms 10.5us 0.15 0.00 0 S32LE 2 48000 alsa_input.platform-sound.stereo-fallback
R 32 1680 8000 178.4us 136.3us 0.00 0.00 0 F32P 2 48000 + Echo Cancellation Capture
R 33 1680 8000 339.5us 27.0us 0.01 0.00 689 F32P 2 48000 + Echo Cancellation Source
R 34 1680 8000 134.6us 128.2us 0.00 0.00 0 F32P 2 48000 + Echo Cancellation Sink
R 35 1680 8000 429.4us 19.9us 0.01 0.00 689 F32P 2 48000 + Echo Cancellation Playback
R 47 0 0 43.0us 1.1ms 0.00 0.02 0 S32LE 2 48000 + alsa_output.platform-sound.stereo-fallback
R 67 0 0 1.3ms 1.2ms 0.03 0.03 1 S16LE 1 8000 + myapp
R 68 0 0 3.2ms 2.8ms 0.08 0.07 1 S16LE 1 8000 + myapp
pw-link -l :
Echo Cancellation Capture:input_FL
|<- alsa_input.platform-sound.stereo-fallback:capture_FL
Echo Cancellation Capture:input_FR
|<- alsa_input.platform-sound.stereo-fallback:capture_FR
Echo Cancellation Source:capture_FL
|-> myapp:input_FL
Echo Cancellation Source:capture_FR
|-> myapp:input_FR
Echo Cancellation Sink:playback_FL
|<- myapp:output_FL
Echo Cancellation Sink:playback_FR
|<- myapp:output_FR
Echo Cancellation Playback:output_FL
|-> alsa_output.platform-sound.stereo-fallback:playback_FL
Echo Cancellation Playback:output_FR
|-> alsa_output.platform-sound.stereo-fallback:playback_FR
alsa_output.platform-sound.stereo-fallback:playback_FL
|<- Echo Cancellation Playback:output_FL
alsa_output.platform-sound.stereo-fallback:playback_FR
|<- Echo Cancellation Playback:output_FR
alsa_input.platform-sound.stereo-fallback:capture_FL
|-> Echo Cancellation Capture:input_FL
alsa_input.platform-sound.stereo-fallback:capture_FR
|-> Echo Cancellation Capture:input_FR
myapp:input_FL
|<- Echo Cancellation Source:capture_FL
myapp:input_FR
|<- Echo Cancellation Source:capture_FR
myapp:output_FL
|-> Echo Cancellation Sink:playback_FL
myapp:output_FR
|-> Echo Cancellation Sink:playback_FR
pipewire相关配置:
{ name = libpipewire-module-echo-cancel
args = {
library.name = aec/libspa-aec-webrtc
node.latency = 1700/8000
# monitor.mode = false
capture.props = {
node.name = "Echo Cancellation Capture"
#audio.channels = 1
node.passive = true
target.object = "alsa_input.platform-sound.stereo-fallback"
}
source.props = {
node.name = "Echo Cancellation Source"
#audio.channels = 1
}
sink.props = {
node.name = "Echo Cancellation Sink"
#audio.channels = 1
}
playback.props = {
node.name = "Echo Cancellation Playback"
#audio.channels = 1
node.passive = true
target.object = "alsa_output.platform-sound.stereo-fallback"
}
}
}
我怀疑 8kHz 采样率,因为 aec3 似乎无法使用它,所以改为使用 aecm (
aec.args = {mobile = 1}
) 但仍然无法工作。
另一个问题是,为什么通道数在所有图表和命令输出中显示为 2,而声音是单通道,并且应用程序被编写为与单通道一起使用,如您所见:
params_play[0] = spa_format_audio_raw_build(&b_play, SPA_PARAM_EnumFormat,
&SPA_AUDIO_INFO_RAW_INIT(
.format = SPA_AUDIO_FORMAT_S16,
.channels = 1,
.rate = 8000 ));
我提醒一下,该应用程序在启用回声消除之前可以工作,但启用后,就听不到或记录不到任何声音。谁能帮我解决这个问题?谢谢。
注意:我用 Yocto 为嵌入式板构建了管道线。
我在 PipeWire 中的回声消除模块中遇到了类似的问题。您是否找到了使其发挥作用的解决方案?