• Lab 9:
    • For this lab you will create a primitive that will demodulate an FM signal. Don't worry, you do not need to know anything about FM to do this lab; the algorithm is already coded, you just need to handle the data input and output to the algorithm.
    • A template for this primitive is provided with the algorithm allready filled in.
    • Files (be sure to save these with the correct names):
      • primlab9.java - The primitive.
      • test_primlab9.mm - Test macro.
    • Use UPDATE to add the primitive to the command dictionary. It takes in 2 parameters (IN= and OUT=).
    • Take a look at the processFM(..) method provided. This method handles the demodulation. It takes in three parameters, input and output arrays and number of elements read in.
    • Within the file you will need to do the following (in the template, there is a "Your code goes here." for each line you need to complete):
      1. In the open() method, add in the buffer allocation.
      2. In the process() method, complete the int numRead = line. You should read in a buffer's worth of data.
      3. You will need to cast the input data to a float array before passing it to the processFM(..) method.
        • Hint: Only the data from the input buffer needs to be copied from the data buffer into the array.
      4. Once you put in the casts you should immediately put in the uncasts a few lines below. Do this for both the input and output arrays.
        • Hint: Only the data from the output buffer needs to be copied from the array into the data buffer.
      5. Between the cast and uncast, process the data. All you need to do is to call processFM(..), all of the other work is done in that method.
      6. Now write out the data to the output file (this must be AFTER the uncast).
    • Use the test macro to test it out.
    • FYI: The DEMOD command in the DSP option tree supports demodulating AM, FM, PM and more. Please see the explain file for DEMOD for more details.