ECE-1021

HOMEWORK #9

(Last Mod: 27 November 2010 21:38:38 )

ECE-1021 Home


PROGRAM A - Tic-Tac-Toe

Programming Problem #8.10 (p436).

MODIFICATION: Have two panels on the screen. The left panel displays the present board and the right panel displays the board as it was on move N. The user can hit the '+' key to advance the right panel or the '-' key to step back one move.

To make a move, the user moves the screen cursor to the desired square using the {2,4,6,8} keys and "Enter" to make the move. Your program needs to be sure that it is a legal move (square not already taken).

There is an example executable linked on the Home Page of the course website to give you an example of what the output might look like. You are not expected/required to use screen graphics to the degree that this demo does, but some effort to make the screen presentation reasonably aesthetic (within the limitations imposed by the use of character graphics) should be evident.

PROGRAM B - WAV reader/writer

Modify the WAV reader/writer from HW#8 to add the following feature:

If the file name starts with a period, then the assumption is that it is not a file name but a string of digits and underscores for which a DTMF file is to be created.

When this is detected, your program should then prompt the User whether they want the output to be mono or stereo. If they want it to be stereo, then the low frequency signal should be encoded on Channel 1 and the higher frequency encoded on Channel 2.

You should also prompt them for the number of bits per sample and the sample rate per second. Finally, you should prompt them for the digit duration (in seconds), the duty cycle (in percent), and the rise/fall time (in percent).

The digit duration is simply how many seconds each digit is played for. The duty cycle is what fraction of the digit duration the tone is to be played. For instance, if the digit duration were 4.0 seconds and the duty cycle were 75%, then each tone would be played for 3.0 seconds with 1.0 seconds of silence between digits. Assume that the tone is played at the center of its time slice, so the above example would play silence for 0.5 seconds, followed by a 3.0 second tone, followed by another 0.5 seconds of silence.

The rise/fall time is how fast the tone should transition between silence and full magnitude. This transition period should be evenly divided between the on-time and the off-time of the tone. For instance, if the above example has a rise/fall time of 10%, then it would take 0.4 seconds to transition. Splitting this evenly across the transition means that the lead in silence would last 0.3 seconds, followed by a linear ramp in the amplitude that reaches full amplitude at 0.7 seconds. The tone then stays at this amplitude for 2.6 seconds and then ramps down to silence over the next 0.4 seconds and is completed with a final 0.3 seconds of silence.

As with the previous writer, the maximum deviation in the file should be 90% of the way from the midpoint to the maximum value.

This assignment is not nearly as difficult as it might seem, particularly if you have the prior WAV related assignments well in hand. Your pseudocode for this assignment should clearly indicate the mathematics needed to accomplish all of the above tasks.