Aligning/synchronizing live audio with pad.set_offset

Michiel Konstapel michiel at aanmelder.nl
Thu Apr 21 21:24:19 UTC 2022


I am trying to synchronize multiple (microphone) audio tracks picking up 
the same sound, but currently testing using files as input; one original 
and one copy delayed by a few dozen milliseconds. I am using cross 
correlation based on https://github.com/rpuntaie/syncstart to calculate 
the required time shift to bring them into alignment. This works, I get 
the exact amount to delay the "early" signal by.

However, now I need to actually *apply* the delay to one of the streams, 
before they go into an audiomixer. I am trying to do so using 
pad.set_offset() either on the source pad of a queue that feeds into the 
mixer (because I recall a comment that set_offset() must be called on a 
source pad), or on the sinkpad of the audiomixer.

If I do so before starting the pipeline, it works. But I want to do this 
on the fly (live input) - but if I call set_offset() on a pad while it 
is running, either nothing happens, or I very briefly get a fragment of 
perfectly synced audio, and then (it sounds like) it just goes back to 
the old timing.

What should I do to apply a delay to an audiomixer input in a running 
pipeline?

Kind regards,
Michiel


More information about the gstreamer-devel mailing list