Page 1 of 1

Audio sound and mic problem - pi zero 2 w

Posted: Mon Apr 13, 2026 7:05 pm
by qube32
Hello,

I have successfully installed and deployed the application on my raspberry pi zero 2 w. It almost works as intended.

The only problem is the fact that the sound is crackling and popping after a few minutes of using Android Auto. When I reconnect my phone, the sound works perfectly again for a few minutes and then the problem reappears.

From what I have read on the forum is that the problem is from missing a microphone in my setup.

My question: can I use my phone's Bluetooth microphone as input?
I genuinely don't have the possibility to install an external microphone to the board itself and I need the Bluetooth functionality for calls.

Also one more curiosity: can the sound from Android Auto (for playback - music) be routed through WiFi and not Bluetooth (for lossless playback)?

My current setup:
Phone -> PI (Debian Trixie, latest version of Hudiy and Debian) -> HDMI -> SCREEN with speakers

What I need:
During a phone call
Phone Bluetooth mic -> PI -> HDMI -> SCREEN with speakers

During normal Android Auto music playback:
Phone transmits sound through WiFi -> PI -> HDMI -> SCREEN with speakers

Thank you very much!

Re: Audio sound and mic problem - pi zero 2 w

Posted: Mon Apr 13, 2026 8:24 pm
by hudiy
Hello,

If the Raspberry Pi acts as a Hands-Free Audio Gateway (HFP AG), you must connect the microphone directly to the Raspberry Pi. You can use a cheap USB sound card that has a mic input.

In the HFP profile, it is not possible to take microphone audio from a device other than the one serving as the HFP AG. All audio for the Hands-Free Profile is managed by PipeWire. There is also no Bluetooth profile that lets the phone act as a microphone.

More details about the Bluetooth Hands-Free profile architecture: https://www.bluetooth.org/DocMan/handle ... _id=574215

When Android Auto is connected and both speechAudio and mediaAudio are set to true (https://github.com/wiboma/hudiy/blob/ma ... ndroidauto), audio data is transmitted via either USB or Wi-Fi (depending on your Android Auto connection method).

If you want to disable the echo cancellation module from loading, you can modify the hudiy_startup.sh script as shown below (replace the current contents of $HOME/.hudiy/share/hudiy_startup with this):

Code: Select all

#!/bin/bash

source "$HOME/.hudiy/share/rpi_lib.sh"

DUMMY_SOURCE="dummy_source"
EQ_SINK="hudiy_equalizer_sink"

sink_exists() { pactl list short sinks 2>/dev/null | awk '{print $2}' | grep -Fxq "$1"; }
source_exists() { pactl list short sources 2>/dev/null | awk '{print $2}' | grep -Fxq "$1"; }
until pactl info >/dev/null 2>&1; do sleep 0.1; done

# Gives PipeWire and WirePlumber additional time to detect all audio devices
sleep 1

if [[ "$CURRENT_MODEL" == *"$PI4_MODEL"* ]] || \
   [[ "$CURRENT_MODEL" == *"$PI5_MODEL"* ]] || \
   [[ "$CURRENT_MODEL" == *"$CM4_MODEL"* ]] || \
   [[ "$CURRENT_MODEL" == *"$CM5_MODEL"* ]]; then
    sink_exists "$EQ_SINK" || pactl load-module module-ladspa-sink sink_name="$EQ_SINK" master="$EC_SINK" plugin=hudiy_equalizer label=hudiy_equalizer control=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    sink_exists "$EC_SINK" || pactl load-module module-echo-cancel aec_method=webrtc aec_args=\"voice_detection=false\" source_name="$EC_SOURCE" sink_name="$EC_SINK"
    pactl set-default-sink "$EQ_SINK"
    pactl set-default-source "$EC_SOURCE"
else
    if [[ "$CURRENT_MODEL" != *"$PI3APLUS_MODEL"* ]] && \
       [[ "$CURRENT_MODEL" != *"$PI3BPLUS_MODEL"* ]]; then
        export HUDIY_LIMIT_HOTSPOT_BANDWIDTH=1
    fi

    export HUDIY_DISABLE_ANDROID_AUTO_DRM=1
    export HUDIY_DISABLE_EQUALIZER=1
    source_exists "$DUMMY_SOURCE" || pactl load-module module-virtual-source source_name="$DUMMY_SOURCE"
    pactl set-default-source "output.${DUMMY_SOURCE}"
fi

if [[ "$CURRENT_TARGET" == "$TARGET_GUI" ]]; then
    $HOME/.hudiy/share/hudiy &
else
    wall "Hudiy is launching..."
    $HOME/.hudiy/share/hudiy
fi

Re: Audio sound and mic problem - pi zero 2 w

Posted: Tue Apr 14, 2026 9:44 am
by qube32
Just tested the code.
Indeed, the audio works well. There are a couple of seconds when the audio stutters, but then it seems to work fine.
I haven't tested the external microphone yet.
Thank you for your help