Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There's big file with ext2 with ARM Debian where I can chroot to.

There's functional mplayer (I can -ao pcm or -vo yuv4mpegpipe) there.

How to record/play sound (or video) from this Debian? Is there things that emulate ALSA/OSS/Whatever to use usual linux programs and android ones side by side? May be there's pulseaudio server for android?

share|improve this question
up vote 2 down vote accepted

I managed to make it sound by writing to /dev/msm_pcm_out:

mplayer something.mp3 -ao pcm:file=/dev/msm_pcm_out

Sound is choppy and it looks hacky in general.

Video output is something like -vo fbdev:/dev/graphics/fb0.

share|improve this answer

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:

  1. Install pulseaudio in the chroot: sudo apt-get install pulseaudio.
  2. As suggested by a comment on meefik's github, I removed the line load-module module-console-kit from the file /etc/pulse/
  3. Run pactl list | grep 'Name\|Description' and identify a module that monitors system audio. I successfully used 'Dummy Output Monitor' named auto_null.monitor.
  4. Write a corresponding shell script pashare as follows (credit to AlexAndersan on SuperUser):
case "$1" in
        $0 stop
        pulseaudio --start
        pactl load-module module-simple-protocol-tcp rate=44100 format=s16le channels=2 source=auto_null.monitor record=true port=8000
        killall pulseaudio
        pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'`
        echo "Usage: $0 start|stop" >&2

Make sure the rate and 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.

  1. Make the script executable and run it:
chmod 755 pashare
sudo mv pashare /usr/local/bin/
pashare start
  1. 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.

  2. In Android, start Simple Protocol Player or PulseDroid on IP address (loopback) and set the other option(s) to match your pashare script.

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.