# How can I use only one audio channel?

**URL:** <https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568>\
**Category:** Application Development\
**Created:** [November 21, 2023, 3:23am UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568 "2023-11-21T03:23:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hacker1024](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/hacker1024/32/231_2.png) [@hacker1024](https://discourse.gstreamer.org/u/hacker1024)\
**Post date:** [November 21, 2023, 3:23am UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568/1 "2023-11-21T03:23:41Z")

</div>

I have an `alsasrc` for a microphone with _n_ audio channels (`audio/x-raw,channels=n` on the source pad). I want to use just the first channel, leaving a source pad with `audio/x-raw,channels=1`. How can I do this?

---

<div class="post-metadata">

**Author:** ![slomo](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/slomo/32/4_2.png) [@slomo](https://discourse.gstreamer.org/u/slomo)\
**Post date:** [November 21, 2023, 8:35am UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568/2 "2023-11-21T08:35:03Z")

</div>

You could put a [`capsfilter`](https://gstreamer.freedesktop.org/documentation/coreelements/capsfilter.html) element with caps `audio/x-raw,channels=1` right after the `alsasrc` to put constraints on the caps.

---

<div class="post-metadata">

**Author:** ![hacker1024](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/hacker1024/32/231_2.png) [@hacker1024](https://discourse.gstreamer.org/u/hacker1024)\
**Post date:** [November 21, 2023, 10:22pm UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568/3 "2023-11-21T22:22:55Z")

</div>

Thanks. This seems to be either mixing all the channels together or choosing the wrong channel, though. How can I explicitly choose the single channel to use?

---

<div class="post-metadata">

**Author:** ![hacker1024](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/hacker1024/32/231_2.png) [@hacker1024](https://discourse.gstreamer.org/u/hacker1024)\
**Post date:** [November 22, 2023, 5:19am UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568/4 "2023-11-22T05:19:08Z")

</div>

Upon further investigation, it seems that the channel mixing is being performed by ALSA itself, as I was using a `plughw` device.

If I use `hw` instead, to stop ALSA mixing channels, capability negotiation fails if I use a filter to change the number of channels.

I need an element that lets me use only a single channel.

---

<div class="post-metadata">

**Author:** ![hacker1024](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/hacker1024/32/231_2.png) [@hacker1024](https://discourse.gstreamer.org/u/hacker1024)\
**Post date:** [November 22, 2023, 5:35am UTC](https://discourse.gstreamer.org/t/how-can-i-use-only-one-audio-channel/568/5 "2023-11-22T05:35:36Z")

</div>

Ah, it seems I need [`deinterleave`](https://gstreamer.freedesktop.org/documentation/interleave/deinterleave.html).
