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.

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..)

C code android_hardware_waydroid/audio/audio_hw.c at lineage-18.1 · waydroid/android_hardware_waydroid · GitHub

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);

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 .

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.