Play a audio file trough a specific speaker channel using gst-launch-1.0

296 Views Asked by At

I want to play a audio clip through only a specific speaker channel, for example, only through the Right Channel using gst-launch-1.0 command.

How can I do this ? I have 6 channel, so I am planning to play different audio through each of this channel one by one

1

There are 1 best solutions below

0
Emmanuel Madrigal On

You can use the audiochannelmix element to send audio to a single channel:

gst-launch-1.0 audiotestsrc ! audiochannelmix left-to-left=1 right-to-left=1 right-to-right=0  ! alsasink

Since the audio sink will be the same for both channels you'll want to use an audio mix, so that the right-only and the left-only audio channels are routed to a single sink device.

gst-launch-1.0 \
   audiotestsrc wave=1 ! audiochannelmix right-to-left=1 right-to-right=0  !  mix. \
   audiotestsrc wave=5 ! audiochannelmix left-to-right=1 left-to-left=0 right-to-right=0  !  mix. \
   audiomixer name=mix ! alsasink

If you have multiple audio devices you want to route your audio to, you'll need to modify the alsasink's device property so that it matches the desired audio sink.