Consider changing the if block in the frequency shift recipe (Program 119 (page 264)) to sourceIndex =

Question:

Consider changing the if block in the frequency shift recipe (Program 119 (page 264)) to sourceIndex = sourceIndex - getLength(source). What’s the difference from just setting the sourceIndex to 0? Is this better or worse? Why?


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: