Difference between revisions of "CSC111 Lab 3"
(→Part 3: Altering the sound file) |
(→Part 1: Your First JES Program) |
||
Line 59: | Line 59: | ||
* Drag the '''Sound Files''' folder to your Desktop. | * Drag the '''Sound Files''' folder to your Desktop. | ||
− | =Part 1: Your First JES Program= | + | =Part 1 (Official Start of the Lab): Your First JES Program= |
Open JES by double-clicking on the icon or navigating through the start menu (on pcs) | Open JES by double-clicking on the icon or navigating through the start menu (on pcs) |
Revision as of 16:10, 8 February 2010
You are going to use the computers in Windows mode today. Be sure to reboot them if they are in Mac mode, please!
Contents
Software Setup (to be performed before the lab)
Before you can use the JES programming environment, you need to install it first.
- Login to your Novell account.
- Open your H: drive in Windows Explorer.
- Open Windows Explorer a second time, so that you have two windows open.
- In the second window, enter this address in the Address bar: \\rescent\pc\COURSES\CSC\CSC111
- This is the place on the Novell network where you will find many files related to the homework assignments and the labs.
- Drag the folder named jes-3-1-1windows from the CSC111 window to your H: drive.
- Since you are there, drag as well the Sound Files folder from the CSC111 window to your H: drive.
- You can now close the windows showing the CSC111 folder. You won't need it for the rest of this lab.
- In the window showing your H: drive, open the JES folder and click on the JES icon (snake face with glasses :-)
- After a few (long) seconds, you should get the JES programming environment.
If you want to install JES on your personal Windows computer
If you want to install JES on your Mac or Windows laptop or computer, you can get also get JES from the Web, at this address http://coweb.cc.gatech.edu/mediaComp-teach/26. Click on the the file jes-3-1-1-windows.zip if you use Windows, or on jes-3-1-1-macosx.dmg if you have a Mac, and install as you would a regular application.
If you want to install JES on your personal Mac
Jes for the Mac is available on Google code. Get Jes 3.2.1 for the Mac, open the zip file, and move the JES 3.2.1.app to your Applications folder.
Note for Mac Users
If you want to download the Sound Files to your MacBook, Follow these steps:
- Click on the desktop to bring up the Finder menu
- Click on Go
- Click on Connect to Server
- Click on aft://rescent.smith.edu
- Click on RESCENT.PC
This will create a new Drive called RESCENT.PC on your Desktop.
- Open the new drive
- Select Courses
- Select CSC
- Select CSC111
- Drag the Sound Files folder to your Desktop.
Part 1 (Official Start of the Lab): Your First JES Program
Open JES by double-clicking on the icon or navigating through the start menu (on pcs)
- In the window that opens, the top portion is program area, and the bottom portion is command area (the interactive window we have already seen on beowulf).
- In the Program area, type in the following lines, being careful to follow the format exactly (including all punctuation and indenting)
.
def main():
name = raw_input( "what is your name? " )
print "hello there, " + name + "!"
.
- Save the file by typing Control-S.
- A popup window opens up. Save the file as hello.py in your H: drive
- Click on Load Program button to load the file just stored in JES.
- In the command area (black window), type
main()
- to call the function.
- Make sure you see the pop-up window asking for your name, and the response of the program in the interactive area.
Part 2: Playing Sound Files
- In the JES program area, type in the following main() function:
.
def main():
file = pickAFile()
sound = makeSound( file )
blockingPlay( sound )
.
- Save the file as sound1.py
- Click on Load Program
- In the interactive area, type
main()
- When prompted for a sound file, select ThisIsATest.wav in the Sound Files folder.
- Make sure the speakers are on, but not too loud and listen to the sentence being played.
- Try one or two other sound files.
Part 3: Altering the sound file
- You will reduce the intensity of the sound by dividing all the samples by half
- Copy/Paste the program below in JES
- Read it to make sure you understand it.
.
def main():
# select a sound file
file = pickAFile()
sound = makeSound( file )
# play it
blockingPlay( sound )
# lower its intensity by half
for i in range( 1, getLength( sound )+1 ):
value = getSampleValueAt( sound, i ) # get the value of the i-th sample
setSample( sample, value / 2 ) # set the sample to half its original value
# play new waveform back
blockingPlay( sound )
.