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

Midterm Exam 2 Review Fall 2003: Re-mixing the recipe

Answers? Comments? Questions on Answers? Questions on Comments?

(Back to Fall2003 Midterm Review 2)



Can someone please post an answer so that I can copy their work?

the second part:
when the function ends, is the value of targetIndex 61772? And we won't hear anything after that because in the original sentence, the word test ends at 55770, right?

The sound thisisatest.wav is actually longer than the end of the word "test." Mark Guzdial


2) There are 2742 samples left over in the sound when all the loops finish, but the last word in the original sound has already ended so none of the words from the original sound are heard. The value of targetIndex when the function ends is 61768.

i know we went over this in class but is this right? is my value of targetIndex off?

i got targetIndex as 61775(15444+((15444/2)4)+15444).

i dont understnad this one at all

I can't figure out the differences of loops B with D and Loops C with E. Can some body help me here

How do the targetIndex loops work. I thoguht everything that happens in a loop stays in a loop. (including the target index changing) Why wouldnt each loop after the first keep writing over the one before it.

A loop isn't like a function. If you define the variable in setting us the loop, then yes, it does stay in the loop. But targetIndex is defined elsewhere.

B and D are the same, as are C and E. You can't figure out the differences because there are none. :-)

Could someone maybe post the steps they went through to get the answer to part 2 of the question? I really don't understand how to figure this one out.

When I calculated the last targetIndex value, I used the following equation (55770-40326)(2) + [(55770-40326)/2](4) = 61776. When I put a print statement into the function, I recieved 61775 as the last targetIndex value. Why is one minused? And will y'all be so particular on the exam? #12

>> I could be completely wrong on this, but 61775 is the amount of samples. These samples start at 1, thus 61775 + 1 = 61776.

1) I know that each of the loops copy the word test consecutively into the new sound, but I do not know how the changes in the frequency of the sound are being made. Can someone explain this to me?
2) What do you mean by "is there anything left in the sound"? Can someone also explain where the numbers to find the target index are coming from?

1) Loop A transfers "test" into the target starting at targetIndex of 1.
Loop B transfers "test" into the target, immediately following the first "test," but at a doubled frequency.
Loop C moves a third "test" into the target, reversed and with a doubled frequency.
Loop D transfers a fourth "test" with a doubled frequency.
Loop E transfers a fifth "test" which is both reversed and doubled in frequency.
Loop F transfers a final "test" into the target in reversed fashion, right?
When I write "reversed" I mean to say that the original "test" is transfered with reversed properties. It sounds backwards.
In the final sound you'd hear a normal "test," then a mousy sounding faster "test," a mousy sounding backwards "test," a mousy sounding "Test," a mousy sounding backwards test, then a regular pace backwards "Test."
2) When loop F finished there are 2542 samples left. When the function ends, the targetIndex should equal 61971? I figure that is the next sample following the 6 versions of "test."

where does the number 2542 come from?

i added 15443+7771+7771+7771+7771+15443. i figured the length of each "test." the normal tests would be 15443 samples in length. the "tests" at double frequency would be 7771.5 but i figured JES would cut off the .5
I subtracted the total length of # samples from the 64512 total length of the original "this is a test"
THIS WAS MY BEST ATTEMPT. I WISH PROFESSOR GUZDIAL OR A T.A. WOULD POST IN RESPONSE TO MY ATTEMPT. PLEASE. PLEASE. PLEASE =)

PRETTY PRETTY PLEASE!

i think it is 7721, (15443/2) samples left

WHAT?

Why don't you just TRY it? Print out the targetIndex at the end, and print out getLength of the sound. Mark Guzdial

To see what the value of targetIndex is, just copy this program into JES and put in print statements after each loop. So after loop A, put print "targetindex after loop A is",targetIndex. If you do this, you will see that after the second loop (loop B), the value of targetIndex is 23166. If you get out your calculator, you will realize that the range (55770-40327)/2 = 35606.5, which is not an integer. If you add that number to what the targetIndex was after loop A, 15444 (which comes from [55770-40327] +1) you get 23165.5
There is an extra .5 added on here because range can only have integer values, not floating points. That's why the targetIndex at the end is 61775 and not 61772.

the number 61772 comes from (55770-40327) x 4 (since there were two loops with this full range and 4 loops with half the range which is equivalent to 2 full range loops). 2+2=4. Note from above, however, that each time through the 4 half loops, JES is adding .5, rounding up. 0.5 x 4 = 2 This means that you have to add 2 if you do this calculation, but you also have to add one more because targetIndex originally ='s 1, not 0. That's the discrepency of 3 between 61772 and 61775.



spliceweird.wav

Link to this Page