[pulseaudio-discuss] How to capture one of multiple radios that these radios play at the same time?

Colin Guthrie gmane at colin.guthr.ie
Mon Nov 22 00:55:48 PST 2010

'Twas brillig, and Tsai Yu-Chin at 20/11/10 15:11 did gyre and gimble:
> I have an idea but I am not sure that my idea is feasible.
> I want to create many monitors and many sinks.
> Assign one sink input per sink which is assigned to a monitor.
> In other word, there is one sink input in one sink and there is one
> sink in one monitor.
> Maybe we can record separate audio using this approach.
> But I don't know how to create sink and monitor in C code.
> And how to create virtual device in C code.
> Can you give me suggestions?
> And can you teach me how to create sink, monitor and Virtual device in C code.
> I can't find any relative information above on the web.

Depending on your scenario, you can indeed create virtual sinks, ensure
each stream plays to it's own "private" sink and then record directly
from there.

Do you really want to hear the audio out of a real sound card? (i.e. is
the recording of the sound the primary goal?)

If you *do* want to hear the sound, then I suggest either
module-remap-sink or module-combine. Both of these allow you to piggy
back on to a real sink. If you do not want to actually hear the sound,
then module-null-sink is probably what you want.

You could do something like the following:

pactl load-module module-null-sink sink_name=radio1
pactl load-module module-null-sink sink_name=radio2
pactl load-module module-null-sink sink_name=radio3

These three commands will create three virtual sinks (called Radio1,
Radio2 and Radio3).

You can then launch your radio player as follows:

PULSE_SINK=radio1 myradioapp
PULSE_SINK=radio2 myradioapp
PULSE_SINK=radio3 myradioapp

Or similar.

Hope that helps.



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list