Re: Routing sink to source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>:
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@xxxxxx> 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@xxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux