Aliased Tune

The questions below are due on Thursday March 13, 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.

Download the starter code for this lab and unzip it. Also, install the lib6003 library if you have not already done so. Instructions are available here.

The starter code contains a file called tune.py. In that file, there is a description of a tune in the form of a list. Each entry in the list is a tuple of (frequency, duration), where frequency is the frequency of a note (in Hz) and duration is the length of that note (in seconds).

Add code to tune.py to synthesize a WAV file for this tune by concatenating together a sequence of discretized pure sine waves of the given frequencies and durations. Use a sampling rate of 44.1kHz. Note that there should only be a single sine wave playing at any given point in time in the resulting WAV file.

Note that you can use the lib6003.audio.wav_write function to save the file as a WAV file.

After you have saved the file, play it back. Do you recognize the tune?

Next, generate two new lists of (frequency, duration) tuples that play the same tune when using a sampling rate of 44.1kHz. Your first list should only include continuous frequencies in the range (22050Hz, 44100Hz]. Your second list should only include continuous frequencies in the range (44100Hz, 66150Hz].

All three files should sound identical when played at 44100Hz. Please enter your new lists below. Then upload your modified tune.py file, which should contain not only three lists of (frequency,duration) tuples but also code to create each of the three WAV files.

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

Copy/paste your list of (frequency, duration) pairs containing only frequencies in the range (22050Hz, 44100Hz] into the box below.

Copy/paste your list of (frequency, duration) pairs containing only frequencies in the range (44100Hz, 66150Hz] into the box below.

Please upload your updated tune.py file. Your updated file should include your code for generating WAV files from the given lists of tuples.
  No file selected