Not all Androids may have a PCM output device in
/dev, as Vi0's answer requires.
A more general solution is to setup Pulse to stream system audio to a TCP port on your device. Then you can use Simple Protocol Player or PulseDroid in your Android environment to play the stream.
To eliminate chop/lag in VLC, MPlayer, and Audacity, it was necessary for me to choose ALSA as the output device and Pulse as the mixer (in these programs' options).
Steps I used on my Amazon Fire 7" 2015 / CM12 / Debian Wheezy chroot:
- Install pulseaudio in the chroot:
sudo apt-get install pulseaudio.
- As suggested by a comment on meefik's github, I removed the line
load-module module-console-kit from the file
pactl list | grep 'Name\|Description' and identify a module that monitors system audio. I successfully used 'Dummy Output Monitor' named
- Write a corresponding shell script
pashare as follows (credit to AlexAndersan on SuperUser):
case "$1" in
pactl load-module module-simple-protocol-tcp rate=44100 format=s16le channels=2 source=auto_null.monitor record=true port=8000
pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'`
echo "Usage: $0 start|stop" >&2
Make sure the
port arguments match your settings in Simple Protocol Player (on the Android side). PulseDroid demands
rate=48000, which means higher throughput, and could possibly introduce chop/lag.
I added the
pulseaudio --start and
killall lines because pulse would not start automatically in my chroot.
- Make the script executable and run it:
chmod 755 pashare
sudo mv pashare /usr/local/bin/
Configure your chroot media players to output to ALSA, with Pulse mixer. I had to set this manually, to eliminate choppy audio:
VLC: In Tools->Preferences->Audio, set
Output module: ALSA audio output, and
Device: Playback/recording through the PulseAudio sound server.
GNOME MPlayer: In Edit->Preferences->Player, set
Audio Output: ALSA.
In Android, start Simple Protocol Player or PulseDroid on IP address
127.0.0.1 (loopback) and set the other option(s) to match your
Note that Android treats the app like a music player, and will kill it if another app tries to play music, or if it decides to free up the CPU. There are probably workarounds for this.