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?

What will be an ideal response?


This is a very minimal difference. As it was previously, if the sourceIndex grew too large it would be returned to 0, essentially the sound would start over again from the beginning. With this way sourceIndex is instead set the amount over source’s length it currently is. For example, if you had a sound of length 3001 and you were increasing by a factor of 3, sourceIndex would be set to 3003 because of the line “sourceIndex =
sourceIndex+factor” and then end up at index 2 (3003-3001) instead of index 0.

One could argue either way in terms of this approaching being better or worse. You could suggest that it is better as the indexes all are a consistent “distance” apart. So in the last example, going from the last index we recorded (3000) to 2, a value of distance three if you loop around. However, one could also see this as a negative as it avoids the 0 value, and would lead to slightly different iterations of the sound each time as you don’t start at the same place.

Computer Science & Information Technology

You might also like to view...

Write an HTML page that has a button in it. When you click on the button use JavaScript to change some text that tells you the number of times the button was clicked on.

What will be an ideal response?

Computer Science & Information Technology

The first part of an email message generated by the email provider is the email ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following is not one of the ways to sign on a signature line?

A) Type a signature. B) Run the pre-defined Signature macro. C) Select a digital image of a signature. D) Write a signature.

Computer Science & Information Technology

Which of the following grants users and systems a predetermined level of access?

A. Accountability B. Authentication C. Authorization D. Assurance

Computer Science & Information Technology