Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.

Pages: [1]
Author Topic: How to get beat frequency
Posts: 1
Post How to get beat frequency
on: April 22, 2014, 11:30

Hi Greg,

I have question for you and anyone who can help. How can i get only the beat frequency information from .wav file? for example from running_outside_20ms.wav in ranging_files. Can you tell me the matlab script to get it?

Many thanks for anyone to reply, have a good day 😀

Posts: 3
Post Re: How to get beat frequency
on: May 21, 2014, 06:50

I don't have code for you, though I do have a good reference recommendation (a PDF of which is available freely online if you know where to look). It's the book RF and Microwave Wireless Systems by Kai Chang, specifically chapter 7.

In a stationary target case, your beat frequency is just your currently transmitting frequency minus your receiving can's currently receiving frequency. In other words what your mixer puts out and your low-pass filter captures and your audio input records. There's no real difference in a moving target case, other than a doppler shift being added/subtracted on the input to your receiving cantenna. In any case, the beat frequency information you want is already there. Just take the fourier transform of a modulation period you're interested in (just a modulating-up period if you want to keep things simple) and you have your spectrum of frequency information. Since in reality there will be multiple targets, if you want to estimate the strongest beat frequency you'll have to look for the spectrum's peak value and corresponding index (the index contains the frequency). You can take the values as-is or you can use some fancy interpolation method such as to guess at a better value.

A live demonstration might be more useful... One of the original MIT students made a live ranging demo in Python and I actually independently made a very similar one for my own project about a year and a half ago (I'm still trying to get approval to release all the code). His code doesn't seem to work for reading from the running_outside_20ms.wav file. I modified it with a few lines so it would work and uploaded a video of the result. Basically you want to pay attention to how the spectrum plot on the left changes when the spectrogram on the right does (which reflects someone running towards/away from the radar I think).

Here's the diff of changes if you feel motivated to dive into Python. :)

$ diff -u 
---	2014-05-21 03:39:30.000000000 -0700
+++	2014-05-21 03:31:57.000000000 -0700
@@ -41,7 +41,7 @@
 #only one of the two should be set True
-LIVE_INPUT = True               #capture from soundcard
+LIVE_INPUT = False               #capture from soundcard
 PLAYBACK_RECORDING = False      #playback a recorded PCM .wav file
 RECORD_LIVE_INPUT = False       #only valid if LIVE_INPUT==True
@@ -204,7 +204,7 @@
     else:   #playback from wave
         if _wavefd is None:
-           open_wave(path='~/radar/radar20110120_103812_proc.wav',rw='r')
+           open_wave(path='running_outside_20ms.wav',rw='r')
            wavefd_size = _wavefd.getnframes()
@@ -323,6 +323,14 @@
                 risingEdge = None
             frame = None
+            zero_crossings = np.where(np.diff(np.sign(sync)))[0]
+            if len(zero_crossings) > 2:
+              # make sure we're starting on a positive edge.
+              if sync[zero_crossings[0]+1] < 0:
+                zero_crossings = zero_crossings[1:]
+              for start, end in zip(zero_crossings[::2], zero_crossings[1::2]):
+                frame = time_[start+1:end+1]
+                self.process_frame(frame)
             while(True): #this loop processes frames
                 print 'begin search for frame'
                 if(bufferIdx is not None):
@@ -373,7 +381,7 @@
                         #no more edges to process.
-            assert buffer.size == time_.size
+            #assert buffer.size == time_.size
             buffer = time_
         else: #not doing ranging
             spectrum = abs(fft(time_))[:MAX_FREQN]


Posts: 115
Post Re: How to get beat frequency
on: May 27, 2014, 07:45

You can use the .wav recorder software audacity, it's free to download:

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.042 seconds.