Garbled audio when using ALSA on PipeWire + deinterleave + sample rate filter

Hi,

I’m getting strange audio output when using deinterleave in my pipeline along with alsasrc on my PipeWire system.

First, a working pipeline without deinterleave:

gst-launch-1.0 alsasrc ! audio/x-raw, rate=16000 ! alsasink

This works as expected - PipeWire is able to provide the requested sample rate, and the audio plays back just fine (alsasink is an example, any sink can be used).

Now, the problematic pipeline:

gst-launch-1.0 alsasrc ! deinterleave ! audioresample ! audio/x-raw, rate=16000 ! alsasink

Note that despite both sides of the audioresample being 16kHz, it is still needed for some reason - there are linking issues otherwise.

In this pipeline, the output is distorted, as if it was playing back 44.1kHz PCM data at a 16kHz rate without conversion.

As a final test, moving the filter to before deinterleave also fixes the problem - but this is harder to do in my actual application, as it targets platforms with barebones ALSA (no resampling plugins).

gst-launch-1.0 alsasrc ! audio/x-raw, rate=16000 ! deinterleave ! alsasink

Why is the second pipeline producing garbled audio? Am I doing something wrong, or have I encountered a bug?

I have made a StackOverflow post.