Mystery Signal

The questions below are due on Thursday February 20, 2025; 02:00:00 PM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

This lab focuses on the use of Fourier series to represent real-world audio signals. Part a introduces the required theory in a simple analytic context. Do this part to prepare for this week's lab check-in (due on Tuesday at 9:30pm). Part b applies the ideas introduced in part a to synthesize a real-world audio signal. This part is due with the rest of the homework on Thursday at 2pm.

Part a. Start by finding Fourier series coefficients of the following form

f(t)=\sum_{k=0}^\infty\Big(c_k\cos(k\omega_ot)+d_k\sin(k\omega_ot)\Big)
to represent the periodic function shown below.
Make Python lists called ck and dk} that contain the first 100 values of the cosine and sine coefficients, respectively:

ck = [c0, c1, c2, ... , c99]
dk = [d0, d1, d2, ... , d99]

Part a1. Use these lists to plot an approximation to f(t) using matplotlib.

Skeleton code is contained in a file called mystery_signal.py in this week's code distribution.

Part a2. How would the function change if only the first 10 elements in each list were used?

Part a3. How would the function change if all of the sine terms were negated?

Part a4. How would the function change if all of the cosine coefficients were set to zero?

Make plots of these results and be prepared to discuss them at this week's check-in.

Part b.

The file mystery_signal.py also contains code to load two lists ck and dk) from a .pkl file. These lists contain cosine and sine coefficients (respectively) for an audio clip.

Write a program to reconstruct the audio clip from ck and dk. Write the reconstructed audio clip to a .wav file using wav_write from the lib63000.audio library.

Note that this requires installing the lib63000 library; instructions for doing so are available under the Help tab of the 6.3000 website.

How would the audio clip change if

  • only the first 20% of the elements in each list were used?
  • all of the sine terms were negated?
  • all of the cosine terms were set to zero?

Make audio clips for each of these conditions and upload them as part of your homework.

Briefly explain the relation between the changes itemized above and the original, and describe why these relations hold.

Here are some hints:

  • The length of the original audio clip was approximately 3 seconds. How could you tell if your reconstruction is too short or too long?
  • It can take a while to compute the entire audio clip. It's not necessary to reconstruct the entire audio signal while debugging. Reconstruction of a small section (e.g. 1/2 second) should be adequate for debugging.
  • The time to reconstruct increases linearly with sample rate. While higher sample rates provide greater fidelity, lower sample rates (on the order of 5,000 to 10,000 samples per second) should produce an intelligible result.

Check In:
Please describe your approach to each of the parts of this lab.

Please upload your solutions to all parts of this problem as a single zip file:

 No file selected