Question

I'm working on a mobile app for Maemo/MeeGo and Maemo uses PulseAudio. I want to play a mp3 to caller (and cancel the mic when doing it, and not to listen caller, everything should be done on background), to do this, I have to redirect Audio Output from a certain (if not possible, all) app, fake it as a Input and make Phone app use it.

On my Ubuntu PC, I did it with pavucontrol. I created a NULL sink, then:

Audio Output (from Amarok) --> to NULL Output 
Skype Input <-- NULL Output
Skype Output --> NULL

And It worked, Amarok played the music and It was streaming to Skype, without playing it to me and I didn't hear anything about all process. Problem is; a) Maemo does not have pavucontrol. b) Even If it did (or if I package it) It wouldn't be any good since It's a only-GUI app and I have to do all of this stuff on background, without any user input. (mean: CLI or API)

Asked about this on Freenode #pulseaudio and a helpful guy said "It can pretty much be done via pactl or pacmd, the commands you want are move-sink-input and move-source-output, but you need to know device and stream indexes." So It looks like pavucontrol is just a GUI, pactl and pacmd are the real deal, and most importantly, they're CLI apps.

I'm really thankful to him but I don't know anything about "pactl", "pacmd", "move-sink-input" or "device/stream indexes" so I need a very simplified manual page, or a source of similar app, a one-liner command (two? whole page of commands?, just give me them! ^^) or someone with enough patience to explain this stuff to me.

Was it helpful?

Solution

The manuals for pactl and pacmd are readily available if you give it a search. I found them here:

pactl

pacmd (pulse-cli-syntax)

I think you are interested in the following excerpt from the pactl manual:

move-sink-input ID SINK : Move the specified playback stream (identified by its numerical index) to the specified sink (identified by its symbolic name or numerical index).

You should be able to use pactl list sink-inputs, pactl list source-outputs, pactl list sinks, and pactl list sources combined with some grep and/or sed or something of that nature to programmatically determine the correct stream and sink.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top