Computer Science I
PA 06
Creating sequential music using splicing
Deadline : Wednesday, April 8th at the
start of class
Introduction
In lab10 we looked at creating music by layering multiple notes into a single
chord. In this programming assignment we will extend that idea by creating
music by creating a sequence of sounds.
When you first learn to play music on the piano or violin (or just about any
instrument for that matter) you play music by playing a sequence of distinct
notes. For example, the first phrase of Mary had a Little Lamb is E - D -
C - D - E - E- E.
In this assignment you will create a method that uses the files from
musicSounds.zip to create a composition of music
that meets the following requirements.
Requirements
- Your function should be named makeMusic (case sensitive) and your file
should be named pa06.py
- Your function should take in NO INPUT PARAMETERS
- To create your canvas, use the function makeEmptySound(seconds,rate), where x is
how many seconds you wish the blank sound to be. Your final sound must be at
least 10 seconds long.
- You must use the instrument sounds in musicSounds.zip.
(I will consider exceptions to this requirement but you must talk to me in
advance)
- You are to concatenate sounds into your new empty sound. You must
use at least 5 different sound files for at least 15 total sounds.
For example, the Mary Had a Little Lamb example above would use 3 different
sound files for a total of 7 total sounds.
- For at least three of your sounds, you must let them overlap on
the canvas.
- You must write at least 3 helper functions.
- You must have a comment before each of their "def" statements that
states what the function does.
- At least two functions must return a value.
- Your function must get files out of the directory that the media path is
set to.
- Your function will return the sound when it is done.
- Similar to the rules that we had when writing picture methods, you should not use
play(), setMediaPath() or pickAFile()
in your final code.
- As a STRONG suggestion - no function should exceed 30 lines (including the "def" statement), and
only makeMusic should be longer than 20.
- For extra credit point(s) - if you produce a recognizable sound/song you
may be rewarded with one or more extra credit points. To be eligible
for this extra credit you MUST mention the name of the song in the header
comments for your makeMusic() method.
Testing your assignment
Since everybody will have the SAME set of starting files copied from
musicSounds.zip I will only need your pa06 file to grade this assignment.
To do so I will open pa06.py and type
>>> setMediaPath() # pointing to MY copies of the files
>>> output = makeMusic()
>>> play(output)
Submitting your assignment
When you are finished you should upload PA06.py
Submit a paper copy of PA06.py by the START of
class on the due date. Printouts not on the front desk by 10:00 AM will be
considered late and will lose several points.