You are not logged in.

#1 2025-07-10 20:56:33

bhavishya-ydv
Member
Registered: 2025-07-10
Posts: 1

BIT Perfect Audio on Waydroid | Using bit perfect audio from Waydroid

I was trying to get Bit perfect audio from waydroid ( which i succeeded in ) .
But now the problem is PipeWire doesn't switch sample rate based on the track i play in Waydroid ( apple music ) . And BIT FORMAT  is always the best available one ( S24_3LE ) .


What is waydroid ?
--> A container-based approach to boot a full Android system on regular GNU/Linux systems running Wayland based desktop environments.
https://waydro.id

Waydroid uses Linux namespaces (user, pid, uts, net, mount, ipc) to run a full Android system in a container and provide Android applications on any GNU/Linux-based platform (arm, arm64, x86, x86_64). The Android system inside the container has direct access to needed hardware through LXC and the binder interface.

How waydroid sends audio to pipewire ? ( i dont know if this is relevant but..)

struct alsa_audio_device *adev;
    char property[PROPERTY_VALUE_MAX];

    if (property_get("waydroid.pulse_runtime_path", property, "/run/user/1000/pulse") > 0) {
        setenv("PULSE_RUNTIME_PATH", property, 1);
    }
while (1) {
        ret = snd_pcm_open(&out->pcm, "pulse", SND_PCM_STREAM_PLAYBACK, 0);

200a4f2d49d906412184d075b40dea6f527fad4b.png

I think Waydroid sends Audio to pipewire through here

binder:114_2

What i want ? Pipewire to switch output format and sampling rate based on what it is receiving from Waydroid  ( atleast sample rate if format not possible) .


From

pw-top

-->

R   46    128  44100  15.7us   2.8us  0.01  0.00    0    S24LE 2 44100 alsa_output.usb-Apple__Inc._USB-C_to_3.5mm_Headphone_Jack_Adapter_DWH325402VQJKZ15Q-00.iec958-stereo
R   89    256  48000   6.1us  12.2us  0.00  0.00    0    F32LE 2 48000  + Waydroid

pipewire.conf --> 

default.clock.allowed-rates = [ 44100,48000 ]

What i think can work ?
1) Giving Direct access of the external DAC to Waydroid . I am not preferring this currently .

2) Creating virtual alsa Nodes for each Bit depth + Sample rate combo . ( Total will be 4 ) . And creating a wireplumber script to redirect the audio to different nodes based on what the input from waydroid is .

3) Maybe something else ? I dont know .

Last edited by bhavishya-ydv (2025-07-10 21:07:30)

Offline

#2 2025-08-08 07:52:20

sipak
Member
Registered: 2019-02-03
Posts: 50

Re: BIT Perfect Audio on Waydroid | Using bit perfect audio from Waydroid

Just forward the USB DAC to the VM so the VM outputs directly to is via ALSA of OSS or whatever it uses.
If you were to use the USB DAC through the hypervisor, it would defeat the whole purpose of the VM since audio would be processed by whatever audio system the hypervisor uses (pulse/pipewire). And it hypervisor uses ALSA or OSS, then the VM is pointless and you could output directly.

If all you want is bitperfect audio, you don't need a droid VM. Just install a minimal arch to run mpd.

Last edited by sipak (2025-08-08 07:54:49)


A problem to do what everybody else does without questioning. A danger to go against the way things are just because. Too much or too little, ivory towers of perfection or functional mess... Balance is what this world needs. Selective, not the middle ground. Objectivity and idealism, but within a pragmatic scope. - Minimalism is achieved through efficiency, not deficiency.

Offline

Board footer

Powered by FluxBB