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...

Accidentally changing the data type of a primary key in a table could jeopardize the reliability of the data.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A security ____________________ is an outline of the overall information security strategy and a roadmap for planned changes to the organization's information security environment.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

If the destination file is closed when you make a change in the ____ file, you can choose whether to update the link to display the current values when you open the destination file.

A. target B. origin C. source D. key

Computer Science & Information Technology

? In the figure above, the curve of the motion path is a result of dragging the two Bezier handles. 

Answer the following statement true (T) or false (F)

Computer Science & Information Technology