Assigned Date: Friday, Jan. 18, 2018
Due Date: Monday, Jan. 28
Due Time: 30 mins before class
You have probably heard of birthstones, i.e., popular gemstones, each associated with a different month, based on an individual’s birthday. So, for instance, if you are born in February, your birthstone is the amethyst.
You may also have heard of sonification. Sonification is a process that allows us to convert numeric data to sounds. There ar various examples, including the Geiger counter, the Sonar, or hospital heart rate monitors.
Now, through the power of computer programming, you can write your own sonifications.
For instance, let’s combine these two concepts, birthstone + sonification.
Write a Python program that asks the user to enter his or her birthday using three numbers,
- day (1..31),
- month (1..12), and
- year (for example, 1998)
and converts these numbers to a note.
Use the day to determine the pitch of the note, the month to determine the duration, and the year to determine the panning. Use maximum volume. You may assume the year ranges from 1962 to 2018.
When the program is run, it should ask the user to enter three numbers, one at a time. You may assume that the input is error free. Then, when the third number is entered, the program should play the user’s birthsound. Also, it should output the pitch, duration, and panning, as numbers.
You can either:
- do the mapping arithmetic yourself (for extra credit – just make sure you provide good comments, like in class), or
- use mapValue(), as shown in class (for normal credit).
Make sure that pitch is an integer, and not a float. If it is a float, you can use function
int() to convert it to an integer. For example,
n = Note( int(pitch), duration, 127, panning)
will ensure that
pitch is indeed an integer. If pitch is float, then the sound output will be unexpected.
Do all three:
- Upload your program file on OAKS.
- Hand in a printout of your Python program in class on the due date.
- Be ready to perform it in class.
Your program should have a meaningful name, e.g., stairwayToHeaven.py.
The Golden Rule of Style: “A program should be as easy for a human being to read and understand as it is for a computer to execute.” 
Your code should have general comments at the top, which explain what the program does.
You should comment all variables, obscure statements, and blocks of code.
Follow the textbook examples on how to write comments.
Copy and paste the following into the top of your program. Update it, to fit what your program does.
# nameOfYourProgram-MakeSureYouUpdateThis.py # # Author: Your full name # Email: Your school email # Class: The class you are in # Assignment: Homework #1 # Due Date: The due date # # Purpose: Describe what the program does. # # Input: Describe the input to the program. # # Output: Describe the output of the program. #
Your grade will be based on how well you followed the above instructions, and the depth/quality of your work.
- Cooper, D. and Clancy, M. (1985) “Oh! Pascal”, 2nd ed., W.W. Norton & Company, New York, p. 42.