Thursday, December 19, 2013

Double the Frequency

# Doubles the frequency of the sound
def doubleFrequency(source):
  len = getLength(source)/2 + 1
  target = makeEmptySound (len)
  targetIndex = 0
  for sourceIndex in range (0, getLength(source), 2):
    sourceValue = getSampleValueAt (source, sourceIndex)
    setSampleValueAt (target, targetIndex, sourceValue)
    targetIndex = targetIndex + 1
  return (target)

No comments:

Post a Comment