Melody

Allison Obourn, Marty Stepp
University of Washington, Stanford University
aeobourn@cs.washington.edu, stepp@cs.stanford.edu

screenshot of GUI

Overview

In this assignment, students keep track of the notes of a song and write methods to perform many standard music player tasks. Repeated sections of songs are stored only once so students have to reason about how to play the entire song with all repeated sections. This assignment is nifty because the data is interesting and understandable without being overwhelmingly large. We have included two variations of this assignment. One is a CS1 Array focused assignment and the other is a CS2 Queue and object focused version.

Provided files

Array (CS1) version Queue/Stack (CS2) version
Specification:
Required Files:
Runnable Demo:
Sample Songs:

Metadata

Queue verison Array version
Summary In this assignment, students keep track of the notes of a song and write methods to perform many standard music player tasks. Repeated sections of songs are stored only once so students have to reason about how to play the entire song. This assignment gives students practice manipulating datastructures. Depending on the variation, it can also include file processing and objects.
Topics Queues, Stacks and objects Arrays
Audience Early in a CS2 course. Late in a CS1 course.
Difficulty This is an intermediate assignment. Students were given 1 week to complete it. This was given as half of a two part assignment. Students had one week to complete both parts.
Dependencies Relies on an augmented version of libraries from Introduction to Programming in Java for audio. Also requires Pitch and Accidental classes provided by the instructor. Optionally requires GUI support files from starter code library.
Prerequisites Requires no prior knowledge of music. They should have learned whatever basic data structure you are going to cover. They also should know the basics of classes and objects.
Strengths Students find playing songs very rewarding. There are oppertunities for creativity in having students write their own songs. The goal of the assignment is straight forward and easy for students to understand, even if they have trouble actually writing the code.
Weakenesses Lab computers may not have speakers or sound enabled. Not as motivating for hearing impaired students. Some differences / simplifications compared to regular music notation.
Variants Besides the two variants we are presenting, you could make a harder variation with more emphasis on objects. For instance, students could write the Note class. You could also introduce Rest or Bar objects. There are also many other methods you could ask the students to write to manipulate the notes.