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:
- Clicking on Start
- Then click on All Programs
- Then click on Class Applications
- Then click on Engineering
- 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
- getSampleValueAt()
- setSampleValueAt()
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:
- Contain a comment indicating
- your Name,
- Net-ID,
- Course Name,
- Assignment Name and
- a short description of
the assignment
- Contain a JES function called addSoundtrack () that will
- Prompt the user for the "Foreground" sound file and make a sound object
from this file.
- Prompt the user for the "Background" sound file and make a sound object
from this file.
- Add the background sound file to the foreground sound file, but the
volume of the background sound should be one-third of the sound from its
original file.
- check for and correct any "clipping" that may result from the resulting
value being greater than 32,767 or less than -32,768.
- play the resulting sound and prompt the user to save it in a file
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
- You are submit your program electronically by placing it in the
digital drop box in blackboard.
- Programs that are correct and
submitted by noon on the Wednesday
the lab assignment is discussed will receive an extra 10% on the
score of the lab.
- When saving your program, use a meaningful name like lab11.py.
- When submitting your lab assignment, place all of the needed files it in a
zippped folder (even if you are only submitting one file) with the name
of yournetid_labNum and submit that zipped folder to the digital
drop box. For instance, if your net id is
abc32 then the folder name should be abc32_lab11.
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.