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

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 2 Review Spring 2004: Re-splicing the splice

Comments, answers, and questions go here:

(REMOVEDnk back to Sp2004 Midterm 2 Review)


ok, here's my attempt at this one. i ran it in jes and it took from 1,8000 to clear out the word test.. is that ok, or is there another way to do it?

def spliceTest():
  file = r"C:\Documents and Settings\sana yousufi\My Documents\JES Software\MediaSources\thisisatest.wav"
  source = makeSound(file)
  target = makeSound(file)  #new sound
  targetIndex = 40326
  for sourceIndex in range (1,7865):
    setSampleValueAt(target, targetIndex, getSampleValueAt(source, sourceIndex))
    targetIndex = targetIndex + 1
  for index in range (1,8000): # quiet space
     setSampleValueAt(target, targetIndex, 0)
     targetIndex = targetIndex + 1
  play(target)
  return target

Student1153



Where are these numbers coming from, Sana?Student1310

def spliceTest():
  file = r"C:\whatever this path is
  source = makeSound(file)
  target = makeSound(file)  
  targetIndex = 40327
  for sourceIndex in range (1,7865):
    setSampleValueAt(target, targetIndex, getSampleValueAt(source, sourceIndex))
    targetIndex = targetIndex + 1
  for targetIndex in range (40327+7865,getREMOVEDngth(file)+1): 
     setSampleValueAt(target, targetIndex, 0)
     targetIndex = targetIndex + 1
  play(target)
  return target


Lauren, check the table that's provided. Mark Guzdial


what about this?
def spliceTest():
  file = r"C:\JES\mediasources\thisisatest.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 targetIndex in range (48192,getREMOVEDngth(source)+1): 
     setSampleValueAt(target, targetIndex, 0)
     targetIndex = targetIndex + 1
  play(target)
  return target



of course with the spacing being correct...i'm not sure what happened

def spliceTest():
  file = getMediaPath("thisisatest.wav")
  source = makeSound(file)
  target = makeSound(file)  
  targetIndex=40326        
  for sourceIndex in range( 1,7865):  
    setSampleValueAt(target, targetIndex,  getSampleValueAt( source, sourceIndex))
    targetIndex = targetIndex + 1
  for index in range (7865+40326,55770):
     setSampleValueAt(target, targetIndex, 0)
     targetIndex = targetIndex + 1
  play(target)	        
  return target

this works, but is is the easiest way to do this?

In this class, I care REMOVED about it working and that you understand, than efficiency. Mark Guzdial




Link to this Page