Spring2015.CITA180Homework1 History

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.

Deleted lines 32-46:

!!Assignment

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.

!!!Notes

# 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.

# 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.

to:

!!Learning Objectives

This assignment has the following objectives:

* Understand the fundamentals of music theory.* Apply numeric data types to represent information.* Use variables in program development.* Understand arithmetic operators and use them to design expressions.

Also how 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.

# 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.

!!Assignment

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.

!!!Notes

# 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.

!!Bonus

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).

!!Documentation

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 :)# digitalPiano1.py## Author: <Your name># Email: <Your email address># Class: CITA 180# Assignment: Homework #1# Due Date: <The assignment's 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. #(:sourcend:)