1
$\begingroup$

I am having two .wav files, one is modulated wave that is made into a .wav file and another is a recieved .wav file which is recorded from microphone while playing first modulated .wav file. So now that I have two .wav files, one sent and one received. I am trying to synchronize the two files so that I can find the exact time instant where my received file gets in sync with sent file.

I am using, received_wave = thinkdsp.read_wave(filename = '.wav') to read the wave from file and modulated_wave.write(filename = '.wav') to write the wave into file. I am using Think DSP module in python for doing these.

So this received_wave and modulated_wave has two attributes ys and ts where ys is amplitude and ts is time stamps. I want to find the ts such that both wave will synchronize.

for this right now iam using crosscorrealtion of modulated wave(with sync bits) and recieved wave(having both sync bits and data that iam sending such a way that start sync bits then data bits then again end sync bits) so when i crosscorrelate start sync modulated wave(modulated wave using start sync bits only)and recieved wave i can find the value in crosscorrelation matrix where it is almost equal to the auto correlation of sync_wave.

is this approach correct? or shud i check for maximum value of crosscorrelated matrix then find the index ?

$\endgroup$
  • 1
    $\begingroup$ Note that, unless you play and record on the same computer, the clock difference between transmitter and receiver make perfect synchronization impossible. What the transmitter considers to be one second is different from what the receiver does. This means that one of the signals will be stretched compared to the other. $\endgroup$ – MBaz Jun 6 '16 at 13:04
  • $\begingroup$ Can you please mark clearly the part of your question that was edited after the answer was provided? SE does not work like a forum. The short answer to your (additional) question is yes, that's the "alternative" way of aligning the signals. $\endgroup$ – A_A Jun 6 '16 at 21:21
  • $\begingroup$ its the last two paragraphs i have edited, but that method is not giving me best syncronized index. $\endgroup$ – Sate Jun 7 '16 at 9:26
2
$\begingroup$

This is usually addressed via looking for a known pattern in the data frame.

The modulation scheme is not mentioned but when synchronisation is required, a Phase Locked Loop (PLL) is most commonly employed. The PLL will track the received signal and tune a local oscillator to its frequency AND phase. When lock is achieved the signal that a local oscillator produces (at the side of the receiver) is perfectly "aligned" (or synchronised) with a component of the received signal (for example, the carrier). At this point, demodulation of actual information can start.

This still leaves us with the problem of knowing which bits in this stream of zeroes and ones produced by the demodulator are the actual message bits. For this reason, a known sequence of bits is used to mark the start of the actual frame. For more information, please see section "Preamble" from this link.

Of course, the PLL tracks the received signal continuously and counteracts phenomena such as Doppler (for example), which might have a significant effect in acoustic communications. So, in general, it would be worth implementing the PLL part.

Alternatively and if you are only interested in a play-back -> Record -> Demodulate kind of operation, then you can insert a sequence of symbols at the beginning of the transmitted information to force the modulator to produce a short segment of "known signal". A sequence of 10 zeroes for example, could be used to produce a segment of a clean sinusoid. At the receiving end and once you have recorded your signal, you can use cross-correlation to align (in an one-of manner) the known signal with the received and then use this (static) information to demodulate the rest of the received signal. This is still, in a very rudimentary way, what a PLL would do anyway.

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.