[pulseaudio-discuss] Routing sink to source

Zoltán Szabó zoell at zoell.us
Tue Nov 13 00:20:58 UTC 2018


Hi Daniel,

Thanks for your advice but as I can see this move source etc works only
after the device is opened and audio is flowing which I don't know when it
will happen.

I made some progress. Now the solution works with one problem.

This is my configuration now:
pactl load-module module-null-sink sink_name=pa_sink_app01
pactl load-module module-virtual-source source_name=pa_source_app01
uplink_sink=pa_sink_app02

And I start my apps like this:
PULSE_SINK=pa_sink_app01 PULSE_SOURCE=pa_source_app01 ./app01
PULSE_SINK=pa_sink_app02 PULSE_SOURCE=pa_sink_app01.monitor ./app02

The goal is to route app01 source to app02 sink. And route app02 source to
app01 sink.
Note: for app02, I can use the sink monitor as a source, but app01 (chrome
browser) won't be able to open the app02's sink's monitor, no idea why.
Need to work around it so I added a virtual source which can be opened by
app01.

This scenario is fully working with one problem. The audio is also routed
back from app01 sink to app01 source, which I don't need. Interestingly
this route stops after like 10 seconds, just like an echo cancellation
kicks in somewhere.

Wondering if this is logically correct and it is just me who cannot see why
app01 sink routed to app01 source.

Here are the created sinks and sources:

*# gosu pulseaudio pacmd list-sinks  *
2 sink(s) available.
  * index: 0
name: <pa_sink_app01>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
state: IDLE
suspend cause:
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
0.00 dB
        balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 2.48 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 0
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
             Stereo
used by: 0
linked by: 1
configured latency: 5.00 ms; range is 0.50 .. 2000.00 ms
module: 2
properties:
device.description = "Null Output"
device.class = "abstract"
device.icon_name = "audio-card"
    index: 1
name: <pa_sink_app02>
driver: <module-virtual-source.c>
flags: DECIBEL_VOLUME FLAT_VOLUME
state: IDLE
suspend cause:
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
0.00 dB
        balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 2
sample spec: float32le 2ch 44100Hz
channel map: front-left,front-right
             Stereo
used by: 0
linked by: 0
fixed latency: 250.00 ms
module: 3
properties:
device.master_device = "pa_sink_app01.monitor"
device.class = "uplink sink"
device.uplink_sink.name = "pa_sink_app02"
device.description = "Uplink Sink pa_sink_app02 on Monitor of Null Output"
device.icon_name = "audio-card"


*# pacmd list-sources*
3 source(s) available.
    index: 0
name: <pa_sink_app01.monitor>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
suspend cause:
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
0.00 dB
        balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 344 KiB
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
             Stereo
used by: 1
linked by: 1
configured latency: 2000.00 ms; range is 0.50 .. 2000.00 ms
monitor_of: 0
module: 2
properties:
device.description = "Monitor of Null Output"
device.class = "monitor"
device.icon_name = "audio-input-microphone"
  * index: 1
name: <pa_source_app01>
driver: <module-virtual-source.c>
flags: HW_MUTE_CTRL LATENCY DYNAMIC_LATENCY
state: IDLE
suspend cause:
priority: 1000
volume: front-left: 65536 / 100%,   front-right: 65536 / 100%
        balance 0.00
base volume: 65536 / 100%
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 172 KiB
sample spec: float32le 2ch 44100Hz
channel map: front-left,front-right
             Stereo
used by: 0
linked by: 0
configured latency: 2000.00 ms; range is 0.50 .. 2000.00 ms
module: 3
properties:
device.master_device = "pa_sink_app01.monitor"
device.class = "filter"
device.vsource.name = "pa_source_app01"
device.description = "Virtual Source pa_source_app01 on Monitor of Null
Output"
device.icon_name = "audio-input-microphone"
    index: 2
name: <pa_sink_app02.monitor>
driver: <module-virtual-source.c>
flags: DECIBEL_VOLUME
state: IDLE
suspend cause:
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% /
0.00 dB
        balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 0 KiB
sample spec: float32le 2ch 44100Hz
channel map: front-left,front-right
             Stereo
used by: 0
linked by: 0
fixed latency: 250.00 ms
monitor_of: 1
module: 3
properties:
device.description = "Monitor of Uplink Sink pa_sink_app02 on Monitor of
Null Output"
device.class = "monitor"
device.icon_name = "audio-input-microphone"


And here are some logs from pulseaudio for a media comes in and goes out
between app01 and app02:

When I first start app01:
(  93.448|  59.154) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
(  93.448|   0.000) I: [pulseaudio] client.c: Created 2 "Native client
(TCP/IP client from 127.0.0.1:59296)"
(  93.449|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
(  93.449|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
(  93.449|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
(  95.290|   1.841) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
(  95.290|   0.000) I: [pulseaudio] client.c: Created 3 "Native client
(TCP/IP client from 127.0.0.1:59314)"
(  95.291|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
(  95.291|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
(  95.291|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
(  95.292|   0.001) D: [pulseaudio] sink-input.c: Negotiated format: pcm,
format.sample_format = "\"float32le\""  format.rate = "44100"
format.channels = "1"  format.channel_map = "\"mono\""
(  95.292|   0.000) I: [pulseaudio] sink-input.c: Trying to change sample
rate
(  95.292|   0.000) I: [pulseaudio] sink-input.c: Rate changed to 44100 Hz
(  95.292|   0.000) I: [pulseaudio] resampler.c: Forcing resampler 'copy',
because of fixed, identical sample rates.
(  95.292|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
(  95.292|   0.000) D: [pulseaudio] resampler.c:        I00
(  95.292|   0.000) D: [pulseaudio] resampler.c:     +------
(  95.292|   0.000) D: [pulseaudio] resampler.c: O00 | 1.000
(  95.292|   0.000) D: [pulseaudio] resampler.c: O01 | 1.000
(  95.292|   0.000) I: [pulseaudio] remap_sse.c: Using SSE2 mono to stereo
remapping
(  95.292|   0.000) D: [pulseaudio] resampler.c: Resampler:
(  95.292|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 44100
(method copy)
(  95.292|   0.000) D: [pulseaudio] resampler.c:   format float32le ->
s16le (intermediate s16le)
(  95.292|   0.000) D: [pulseaudio] resampler.c:   channels 1 -> 2
(resampling 1)
(  95.292|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
(  95.292|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
(  95.292|   0.000) I: [pulseaudio] sink-input.c: Created input 0
"Playback" on pa_sink_app01 with sample spec float32le 1ch 44100Hz and
channel map mono
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     application.icon_name
= "chromium-browser"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     media.name =
"Playback"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     application.name =
"Chromium"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     native-protocol.peer
= "TCP/IP client from 127.0.0.1:59314"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:
 native-protocol.version = "29"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     application.process.id
= "298"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:
 application.process.user = "root"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:
 application.process.host = "49132fc42dd8"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:
 application.process.binary = "chrome"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:     application.language
= "C"
(  95.292|   0.000) I: [pulseaudio] sink-input.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
(  95.292|   0.000) I: [pulseaudio] protocol-native.c: Requested
tlength=69.66 ms, minreq=11.61 ms
(  95.292|   0.000) D: [pulseaudio] protocol-native.c: Adjust latency mode
enabled, configuring sink latency to half of overall latency.
(  95.292|   0.000) D: [pulseaudio] protocol-native.c: Requested
latency=23.22 ms, Received latency=23.22 ms
(  95.292|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=8192, base=4, prebuf=6148, minreq=2048
maxrewind=0
(  95.292|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=8192, base=4, prebuf=6148, minreq=2048
maxrewind=0
(  95.292|   0.000) I: [pulseaudio] protocol-native.c: Final latency 69.66
ms = 23.22 ms + 2*11.61 ms + 23.22 ms
(  95.293|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
(  95.293|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
(  95.293|   0.000) D: [null-sink] sink-input.c: Requesting rewind due to
uncorking
(  95.293|   0.000) D: [null-sink] module-null-sink.c: Requested to rewind
4096 bytes.
(  95.293|   0.000) D: [null-sink] sink.c: Processing rewind...
(  95.294|   0.000) D: [null-sink] source.c: Processing rewind...
(  95.294|   0.000) D: [null-sink] source-output.c: Have to rewind 8192
bytes on implementor.
(  95.294|   0.000) D: [null-sink] module-null-sink.c: Rewound 4096 bytes.
(  96.619|   1.325) D: [pulseaudio] source-output.c: Negotiated format:
pcm, format.sample_format = "\"s16le\""  format.rate = "44100"
format.channels = "2"  format.channel_map = "\"front-left,front-right\""
(  96.620|   0.000) I: [pulseaudio] source-output.c: Trying to change
sample rate
(  96.620|   0.000) I: [pulseaudio] source-output.c: Rate changed to 44100
Hz
(  96.620|   0.000) I: [pulseaudio] resampler.c: Forcing resampler 'copy',
because of fixed, identical sample rates.
(  96.620|   0.000) D: [pulseaudio] resampler.c: Resampler:
(  96.620|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 44100
(method copy)
(  96.620|   0.000) D: [pulseaudio] resampler.c:   format float32le ->
s16le (intermediate s16le)
(  96.620|   0.000) D: [pulseaudio] resampler.c:   channels 2 -> 2
(resampling 2)
(  96.620|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=8, prebuf=0, minreq=1 maxrewind=0
(  96.620|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=8, prebuf=0, minreq=8 maxrewind=0
(  96.620|   0.000) I: [pulseaudio] source-output.c: Created output 1
"RecordStream" on pa_source_app01 with sample spec s16le 2ch 44100Hz and
channel map front-left,front-right
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.icon_name = "chromium-browser"
(  96.620|   0.000) I: [pulseaudio] source-output.c:     media.name =
"RecordStream"
(  96.620|   0.000) I: [pulseaudio] source-output.c:     application.name =
"Chrome input"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 native-protocol.peer = "TCP/IP client from 127.0.0.1:59296"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 native-protocol.version = "29"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
application.process.id = "298"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.process.user = "root"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.process.host = "49132fc42dd8"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.process.binary = "chrome"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.language = "C"
(  96.620|   0.000) I: [pulseaudio] source-output.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
(  96.620|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=0, base=4, prebuf=1, minreq=0 maxrewind=0
(  96.620|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=4194304, base=4, prebuf=4, minreq=4 maxrewind=0
(  96.620|   0.000) I: [pulseaudio] protocol-native.c: Final latency 9.99
ms = 4.99 ms + 5.00 ms
( 102.006|   5.386) I: [pulseaudio] source-output.c: Freeing output 1
"RecordStream"
( 105.302|   3.295) D: [null-sink] sink-input.c: Requesting rewind due to
corking
( 105.303|   0.000) D: [null-sink] module-null-sink.c: Requested to rewind
4096 bytes.
( 105.303|   0.000) D: [null-sink] sink.c: Processing rewind...
( 105.303|   0.000) D: [null-sink] sink-input.c: Have to rewind 3744 bytes
on render memblockq.
( 105.303|   0.000) D: [null-sink] sink-input.c: Have to rewind 3744 bytes
on implementor.
( 105.303|   0.000) D: [null-sink] source.c: Processing rewind...
( 105.303|   0.000) D: [null-sink] source-output.c: Have to rewind 7488
bytes on implementor.
( 105.303|   0.000) D: [null-sink] module-null-sink.c: Rewound 3744 bytes.
( 105.303|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 105.303|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 110.304|   5.001) D: [null-sink] module-null-sink.c: Requested to rewind
352800 bytes.
( 110.304|   0.000) D: [null-sink] sink.c: Processing rewind...
( 110.304|   0.000) I: [pulseaudio] sink-input.c: Freeing input 0 "Playback"
( 110.304|   0.000) I: [pulseaudio] client.c: Freed 3 "Chromium"
( 110.304|   0.000) D: [null-sink] source.c: Processing rewind...
( 110.304|   0.000) D: [null-sink] source-output.c: Have to rewind 4840
bytes on implementor.
( 110.304|   0.000) D: [null-sink] module-null-sink.c: Rewound 2420 bytes.
( 110.304|   0.000) I: [pulseaudio] protocol-native.c: Connection died.


And later when I start the media, so app02 is OK, but app01 plays the sink
back to it's own source too:
( 140.591|  26.491) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
( 140.591|   0.000) I: [pulseaudio] client.c: Created 10 "Native client
(TCP/IP client from 127.0.0.1:59666)"
( 140.591|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
( 140.591|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
( 140.591|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
( 140.591|   0.000) D: [pulseaudio] sink-input.c: Negotiated format: pcm,
format.sample_format = "\"float32le\""  format.rate = "44100"
format.channels = "1"  format.channel_map = "\"mono\""
( 140.591|   0.000) I: [pulseaudio] sink-input.c: Trying to change sample
rate
( 140.591|   0.000) I: [pulseaudio] sink-input.c: Rate changed to 44100 Hz
( 140.591|   0.000) I: [pulseaudio] resampler.c: Forcing resampler 'copy',
because of fixed, identical sample rates.
( 140.591|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
( 140.591|   0.000) D: [pulseaudio] resampler.c:        I00
( 140.591|   0.000) D: [pulseaudio] resampler.c:     +------
( 140.591|   0.000) D: [pulseaudio] resampler.c: O00 | 1.000
( 140.591|   0.000) D: [pulseaudio] resampler.c: O01 | 1.000
( 140.591|   0.000) I: [pulseaudio] remap_sse.c: Using SSE2 mono to stereo
remapping
( 140.591|   0.000) D: [pulseaudio] resampler.c: Resampler:
( 140.591|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 44100
(method copy)
( 140.591|   0.000) D: [pulseaudio] resampler.c:   format float32le ->
s16le (intermediate s16le)
( 140.591|   0.000) D: [pulseaudio] resampler.c:   channels 1 -> 2
(resampling 1)
( 140.591|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
( 140.591|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
( 140.591|   0.000) I: [pulseaudio] sink-input.c: Created input 3
"Playback" on pa_sink_app01 with sample spec float32le 1ch 44100Hz and
channel map mono
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     application.icon_name
= "chromium-browser"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     media.name =
"Playback"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     application.name =
"Chromium"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     native-protocol.peer
= "TCP/IP client from 127.0.0.1:59666"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:
 native-protocol.version = "29"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     application.process.id
= "98"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:
 application.process.user = "root"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:
 application.process.host = "896cea5e6e82"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:
 application.process.binary = "chrome"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:     application.language
= "C"
( 140.591|   0.000) I: [pulseaudio] sink-input.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
( 140.592|   0.000) I: [pulseaudio] protocol-native.c: Requested
tlength=69.66 ms, minreq=11.61 ms
( 140.592|   0.000) D: [pulseaudio] protocol-native.c: Adjust latency mode
enabled, configuring sink latency to half of overall latency.
( 140.592|   0.000) D: [pulseaudio] protocol-native.c: Requested
latency=23.22 ms, Received latency=23.22 ms
( 140.592|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=8192, base=4, prebuf=6148, minreq=2048
maxrewind=0
( 140.592|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=8192, base=4, prebuf=6148, minreq=2048
maxrewind=0
( 140.592|   0.000) I: [pulseaudio] protocol-native.c: Final latency 69.66
ms = 23.22 ms + 2*11.61 ms + 23.22 ms
( 140.592|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 140.593|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 140.593|   0.000) D: [null-sink] sink-input.c: Requesting rewind due to
uncorking
( 140.593|   0.000) D: [null-sink] module-null-sink.c: Requested to rewind
880 bytes.
( 140.593|   0.000) D: [null-sink] sink.c: Processing rewind...
( 140.593|   0.000) D: [null-sink] source.c: Processing rewind...
( 140.593|   0.000) D: [null-sink] source-output.c: Have to rewind 560
bytes on implementor.
( 140.593|   0.000) D: [null-sink] module-null-sink.c: Rewound 280 bytes.
( 140.930|   0.336) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
( 140.930|   0.000) I: [pulseaudio] client.c: Created 11 "Native client
(TCP/IP client from 127.0.0.1:59672)"
( 140.930|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
( 140.930|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
( 140.930|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
( 140.931|   0.000) D: [pulseaudio] sink-input.c: Negotiated format: pcm,
format.sample_format = "\"float32le\""  format.rate = "44100"
format.channels = "2"  format.channel_map = "\"front-left,front-right\""
( 140.931|   0.000) I: [pulseaudio] sink-input.c: Trying to change sample
rate
( 140.931|   0.000) I: [pulseaudio] sink-input.c: Rate changed to 44100 Hz
( 140.931|   0.000) I: [pulseaudio] resampler.c: Forcing resampler 'copy',
because of fixed, identical sample rates.
( 140.931|   0.000) D: [pulseaudio] resampler.c: Resampler:
( 140.931|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 44100
(method copy)
( 140.931|   0.000) D: [pulseaudio] resampler.c:   format float32le ->
s16le (intermediate s16le)
( 140.931|   0.000) D: [pulseaudio] resampler.c:   channels 2 -> 2
(resampling 2)
( 140.931|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
( 140.931|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
( 140.931|   0.000) I: [pulseaudio] sink-input.c: Created input 4
"Playback" on pa_sink_app01 with sample spec float32le 2ch 44100Hz and
channel map front-left,front-right
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     application.icon_name
= "chromium-browser"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     media.name =
"Playback"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     application.name =
"Chromium"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     native-protocol.peer
= "TCP/IP client from 127.0.0.1:59672"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:
 native-protocol.version = "29"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     application.process.id
= "98"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:
 application.process.user = "root"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:
 application.process.host = "896cea5e6e82"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:
 application.process.binary = "chrome"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:     application.language
= "C"
( 140.931|   0.000) I: [pulseaudio] sink-input.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
( 140.931|   0.000) I: [pulseaudio] protocol-native.c: Requested
tlength=34.83 ms, minreq=5.80 ms
( 140.931|   0.000) D: [pulseaudio] protocol-native.c: Adjust latency mode
enabled, configuring sink latency to half of overall latency.
( 140.931|   0.000) D: [pulseaudio] protocol-native.c: Requested
latency=11.61 ms, Received latency=11.61 ms
( 140.931|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=8192, base=8, prebuf=6152, minreq=2048
maxrewind=0
( 140.931|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=8192, base=8, prebuf=6152, minreq=2048
maxrewind=0
( 140.931|   0.000) I: [pulseaudio] protocol-native.c: Final latency 34.83
ms = 11.61 ms + 2*5.80 ms + 11.61 ms
( 140.931|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 140.932|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 140.932|   0.000) D: [null-sink] sink-input.c: Requesting rewind due to
uncorking
( 140.932|   0.000) D: [null-sink] module-null-sink.c: Requested to rewind
880 bytes.
( 140.932|   0.000) D: [null-sink] sink.c: Processing rewind...
( 140.932|   0.000) D: [null-sink] sink-input.c: Have to rewind 164 bytes
on render memblockq.
( 140.932|   0.000) D: [null-sink] source.c: Processing rewind...
( 140.932|   0.000) D: [null-sink] source-output.c: Have to rewind 328
bytes on implementor.
( 140.932|   0.000) D: [null-sink] module-null-sink.c: Rewound 164 bytes.
( 141.302|   0.369) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
( 141.302|   0.000) I: [pulseaudio] client.c: Created 12 "Native client
(TCP/IP client from 127.0.0.1:59674)"
( 141.302|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
( 141.302|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
( 141.302|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
( 141.302|   0.000) D: [pulseaudio] source-output.c: Negotiated format:
pcm, format.sample_format = "\"s16le\""  format.rate = "8000"
format.channels = "1"  format.channel_map = "\"mono\""
( 141.302|   0.000) I: [pulseaudio] source-output.c: Trying to change
sample rate
( 141.302|   0.000) I: [pulseaudio] source.c: Cannot update rate,
SOURCE_IS_RUNNING, will keep using 44100 Hz
( 141.302|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
( 141.302|   0.000) D: [pulseaudio] resampler.c:        I00   I01
( 141.302|   0.000) D: [pulseaudio] resampler.c:     +------------
( 141.302|   0.000) D: [pulseaudio] resampler.c: O00 | 0.500 0.500
( 141.302|   0.000) I: [pulseaudio] remap.c: Using generic matrix remapping
( 141.302|   0.000) D: [pulseaudio] resampler.c: Resampler:
( 141.302|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 8000
(method speex-float-1)
( 141.302|   0.000) D: [pulseaudio] resampler.c:   format s16le -> s16le
(intermediate float32le)
( 141.302|   0.000) D: [pulseaudio] resampler.c:   channels 2 -> 1
(resampling 1)
( 141.302|   0.000) I: [pulseaudio] resampler.c: Choosing speex quality
setting 1.
( 141.302|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
( 141.302|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
( 141.302|   0.000) I: [pulseaudio] source-output.c: Created output 3 "ALSA
Capture" on pa_sink_app01.monitor with sample spec s16le 1ch 8000Hz and
channel map mono
( 141.302|   0.000) I: [pulseaudio] source-output.c:     media.name = "ALSA
Capture"
( 141.302|   0.000) I: [pulseaudio] source-output.c:     application.name =
"ALSA plug-in [app02]"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 native-protocol.peer = "TCP/IP client from 127.0.0.1:59674"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 native-protocol.version = "29"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
application.process.id = "183"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 application.process.user = "root"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 application.process.host = "896cea5e6e82"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 application.process.binary = "app02"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 application.language = "C"
( 141.302|   0.000) I: [pulseaudio] source-output.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
( 141.303|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=0, base=2, prebuf=1, minreq=0 maxrewind=0
( 141.303|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=4194304, base=2, prebuf=2, minreq=2 maxrewind=0
( 141.303|   0.000) I: [pulseaudio] protocol-native.c: Final latency 64.00
ms = 32.00 ms + 32.00 ms
( 141.336|   0.032) I: [pulseaudio] socket-server.c: TCP connection
accepted by tcpwrap.
( 141.336|   0.000) I: [pulseaudio] client.c: Created 13 "Native client
(TCP/IP client from 127.0.0.1:59676)"
( 141.336|   0.000) D: [pulseaudio] protocol-native.c: Protocol version:
remote 29, local 29
( 141.336|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: no
( 141.336|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: no
( 141.336|   0.000) D: [pulseaudio] sink-input.c: Negotiated format: pcm,
format.sample_format = "\"s16le\""  format.rate = "8000"  format.channels =
"1"  format.channel_map = "\"mono\""
( 141.336|   0.000) I: [pulseaudio] sink-input.c: Trying to change sample
rate
( 141.336|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
( 141.336|   0.000) D: [pulseaudio] resampler.c:        I00
( 141.336|   0.000) D: [pulseaudio] resampler.c:     +------
( 141.336|   0.000) D: [pulseaudio] resampler.c: O00 | 1.000
( 141.336|   0.000) D: [pulseaudio] resampler.c: O01 | 1.000
( 141.336|   0.000) I: [pulseaudio] remap_sse.c: Using SSE2 mono to stereo
remapping
( 141.336|   0.000) D: [pulseaudio] resampler.c: Resampler:
( 141.336|   0.000) D: [pulseaudio] resampler.c:   rate 8000 -> 44100
(method speex-float-1)
( 141.336|   0.000) D: [pulseaudio] resampler.c:   format s16le ->
float32le (intermediate float32le)
( 141.336|   0.000) D: [pulseaudio] resampler.c:   channels 1 -> 2
(resampling 1)
( 141.336|   0.000) I: [pulseaudio] resampler.c: Choosing speex quality
setting 1.
( 141.336|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=33554432, tlength=0, base=8, prebuf=0, minreq=1 maxrewind=0
( 141.336|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=33554432, tlength=33554432, base=8, prebuf=0, minreq=8 maxrewind=0
( 141.336|   0.000) I: [pulseaudio] sink-input.c: Created input 5 "ALSA
Playback" on pa_sink_app02 with sample spec s16le 1ch 8000Hz and channel
map mono
( 141.336|   0.000) I: [pulseaudio] sink-input.c:     media.name = "ALSA
Playback"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:     application.name =
"ALSA plug-in [app02]"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:     native-protocol.peer
= "TCP/IP client from 127.0.0.1:59676"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:
 native-protocol.version = "29"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:     application.process.id
= "183"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:
 application.process.user = "root"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:
 application.process.host = "896cea5e6e82"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:
 application.process.binary = "app02"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:     application.language
= "C"
( 141.336|   0.000) I: [pulseaudio] sink-input.c:
 application.process.machine_id = "3d6ff2f75c7d3ae927580249a28e7e05"
( 141.336|   0.000) I: [pulseaudio] protocol-native.c: Requested
tlength=256.00 ms, minreq=32.00 ms
( 141.336|   0.000) D: [pulseaudio] protocol-native.c: Early requests mode
enabled, configuring sink latency to minreq.
( 141.337|   0.000) D: [pulseaudio] protocol-native.c: Requested
latency=32.00 ms, Received latency=250.00 ms
( 141.337|   0.000) D: [pulseaudio] memblockq.c: memblockq requested:
maxlength=4194304, tlength=12000, base=2, prebuf=512, minreq=4000
maxrewind=0
( 141.337|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized:
maxlength=4194304, tlength=12000, base=2, prebuf=512, minreq=4000
maxrewind=0
( 141.337|   0.000) I: [pulseaudio] protocol-native.c: Final latency
1000.00 ms = 250.00 ms + 2*250.00 ms + 250.00 ms
( 141.337|   0.000) D: [pulseaudio] module-virtual-source.c: Resuming
source pa_source_app01, because its uplink sink became active.
( 141.355|   0.017) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 150.955|   9.600) D: [null-sink] sink-input.c: Requesting rewind due to
corking
( 150.956|   0.000) D: [null-sink] module-null-sink.c: Requested to rewind
880 bytes.
( 150.956|   0.000) D: [null-sink] sink.c: Processing rewind...
( 150.956|   0.000) D: [null-sink] sink-input.c: Have to rewind 576 bytes
on render memblockq.
( 150.956|   0.000) D: [null-sink] sink-input.c: Have to rewind 1028 bytes
on implementor.
( 150.956|   0.000) D: [null-sink] sink-input.c: Have to rewind 576 bytes
on render memblockq.
( 150.956|   0.000) D: [null-sink] source.c: Processing rewind...
( 150.956|   0.000) D: [null-sink] source-output.c: Have to rewind 1152
bytes on implementor.
( 150.956|   0.000) D: [null-sink] module-null-sink.c: Rewound 576 bytes.
( 150.956|   0.000) D: [null-sink] protocol-native.c: Requesting rewind due
to end of underrun.
( 155.957|   5.000) D: [null-sink] module-null-sink.c: Requested to rewind
880 bytes.
( 155.957|   0.000) D: [null-sink] sink.c: Processing rewind...
( 155.957|   0.000) D: [null-sink] sink-input.c: Have to rewind 236 bytes
on render memblockq.
( 155.957|   0.000) D: [null-sink] source.c: Processing rewind...
( 155.957|   0.000) I: [pulseaudio] sink-input.c: Freeing input 3 "Playback"
( 155.957|   0.000) D: [null-sink] source-output.c: Have to rewind 472
bytes on implementor.
( 155.957|   0.000) I: [pulseaudio] client.c: Freed 10 "Chromium"
( 155.957|   0.000) I: [pulseaudio] protocol-native.c: Connection died.
( 155.957|   0.000) D: [null-sink] module-null-sink.c: Rewound 236 bytes.
( 165.359|   9.401) I: [pulseaudio] source-output.c: Freeing output 3 "ALSA
Capture"
( 165.359|   0.000) I: [pulseaudio] client.c: Freed 12 "ALSA plug-in
[app02]"
( 165.359|   0.000) I: [pulseaudio] protocol-native.c: Connection died.
( 165.359|   0.000) D: [null-sink] sink-input.c: Requesting rewind due to
corking
( 165.359|   0.000) D: [null-sink] sink-input.c: Have to rewind 2 bytes on
implementor.
( 165.360|   0.000) I: [pulseaudio] sink-input.c: Freeing input 5 "ALSA
Playback"
( 165.360|   0.000) I: [pulseaudio] client.c: Freed 13 "ALSA plug-in
[app02]"
( 165.360|   0.000) I: [pulseaudio] protocol-native.c: Connection died.

On Fri, Nov 9, 2018 at 8:39 AM Daniel <windseeker at gmx.de> wrote:

> I'm not sure if I understood completely, but If your recording app cannot
> record via pulseaudio at all, then I don't know how to solve this with
> pulseaudio.
>
> If your recording app CAN record via pulseaudio, then of course you can
> also use "pactl" to move sinks and sources with "move-sink-input" and
> "move-source-output" commands headless from command line/script/whatever.
>
> Example: I have my audio player "audacious" playing to pulseaudio, have
> "pacat -r " recording from pulseaudio and I've loaded a null-sink module.
>
> Let's look around in pulseaudio
>
> $ pactl list clients short
> [...]
> 36      protocol-native.c       pacat
> 57      protocol-native.c       audacious
> [...]
>
> $ pactl list sinks short
> 0       alsa_output.pci-0000_00_1f.3.analog-stereo
> module-alsa-card.c      s16le 2ch 44100Hz       RUNNING
> [...]
> 4       null    module-null-sink.c      s16le 2ch 44100Hz       IDLE
>
> $ pactl list sources short
> 0       alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
> module-alsa-card.c      s16le 2ch 44100HzRUNNING
> [...]
> 4       null.monitor    module-null-sink.c      s16le 2ch 44100Hz
>  RUNNING
>
> Now lets see where audacious (Client 57) is playing to:
>
> $ pactl list sink-inputs short
> [...]
> 8       0       57      protocol-native.c       float32le 2ch 44100Hz
>
> Well client 57 has a sink-input 8 which it uses to play to sink 0. That's
> my soundcard, d'oh! So let's move it to sink 4, the null sink.
>
> $ pactl move-sink-input 8 4
>
> Now audacious plays to the null sink. Good. Now let's look at the
> recording app pacat, client 36:
>
> $ pactl list source-outputs short
> [...]
> 16      0       36      protocol-native.c       s16le 2ch 44100Hz
> [...]
>
> Okay, with its source-output 16 it records from my soundcard (source 0)
> instead of null.monitor (source 4). So let's move this, too:
>
> $ pactl move-source-output 16 4
>
> Et voila, I'm recording with pacat, what my audacious player is playing.
>
> Hope that helps.
>
> Regards,
> Daniel
>
> Am Fr., 9. Nov. 2018 um 08:41 Uhr schrieb Zoltán Szabó <zoell at zoell.us>:
>
>> Hi Daniel,
>>
>> I am running these in console. I don't have GUI. app01 that should use
>> the monitor is Chrome in headless mode and it just simply not able to open
>> the monitor. It can open and use a pipe source or virtual source but not a
>> null sink's monitor :(
>>
>> Zoltan
>>
>> On Fri, Nov 9, 2018 at 5:30 AM Daniel <windseeker at gmx.de> wrote:
>>
>>> Hi Zoltán,
>>>
>>> Since years now I successfully use the way you mentioned in "P.S.". I
>>> play to a null sink and record from its monitor.
>>>
>>> I'm not sure why app02 should not be able to connect to this monitor. If
>>> app02 is recording from PA in general, independent of "from where", then it
>>> should show in pavucontrol in the "recording" tab. There you can set it's
>>> input source to the null sink monitor where app01 plays to.
>>>
>>> Regards,
>>> Daniel
>>>
>>> Am Do., 8. Nov. 2018, 19:50 hat Zoltán Szabó <zoell at zoell.us>
>>> geschrieben:
>>>
>>>> Hi,
>>>>
>>>> I would like to connect my app01's audio output to my app02's
>>>> microphone.
>>>>
>>>> Here is what I have tried so far:
>>>>
>>>> I create a file pipe sink for my app01:
>>>> load-module module-pipe-sink sink_name=pa_speaker_app01
>>>> file=/home/pulseaudio/pa_speaker_app01 format=ulaw rate=8000 channels=1
>>>>
>>>> I create a file pipe sink for my app02:
>>>> load-module module-pipe-sink sink_name=pa_speaker_app02
>>>> file=/home/pulseaudio/pa_speaker_app02 format=ulaw rate=8000 channels=1
>>>>
>>>> This way both of my apps have an available output device.
>>>>
>>>> I create a virtual source as a mic for my other app01 and 02:
>>>> load-module module-virtual-source source_name=pa_virtual_source_app01
>>>> uplink_sink=pa_speaker_app02
>>>> load-module module-virtual-source source_name=pa_virtual_source_app02
>>>> uplink_sink=pa_speaker_app01
>>>>
>>>> This way anything played on pa_speaker_app02 should be routed to the
>>>> app01's microphone pa_virtual_source_app01, right? Also should be true for
>>>> app01 to app02.
>>>>
>>>> So I start my app01 and 2:
>>>> PULSE_SOURCE=pa_virtual_source_app01 PULSE_SINK=pa_speaker_app01
>>>> ./startapp01
>>>> PULSE_SOURCE=pa_virtual_source_app02 PULSE_SINK=pa_speaker_app02
>>>> ./startapp01
>>>>
>>>> But this is not working at all. Is this not the right approach? I can
>>>> see in the PA logs that the apps are connected successfully to PA.
>>>>
>>>> PS: I also tried to crate a null sink, but app01 (it is actually
>>>> chrome) is not able to open the null sink's monitor as a mic.
>>>>
>>>> Thanks
>>>> zoell
>>>>
>>>> _______________________________________________
>>>> pulseaudio-discuss mailing list
>>>> pulseaudio-discuss at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>>>
>>> _______________________________________________
>>> pulseaudio-discuss mailing list
>>> pulseaudio-discuss at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>>
>> _______________________________________________
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20181113/837ec984/attachment-0001.html>


More information about the pulseaudio-discuss mailing list