I have two radios sampling simultaneously, and I am trying to time-align their two signals (they will always start sampling at slightly different times with random delays due to hardware differences). I have a circuit that automatically switches between the antennas and nothing at a set interval, and I'm trying to use the transitions between signal and silence to determine how to time-align the two signals. I tried using cross correlation to find the shift between the two signals, but it's not getting the correct alignment (it's very off). I suspected it was due to the signals being too noisy, so I smoothed them both and tried to make their amplitudes similar, but it still didn't get the right alignment.
Here's a screenshot of an example of the two signals. The image is zoomed in to the region where the circuit switches the radios from nothing to the antennas, and I would like to align the two signals such that these transitions match up.
EDIT: Here are text files of two more signals that I'm trying to align: s0.txt s1.txt. When they're aligned, they look like this:
(note that these are not the same signals in the previous picture). I found the optimal delay to be 1069 for the first signal. I used other methods to find the delay (described in a comment below), but I would like to reproduce this result using cross correlation as I believe it will prove to be more reliable / precise.