Digital Music Programming

Final Exam (Fujinaga, Spring 1997)

Write your answers in the blue exam booklet. Return this exam.

1. Programmers all over the world are concerned about their old programs that they may not work when the year 2000 arrives. Why are they worried? Give an example where a program may fail to function properly. What are the causes of this problem. (5 pnts)

2. Write a C program that :

a. reads a binary file of floats

b. normalizes the input between -1 and 1 (i.e. all the values must be scaled so that they are all between -1 and 1)

c. writes the normalized result out to another binary file in reverse order

The first item in the input file is a short that specifies the number of floats that follow (i.e. the size). The output should be in the same format. Note that the size of the file is variable and the memory must be allocated depending on the size. The input filename and output filename should be entered via the command line. (10 pnts)

3. Add a "clear" method in the moving average object (the assignment) that will clear the array used for averaging. Write the method itself in C and describe what other changes are needed in the program so that the object responds to a "clear" message. (10 pnts)

4. What is an interrupt? Are there different kinds of interrupts? How does a program like Max use interrupts? What happens to Max if it does not use interrupts, i.e. Overdrive is disabled? Does it still work? Under what conditions does it not work? (5 pnts)