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

Code for function makeSentence()

def makeSentence():

  file = 'howdoin.wav'
  source = makeSound(file)
  target = makeSound(file)

  #clear the target sound
  for index in range(1, getLength(target)+1):
    setSampleValueAt(target, index, 0)

  #start increment of target index
  target_index = 1

  #copy 'So'
  for index in range(1394,5617+1):
    value = getSampleValueAt(source, index)
    setSampleValueAt(target, target_index, value)
    target_index = target_index + 1

  #make a 1/4 second space
  for index in range (1, int(getSamplingRate(source)/4)+1):
    setSampleValueAt(target, target_index, 0)
    target_index = target_index + 1

  #copy 'how'
  for index in range(15580,17917+1):
    value = getSampleValueAt(source, index)
    setSampleValueAt(target, target_index, value)
    target_index = target_index + 1

  #make a 1/4 second space
  for index in range (1, int(getSamplingRate(source)/4)+1):
    setSampleValueAt(target, target_index, 0)
    target_index = target_index + 1

  #copy 'you'
  for index in range(17917,20418+1):
    value = getSampleValueAt(source, index)
    setSampleValueAt(target, target_index, value)
    target_index = target_index + 1

  #make a 1/4 second space
  for index in range (1, int(getSamplingRate(source)/4)+1):
    setSampleValueAt(target, target_index, 0)
    target_index = target_index + 1

  #copy 'doin'
  for index in range(20541,24354+1):
    value = getSampleValueAt(source, index)
    setSampleValueAt(target, target_index, value)
    target_index = target_index + 1

  openSoundTool(source)
  openSoundTool(target)


Link to this Page