Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Comments for Week of Oct 6, 2003

How are things going?


Will the 1pm and 3pm lecture Pre-Quizes be the same?

Will there be a question page on the coweb for the pre-quiz?

there needs to be a question page for the pre-quiz

Just a request.. I was wondering if it is possible that HW3 be moved to Monday October 20th instead of the Friday after fall break.. I know that i am not the only one planning to be as far as possible from a computer during fall break. I think giving us the weekend would be nice.. Just a request... PLEASE

I agree with this request. I am planning on going home for the fall break and my home computer does not have JES installed.

What a good place to ask questions on the pre-quiz!

Put 'em here! Mark Guzdial

If I make HW3 due on the Monday, nobody will study for the Midterm over the weekend. They'll work on HW3 instead. I want Midterm Grades to be strong, and it's worth more than the HW, so I'm going to leave the HW3 due date where it is. Mark Guzdial


i forgot about going to class on monday to pick-up the pre-quiz and i worked instead. so, i do have friends (suprise, surprise) who have the quiz and am wondering if it's acceptable to turn in my answers on a handwritten page and not directly on the quiz that was handed-out in class.

Please don't. Email me and I'll send it to you as an attachment. Mark Guzdial


Lab 4 is going to be cake.... Cake!

i have a question about prequiz and searching just the first part. My code is
def halfnhalf(sound):
  largest=0
  for s in range(1,getLength(sound)/2+1):
    largest=max(largest, getSample(s))
  multiplier=32767.0/largest

  print "Largest sample value in the first half of the sound is", "largest"
  print "Multiplier is", multiplier

  # maximize the volume in the first half of the sound
  for s in range(1, getLength(sound)/2+1):
    louder=multiplier*getSample(s)
    setSample(s, louder)

  # decrease the volume by 50% in the second half
  for s in range(getLength(sound)/2+1, getLength(sound)+1):
    value=setSampleValueAt(sound, s, value*.5)

well, i get an error message on line 4. I am very confused. Please Help. Is the rest of it somewhat correct? Thanks
Folks, what do I ALWAYS ask after a posting like this? "WHAT ERROR DID YOU GET?" The words were chosen there to convey meaning, and the meaning is related to the problem. I'm guessing that your error has to do with input not matching what a function wants, right? You have getSample(s) where s is an integer (look at your FOR loop). s here is actually an index. GetSample expects a Sample object (e.g., from getSamples). You might want to use getSampleValueAt instead, and hand it both a sound and an index. Mark Guzdial

oh yeah, and what does 32767.0 mean?
Maximum sample value – remember that 16 bits per sample stuff? Mark Guzdial

I did something similar to this myself, though I got an error also. In my case the error was that I had misformatted or something like that. It was nice and vague. One thing I had different from yours was that I had range (1,int(getLength(sound)/2)), so that It wouldn't try to do a half sample and choke. The 32767.0 is a number we got in class, that was derived through trial and error. It's just about the largest you can get without being ridiculous. Jeff Baker
No, it has nothing to do with trial and error. It's the maximum positive value in 16 bits. Mark Guzdial

ok this is REALLY strange ... when i open up elliot-hello.wav with the sound tool in JES it looks and plays fine. then after i run my program and open it up in sound tool i get this great big triangle followed by a large rectangular dip and then a normal looking wave, and when i play it from the beginning it only plays the last half of the sound. is the program i wrote so wrong and pitiful that ive caused this or is this a bug? im not even returning sound at the end of my program...
It does sound like you screwed up the first half of the sound. Mark Guzdial

Mine wouldn't work properly with hello either. But, it worked fine when I used preamble 10. I think the hello file might just be too short or something to notice the effect.
I don't think it's a shortness issue, but it might have to do with the maximum sample in Hello. Mark Guzdial

For maximizing the first half of the sound why wouldn't you use:
for sampleIndex in range(1, getLength(sound)/2+1):
  louder=multiplier * getSampleValueAt(sound, sampleIndex)
  setSampleValueAt(sound,sampleIndex,louder)

Wouldn't largest=0 also have to be included in a range, so you only search for the largest in the first half of the sound?


I don't quite get the question. largest is used to compute the multiplier, so you can't get the multiplier (above) until you find the largest value. You don't want to set largest = 0 instead the FOR loop or you'll end up resetting it to zero as you test each sample. Mark Guzdial




Please list on your pre-quiz everyone who helps you and everyone you help. Mark Guzdial



Link to this Page