If you use the shifting recipe (Program 119) with a factor of 2.0 or 3.0, youll get

Question:

If you use the shifting recipe (Program 119) with a factor of 2.0 or 3.0, you’ll get the sound repeated or even triplicated. Why? Can you fix it? Write shiftDur that takes a number of samples (or even seconds) to play the sound.


Data from Program 119

def shift(source, factor): target = makeEmptySound (getLength(source)) sourceIndex = 0 for targetIndex in range (0, getLength(target)): sourceValue = getSampleValueAt(source, int(sourceIndex)) setSampleValueAt (target, targetIndex, sourceValue) sourceIndex = sourceIndex + factor if (sourceIndex >= getLength(source)): sourceIndex = 0 play(target) return target

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: