green-green-avk / AnotherTerm

Local PTY, USB and Bluetooth serial ports, SSH and Telnet terminal client for Android. Xwayland support (in dev only).
https://green-green-avk.github.io/AnotherTerm-docs/
Other
190 stars 20 forks source link

Audio in graphical session #31

Open dvlahakis opened 2 years ago

dvlahakis commented 2 years ago

Are there any suggestions for how audio might work in a proot graphical session? I tried running pulseaudio and pacmd unsuccessfully in a Debian bullseye session. I thought I might be able to stream to the app pulsedroid. Thanks!

green-green-avk commented 2 years ago

I'll think about it but it is not a priority now... The main priority is a PRoot => QEMU migration as Android become more and more restrictive. Also I recommend you to be mentally ready to a moment when Android own console support will remain in the GitHub releases only (due to tightening of the Google Play rules).

zongou commented 1 year ago

pulseaudio tcp & rtp server

Run this script

#!/bin/sh
set -eu

## Make sure module-native-protocol-tcp is loaded on android for pactl to work
if ! (pactl list modules short | grep -q -e module-native-protocol-tcp); then
 if pulseaudio --check; then
  pulseaudio --kill
 fi

 pulseaudio --exit-idle-time=-1 --daemonize=true --load="module-native-protocol-tcp"
fi

## Check if module is loaded before unloading
pactl_better_unload_module() {
 if (pactl list modules short | grep -q -e "$1"); then
  pactl unload-module "$1"
 fi
}

## tcp sender
pactl_better_unload_module module-simple-protocol-tcp
pactl load-module module-simple-protocol-tcp source=auto_null.monitor rate=48000 channels=2 format=s16le record=true listen=127.0.0.1 port=4010

## rtp sender
pactl_better_unload_module module-rtp-send
pactl load-module module-rtp-send source=auto_null.monitor rate=48000 channels=2 mtu=320 destination=127.0.0.1 port=4010

Or add your pulseaudio configuration

/etc/pulse/default.pa.d/sender.pa

#!/usr/bin/pulseaudio -nF

## Android module
load-module module-native-protocol-tcp

## tcp sender
load-module module-simple-protocol-tcp source=auto_null.monitor rate=48000 channels=2 format=s16le record=true listen=127.0.0.1 port=4010

## rtp sender
load-module module-rtp-send source=auto_null.monitor rate=48000 channels=2 mtu=320 destination=127.0.0.1 port=4010

and run

pulseaudio --exit-idle-time=-1 --daemonize=true
green-green-avk commented 10 months ago

A related question: https://github.com/green-green-avk/AnotherTerm/issues/52

Maybe I will change my mind but rather prefer to implement it as PipeWire.