How to properly switch between multiple audio sources while playing

Nirbheek Chauhan nirbheek.chauhan at gmail.com
Thu Apr 4 14:52:54 UTC 2019


On Thu, Apr 4, 2019 at 6:55 PM OPENSOURCE Manuel Huber
<manuel.huber at opensource.tttech.com> wrote:
> To simplify the use-case, I tried to only switch between two sine
> tones (just to get a basic understanding).
>
> 1. Using input-selector and valve
>
>     audiotestsrc1 -> valve1 -+
>                              +-> input-selector -> alsasink
>     audiotestsrc2 -> valve2 -+
>
>   I heard some click's and pop's when switching...
>

Have you tried audiomixer? You can use it as a 'seamless switcher' by
muting one sinkpad and unmuting the other.

If you get 'glitching' (due to silence in between) which can happen if
you get unlucky w.r.t. scheduling between muting one and unmuting the
other, you can use the gst controller API for scheduling both to
happen at the same time. See crossfade_app_set_pad_volume_fade() in
the example attached here:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/208

You can also use a linear fade to do a 'cross-fade' instead of a hard switch.

Cheers,
Nirbheek


More information about the gstreamer-devel mailing list