Question: How do I wantget the pulseaudio command play
from the Termux app to emit sound over the phone speakers (without rooting the phone or using a proot installation in Termux). Has anyone achieved this?
I cannot find clearworking instructions, but I did find the following:
That said, even some of the older content I'm finding on the internet suggests that Termux can route pulseaudio output to the phone speakers on its own. I just can't find any complete tutorials, and the that actuaool work. The partial information from forum posts are usually from people half-way through attempting a proot or chroot installation of a more expansive Linux distribution under Termux. So perhaps it isI want to interaface play
in Termux with the host Android linux as lightly a possible?.
IP: 224.0.0.56 # default 127.0.0.1?
Port: 4010 # default 4712?
MTU: 320 # "max. transmit unit", default 1500?
Max Latency (ms): 300 # default 100?
Channel Count: 2
Channel Mask: 0
SampleRate: 48000 # cannot change this
framesPerBurst: 192 # cannot change this
- That default IP
224.0.0.56
is probably nonsense. I changed it to 127.0.0.1
in the PulseAudio Rtp Receiver GUI and restarted the server.
- We should probably use the port
4712
as this is the more common value for pulseaudio servers?
- It seems like MTU usually defaults to
1500
, not 320
?
- It seems like max latency usually defaults to
100
, not 300
?
That default IP 224.0.0.56
is probably nonsense. I changed it to 127.0.0.1
inhad no luck with the PulseAudio Rtp Receiver GUI and restarted the server.
Perdefaults (playing garbled horrible noises at best), so I tried these settings:
IP: 127.0.0.1
Port: 4712
MTU: 1500
Max Latency (ms): 100
Channel Count: 2
Channel Mask: 0
SampleRate: 48000
framesPerBurst: 192
Per this reddit comment, I tried running
export PULSE_SERVER=224PULSE_SERVER=127.0.0.1:40104712
(with and without the port)various permutations, but it did not workwith no luck. Neither did the pactl load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
The TCP-based command from [2]. I got Could not open device: error 5
when subsequently using the is also not applicable, since play
command for all of the above.PulseAudio Rtp Receiver is listening via RTP not TCP/
load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=48000 sink_properties="device.description='RTP Multicast Sink'"
load-module module-rtp-send source=rtp.monitor destination_ip=127.0.0.1 port=4010port=4712 loop=1
With some success, I can now see PulseAudio Rtp Receiver receiving data! Still, no sound. At first I thought there must be some permission missing, but it seems that Android does not gate access to the phone speaker this way.
I restarted everything from scratch and double-checked that all volume channels were set to full. It seems to get some audio now, but mostly in the form of horrible sounding bursts. I suppose this is getting pretty close, just need to figure out the correct settings for the stream and where/how to set them?
Can we use VLC?
Since I seemed to have a stream working, I tried pointing the Android VLC app to
rtp://127.0.0.1:4010
VLC(I will happily createadd move as an entry for any IP and port, but no permutation I've tried so far picks up any audio from termuxanswer shortly).