linuxdeploy icon indicating copy to clipboard operation
linuxdeploy copied to clipboard

Audio on Linux Deploy/CHROOT for Android 10/11/12?

Open falkor2k15 opened this issue 3 years ago • 7 comments

I looked at some old methods from 2015/2017, but none seem to be working now.

Does anyone have an up-to-date method that's confirmed to work with recent Android devices/security?

Incidentally, it works with PROOT: Termux is setup as a Pulse Audio server (built in) and then the proot distro is set to export audio to the localhost, i.e. the Termux server.

Of course, Linux Deploy cannot send it's audio to Termux unless we can perhaps find a way to run LD CHROOT through Termux instead of using the Start button in the LD app? Other Android apps acting as Pulse Audio server (or as somewhere to "stream" the audio to so to speak), such as Simple Protocol or PulseDroid no longer seem to work for whatever reason(s).

Besides Pulse Audio there's also some Alsa utils, but those methods seem too outdated. XSDLserver apparently has a built in Pulse Audio server like Termux, but is no longer working out of the box.

falkor2k15 avatar Jun 28 '21 14:06 falkor2k15

hey falkor I'm really a noob so I understand about 10% of what you saying but the way I told you to get the sound working i linux deploy still works for me.

abs0023 avatar Jun 28 '21 14:06 abs0023

buy the way where you from? out of topic though because if you can get a oneplus 6( as your looking for a mobile now, it's two years old but still have great hardware) you can run android/linux in dual boot, so you can still play with deploy in android and have a taste what can be a linux phone, for more information check the postmarketos project or for less information the mobian project.

abs0023 avatar Jun 28 '21 14:06 abs0023

Sound works for you in Linux Deploy? It sure doesn't work for me, and according to one source getting audio working in CHROOT has been a long-standing problem. I heard the issue can be device specific, and people have had more luck with XSDL output whereas I am using VNC. Either way I have been unsuccessful, and there evidently hasn't been any discussion about (pulse) audio/LD in a number of years.

I am from London, and there are Android phones littered all over the place - but you cannot rely on there being any particular model available, such as the OnePlus 6 unless you order online. Therefore, although I love your idea, I try to find one solution fits all - and since root is seldom available without extra tools, Linux Deploy is more a secondary consideration compared to PROOT, which may be more the viable way to go - complete with guaranteed working sound.

falkor2k15 avatar Jun 28 '21 17:06 falkor2k15

OK I got audio to work with XSDL X server - just had to increment the port number by 1! I also found out that XSDL has graphics acceleration, so can run more apps compared to VNC, such as Pinta. Perhaps more desktop environments will also display; PROOT might even work with XSDL too - with or without graphics acceleration? Shame the app is a bit clunky though and hijacks the Android mouse cursor.

falkor2k15 avatar Jun 28 '21 23:06 falkor2k15

like I write in https://github.com/meefik/linuxdeploy/issues/1297 you can use termux (I recomend from fdroid), then you need put to /etc/profile this: export PULSE_SERVER=127.0.0.1
then turn of linux.
go to termux and install pulseaudio pkg install pulseaudio, then you put theese comand (every times before you start linux - I have this in script):

pulseaudio --start --exit-idle-time=-1
pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1

the original recomend auth-anonymous=1 too, but I run it without this command......, and finaly run linux and enjoy it!

MatejMagat305 avatar Jan 29 '22 19:01 MatejMagat305

If you guys also need to record audio, see this:

https://github.com/termux/termux-app/issues/2871#issuecomment-1718978515


The only problem is how to let pulseaudio take termux microphone as mic_input remotely

yingshaoxo avatar Sep 14 '23 08:09 yingshaoxo

I solved this problem by doing:

  1. Install LinuxDeploy apk; Install busybox apk, install busybox payloads, reboot your phone

    • https://github.com/meefik/linuxdeploy/releases/tag/2.6.0

    • https://github.com/meefik/busybox/releases/tag/1.34.1

  2. Select Ubuntu, bionic, File, image size 60GB, set username and password, enable ssh, enable vnc gui, select xfce. Hit the install button, hit the configure button, hit the start button.

  3. Install "termux" apk, install "com.termux.api" apk

    • https://github.com/termux/termux-app/releases/tag/v0.118.0

    • https://github.com/termux/termux-api/releases/tag/v0.50.1

  4. In termux

    
    pkg update
    
    pkg install pulseaudio
    
    pkg install termux-api
    
    
    
    termux-microphone-record -l 3
    
    
    
    pulseaudio --start --exit-idle-time=-1
    
    pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
    
    pacmd load-module module-sles-source
    
    pactl load-module module-sles-source
    
    ```
    
    
  5. In LinuxDeploy system, add "export PULSE_SERVER=127.0.0.1" to the end of "/etc/profile", do a reboot

  6. Use fakestandby apk to make sure the network is always on:

    • https://github.com/JonasBernard/FakeStandby/releases/tag/v1.4.0

    • https://github.com/meefik/linuxdeploy/issues/1373

  7. Now when you use vnc enter your linux system, you should be able to use microphone and speaker without any problems.

https://yingshaoxo.blogspot.com/2023/09/how-to-let-linuxdeploy-desktop-audio.html

yingshaoxo avatar Sep 14 '23 10:09 yingshaoxo