Create a new version of the shift function that creates the target to be as big as the resulting sound should be. So if the factor is less than one it would create a larger sound and if greater than one a smaller sound.
What will be an ideal response?
```
def shift(source,factor):
len = 0
if factor>1:
len = int(getLength(source)/factor)
elif factor>0 and factor<1:
len = int(getLength(source)/factor + 1)
target = makeEmptySound(len)
sourceIndex = 0
for targetIndex in range(0, len):
sourceValue = getSampleValueAt(source,int(sourceIndex))
setSampleValueAt(target , targetIndex , sourceValue)
sourceIndex = sourceIndex + factor
if (sourceIndex >= getLength(source)):
sourceIndex = 0
play(target)
return target
```
You might also like to view...
One generic Stack class could be the basis for creating many Stack classes, e.g., Stack
a. subclasses. b. generic subclasses. c. concrete classes. d. parameterized classes.
Using the ____ procedure will cause the application to pause a specific amount of time.
A. Stop B. Pause C. Wait D. Sleep
________ means responding to risk by not taking a risky action.
A. Risk reduction B. Risk transference C. Risk acceptance D. Risk avoidance
A writing style established by the Modern Language Association with rules and conventions for preparing research papers (used primarily in the area of humanities).
What will be an ideal response?