Consider changing the if block in the frequency shift method to sourceIndex = sourceIndex - s.getLength()

What's the difference from just setting the sourceIndex to 0? This change will also reset the sourceIndex for wrapping back to the front of the sound. Is this better or worse?

It is an extra operation so it would be a bit slower than just reseting to 0. But, it can give better results. Why? When the factor is greater than zero you will run out of source before you ¯ll up the target. You can wrap and take from the front again. But, depending on the length of the sound and the factor you may not want the very ¯rst value as the one to start with when you wrap. Assume you have a sound with just 11 values and you use a factor of 2. If you reset to 0 you will get values at indicies: 0, 2, 4, 6, 8, 10, 0, 2, 4, 6, and 8. If you use sourceIndex = sourceIndex - s.getLength() you will get indicies: 0, 2, 4, 6,
8, 10, 1, 3, 5, 7, and 9.

Computer Science & Information Technology

You might also like to view...

A firewall designed specifically for home networks is called a ________ firewall

A) home B) personal C) logical D) static

Computer Science & Information Technology

COGNITIVE ASSESSMENT You have just designed a device-tracking app for sale in the app marketplace. Which of the following are you least likely to use in your app?

A. GPS B. Wi-Fi C. UNIX D. IP addresses

Computer Science & Information Technology