Problem Set 4: Digital Audio; Compression; Intro to Digital Images
Assigned: Thursday February 14, 2008
Due: Thursday February 21, 2008
Points: 24
This is a 3 part problem set. For each problem, provide a detailed
explanation of how you solved the problem.
Digital Audio
- (3 Points) Use the binary editor to create 2 seconds of the A
note above middle C followed by 2 seconds of the A# just above it.
In solving this problem you are free to use any wave form.
- (3 Points) A sawtooth wave looks like, well the teeth on
a saw:
Create a six second sawtooth signal consisting of two seconds each of
middle C, then the E note in the same octave and ending with G.
(I.e., the notes of the C major chord.)
- (3 Points) Download this
fascinating wave file. Use the binary
editor to make the sound play backwards. (Think about this--if
the file were 10 bytes long, then the value in line 0 should be
replaced by the value in line 9, the value in line 1 by the value
in line 8, the value in line 2 by the value in line 7, and in
general the value in line x by the value in line 9-x. Use this
observation to find the correct formula.)
- (3 Points) Make the fascinating sound gradually louder ---
that is, do a
slow rise from the beginning to the end. (Multiply the value in
line N by a factor that is equal to 0 when N=0, and increases
steadily to become 1 for the last line of the file.)
Compression
Intro to Digital Images
- (6 Points) Use your web browser to find and interesting JPEG
image on the web. Save it on your hard-drive. Take a look at the
Get Info (Mac) or Properties (Windows) information
to ensure that the JPG file isn't too large --- 300 to 500 KB
would be the largest JPG file that our software can handle. Also,
make a note of the dimensions of the image. You'll need this later.
Once you've found a reasonable image, the next step is to convert
it to a bitmap representation. If you are using a Mac, you can use
the preview program to perform this task. Just use the
Save As option under the File menu item. If you are
using Windows, you should be able to convert the image simply by
double-clicking on the file icon and then using the Save As
option of whatever image display program opened the file for you.
Let me or the TA know if you are having trouble with this step.
Now you are ready to load the resulting bitmap file into the binary
editor. Once you've loaded the file, remove the 54-byte bitmap header
with the expression:
[n + 54]
applied to all. This 24-bit color bitmap image can now be converted
to an 8-bit grayscale image in two steps. First, convert each colored
pixel to a gray-level pixel by averaging the RGB values. This can be
done by applying the expression:
([3*n/3]+[1+3*n/3]+[2+3*n/3])/3
to all cells. Once this is done, the 24-bit black and white image can
ben viewed using the Redraw in Color button. Try it. The second
step is to shrink the image down to 1/3 size by applying the expression:
[n * 3]
to all cells. The resulting image should be viewable in the binary
editor as an 8-bit grayscale image. Try it.
Now figure out how to crop the image with two quarter-width black stripes
as shown on the right:
HINT: If N is the line number and W is the image width, then
the expression (N % W) computes the column number illuminated by [N].
|