CS 101 - Introduction to Computing, Spring 2007

Lab 12

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 convert a high resolution sound file with a sampling rate of 44,100 samples per second to a low resolution sound file with a sampling rate of 22,050 sample per second. You may wish to refer back to lab10 for another assignment that worked with the sampling rate of a file.

You will find the following functions useful for this assignent.
getSamplingRate
getSamplingRate(sound):
sound: A Sound, the sound you want to get the sampling rate from.
returns: An Integer representing the number of samples per second.
Takes a sound as input and returns the number representing the number of samples in each second for the sound
getLength
getLength(sound):
sound: the sound you want to find the length of.
returns: the number of samples in sound.
Takes a sound as input and returns the number of samples in that sound.
makeEmptySound makeEmptySound(duration):
duration: An integer, time in seconds for duration of sound
returns: An Empty Sound.
Takes a duration in secounds as sinput and returns the empty sound.

getSampleObjectAt

getSampleObjectAt(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.
returns: The sample object at that index.
Takes a sound and an index (an integer value), and returns 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 12

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

Create a file using JES that will:

  1. Contain a comment indicating

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

  3. Contain a JES driver function called lab12 () that will
These functions may call other functions that are built-in to JES or that you have written.

Look for sample high resolution sound files inside of Blackboard under Assignments.

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.