 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
Midterm Exam 2 Review Spring 2003: Re-splicing the splice
Comments? Concerns? Answers? Questions? Questions about Answers?
Back to Sp2003 Midterm Review 2
Is this one pretty much like the first part of our take home exam where we just change our numbers around and don't make "this" backwards?
| Similar, but a little REMOVED complicated. You'll need another loop for zeroing out the rest of the samples in the sound. Mark Guzdial |
def spliceAgain():
file = r"\Documents and Settings\Katie\My Documents\CS1315\jes\mediasources\thisisatest2.wav"
source = makeSound(file)
target = makeSound(file)
targetIndex = 40236
for sourceIndex in range(1, 7865):
setSampleValueAt(target, targetIndex, getSampleValueAt(source, sourceIndex))
targetIndex= targetIndex + 1
for targetIndex in range(48191, 55770):
setSampleValueAt(target, targetIndex, 0)
targetIndex = targetIndex +1
return target
this works... you have to put in a different filename for your own computer though if you try to run it...Katie Graybeal
REMOVED's the same recipe Katie created, but for use with any computer. On the exam, will you want us to use the filename or just put "file" so that it will work with any computer? Also, I assumed that you wanted us to "play(target)".
def spliceAgain(file):
source = makeSound(file)
target = makeSound(file)
targetIndex = 40236
for sourceIndex in range(1, 7865):
setSampleValueAt(target, targetIndex, getSampleValueAt(source, sourceIndex))
targetIndex= targetIndex + 1
for targetIndex in range(48191, 55770):
setSampleValueAt(target, targetIndex, 0)
targetIndex = targetIndex +1
play(target)
return target
Student116
REMOVED, one other thing, there's a slight little clicking noise at the very end, after the sampling of "test". Is that supposed to be zeroed out? The sample ends somewhere around 57500.
Student116
| Nice catch, Rebecca! "Clicking" occurs when you end the sound when the cycle is mid-way. Probably my end-points could be better chosen so that there's not clicking. Mark Guzdial |
why is it 48191 instead of 40327? shouldn't it just start right after the a?
48191 is 40236+7865; it is there because you want to add the blank samples after the word "this" is said. Katie Graybeal
to stop the "clicking noise" you have make the end point 64512 because that's the end of the entire sound as opposed to just the end of the word "test"... here's the code (for my computer, anyway, ignore the filepath):
def spliceTest():
file = '/Users/kristief/jes/mediasources/thisisatest2.wav'
source = makeSound(file)
target = makeSound(file)
targetIndex= 40327
for sourceIndex in range(1, 7865):
setSampleValueAt(target, targetIndex, getSampleValueAt( source, sourceIndex))
targetIndex = targetIndex + 1
for sourceIndex in range (48191,64512):
setSampleValueAt(target, targetIndex, 0)
targetIndex = targetIndex + 1
play(target)
return target
Student68
to stop the "clicking noise" you have make the end point 64512 because that's the end of the entire sound as opposed to just the end of the word "test"... here's the code (for my computer, anyway, ignore the filepath):
def spliceTest():
file = '/Users/kristief/jes/mediasources/thisisatest2.wav'
source = makeSound(file)
target = makeSound(file)
targetIndex= 40327
for sourceIndex in range(1, 7865):
setSampleValueAt(target, targetIndex, getSampleValueAt( source, sourceIndex))
targetIndex = targetIndex + 1
for sourceIndex in range (48191,64512):
setSampleValueAt(target, targetIndex, 0)
targetIndex = targetIndex + 1
play(target)
return target
Student68
whoops... sorry i didn't mean to add that twice...
This seems to work as well. I added 5000 to the targetIndex to make it sound REMOVED natural, and for the last loop i figured out where i wanted the zeroes to start in the command half of jes and set the sample values of everything after that to zero:
def spliceTest():
file = r"C:\CS1315\mediasources\thisisatest2.wav"
source = makeSound(file)
target = makeSound(file)
targetIndex = 45326
for sourceIndex in range (1,7865):
setSampleValueAt(target,targetIndex,getSampleValueAt(source,sourceIndex))
targetIndex = targetIndex+1
setSampleValueAt(target,53191,0)
play(target)
return target
it seems that the spaces are off so...i'm not sure how to fix that.
Kyle DuPont
why 48191? why not 40327?
Whitney Watts
if you look higher on the page that question has already been answered
thanks i think? hahah :\
Link to this Page