[pulseaudio-discuss] Virtual sink to pipe audio stream to STDIN of shell-command?

Alexander E. Patrakov patrakov at gmail.com
Sat Aug 1 18:11:11 PDT 2015

02.08.2015 01:17, Rene Bartsch wrote:
> Hi,
> with
> load-module module-pipe-sink format=s32le rate=96000 channels=8
> channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
> sink_name=brutefir.FCA610  file=/tmp/brutefir.FCA610
> sink_properties='device.description="BruteFIR Behringer FCA610"'
> a virtual sink can be created which pipes audio streams to a FIFO. The
> drawback is that an external script has to start external processing of
> the audio stream.
> Is there any way to call a shell command from Pulseaudio and route a
> virtual sink to STDIN of that shell-command?

No. But as this question is really about brutefir, not any arbitrary 
program, here is an alternative way to start it. The drawback is that it 
will not work after logging out and logging in again.

Install JACK.

In /etc/environment, put one line:


In /home/user/.jackdrc, put one line:


In /home/user/.jack_session.sh, put this script, make it executable:

jackd -r -d alsa -d hw:PCUSB -s -r 44100 -p 256 &
( sleep 4 ; brutefir ) &

In /home/user/brutefir_config, put (in this example, a separate filter 
is applied to each channel for room-correction purposes):

sampling_rate: 44100;
#show_progress: false;
filter_length: 1024,64;
convolver_config: "/home/user/.brutefir_wisdom";

coeff "left" {
     filename: "/home/user/.filter-left.pcm";
     format: "FLOAT_LE";

coeff "right" {
     filename: "/home/user/.filter-right.pcm";
     format: "FLOAT_LE";

input "i_left", "i_right" {
     device: "jack" { ports: "pulseaudio:front-left", 
"pulseaudio:front-right"; };
     channels: 2;
     sample: "AUTO";

output "o_left", "o_right" {
     device: "jack" { ports: "alsa_pcm:playback_1", 
"alsa_pcm:playback_2"; };
     channels: 2;
     sample: "AUTO";

filter "f_left" {
     inputs: "i_left"/9;
     outputs: "o_left";
     process: 0;
     coeff: "left";

filter "f_right" {
     inputs: "i_right"/9;
     outputs: "o_right";
     process: 0;
     coeff: "right";

Finally, copy /etc/pulse/default.pa to 
/home/user/.config/pulse/default.pa, and add there:

load-module module-jack-sink connect=no client_name=pulseaudio

Also, let me guess: are you trying to emulate virtual 7.1 sound on 
headphones? Then, if your filter is shorter than 64 samples, then there 
is no need to mess with brutefir at all. Just make a multichannel wav 
file with the contributions of each input channel to the left output, 
and provide it to module-virtual-surround-sink. The limitation to 64 
samples can be easily patched out from module-virtual-surround-sink.

And finally: this is the third request to convolve PulseAudio output 
with something arbitrary. Someone has to sit down and write a native 
replacement for brutefir. Unfortunately, for me, this is not really 
possible, because of the dayjob which keeps me busy 200% of time.

Alexander E. Patrakov

More information about the pulseaudio-discuss mailing list