Assigned Date: Friday, Jan. 23, 2015
Due Date: Wednesday, Jan. 28, 2015
Due Time: 9:20am
Last modified on February 12, 2015, at 09:40 AM (see updates)
This assignment focuses on:
- Be able to edit and run a Python program using the JEM integrated development environment (IDE).
- Interact with simple Python programs that produce output and do arithmetic.
In class we worked through several programs that create and play a single note. We also saw how to do arithmetic in Python. Since music is numbers and number is music, it is only natural to learn how to combine the two in a Python program.
For this assignment, you are asked to write a program that inputs two numbers:
- an octave (from 1 to 8)
- a pitch within that octave (0 to 11)
The program should then play a corresponding whole (WN) note, and terminate.
- Remember that MIDI octaves are numbered from 0 to 9. So, in this program, we are interested in a note ranging from the second MIDI octave to the penultimate (one-before-the-last) octave.
Once you complete the above, you may feel like doing additional work, for bonus points. Here are some ideas:
- Explore the use of the Python for loop to make the program play 10 notes in sequence.
- Any other idea you can think of (just document your idea in the program's comments, so that I'll know what you are trying to do, when I am grading).
You should comment any variable, obscure statement, block of code, etc. you create. Follow the textbook examples on how to document code.
Additionally, your code should always have header documentation that explains what the program does, in general terms.
For this assignment, just copy and paste these into the top of your program. (For future assignments, you will have to modify these comments, to fit the new assignment.)
(:source lang=Python tabwidth=3 -trim :)
- Class: CITA 180
- Assignment: Homework #1
- Due Date:
- Purpose: This program plays a single note from the computer keyboard.
- Input: Two integers from the computer keyboard. The first is the octave
- of the note to be played (ranging between 1 to 8). The second is
- the relative pitch within the octave (ranging between 0 and 11).
- No error checking is performed (i.e., we assume the user makes
- no mistake when entering these values).
- Output: The corresponding note played via the computer's synthesizer.
NOTE: In the above, replace the bracketed phrases, e.g., , with your name, e.g., John Smith. Do remove the brackets.
You will submit your assignment via OAKS. Be prepared to demo your music to the rest of the class. Your submission consists of:
- Your Python program. Call it, digitalPiano1.py.
- A printout of your program - to be submitted in class on the due date.
- If you do the bonus, submit a separate, additional program. Give the program a different name, e.g., digitalPiano1.bonus.py
Your grade will be based on how well you followed the above instructions.