CS 101 - Introduction to Computing, Spring 2007

Lab 11

Reminder

The program Jython Environment for Students (or JES) is the development environment that we will use for this lab.

In the ACCC Labs that have JES, it can be found by:

  1. Clicking on Start
  2. Then click on All Programs
  3. Then click on Class Applications
  4. Then click on Engineering
  5. Finally click on Jython Environment for Students

Combine Sounds

For this lab assignment, we will add a background music to some other sound file. When adding two samples together, you simply just add the two values together. The only problem occurs if the resulting value goes above 32,767 or below -32,768. Two simple if statements can check for this and correct the problem if it occurs. To correct this, set the value to either 32,767 or -32768.

The two functions of

are useful for this.

getSampleValueAt

getSampleValueAt(sound, index):
sound: A Sound, the sound you want to get the sample from.
index: An Integer, the index value of the sample you want to get the value of.
returns: an integer value between (-32000 and 32000).
Takes a sound and an index (an integer value), and returns the value of the Sample object at that index
setSampleValueAt
setSampleValueAt(sound, index, value):
sound: A Sound, the sound you want to change a sample in.
index: An Integer, the index of the sample you want to set.
value: An Integer, the new value of the sample you want to set.
Takes a sound, an index, and a value (should be between -32000 and 32000), and sets the value of the sample at the given index in the given sound to the given value.

Lab Assignment 11

Due: Tuesday 4/10/2007 by 11:59 pm

Create a file using JES that will:

  1. Contain a comment indicating

  2. Contain a JES function called addSoundtrack () that will

These functions may call other functions that are built-in to JES or that you have written.

Here are some example sound files you can use with this assignment.

Submittal of the Lab Assignment

Comments on the ACCC Labs

On the computers in the ACCC Labs there should an H: drive. This drive is actually a networked connection to your own file space maintained by the ACCC. No matter what machine you use or what lab you are in, the H: drive will access the same file space. This means that you can save a file on the H: drive on a computer in one lab and access that same file on a computer in another lab. This can be very helpful. It is suggested that you store your python program files on your H: drive.