Pitch Scaling

You can normalize the raw algorithm output values through the process of scaling. This will map output values into a pitch range you choose. You specify the lowest pitch value, pmin, and the highest pitch value, pmax, in the text boxes of "Use values from __ to __." All output values will be scaled into values in this range. pmin must be at least 0, and pmax must be at most 88 and greater than or equal to pmin. A default range of 0 to 88 is provided. You must also decide how the values will scaled: using the division operation or the modulo operation.

The division operation scales the output values proportionally throughout the range you provide. The highest number in the list of output values, omax, will be scaled to the highest pitch value you chose, pmax. Likewise, the lowest number in the list of output values, omin, will be scaled to the lowest pitch value you chose, pmin. As an example, if the algorithm's output values are (1, 0, 2, 3) and you use the default pitch range of 0 to 88, the division operation will yield the pitch values (29, 0, 59, 88). Note that decimals are truncated in the process to produce integer results. The assignment of a pitch value, p, given an output value, o, is described by the formula

      p = pmin + (pmax - pmin)(o - omin) / (omax - omin)

For example, if the output values are (64, 81, 100, 121, 144) and the pitch values range from 28 to 52, then the pitch value corresponding to 100 would be p = 28 + (52 - 28)(100 - 64) / (144 - 64) = 38.8 ~ 38 (truncated). The entire list of pitch values would be (28, 33, 38, 45, 52).

The modulo operation scales the output values into a cyclical pattern throughout the range you provide. In general, a modulo b is the integer remainder resulting when a is divided by b. A pitch value is computed using the formula

      p = pmin + o % (pmax - pmin + 1)

Here, % indicates the modulo operation. As an example, consider the output values of (64, 81, 100, 121, 144) again. If the pitch range is 0 to 88, the pitch value corresponding to 100 would be p = 0 + 100 % (88 - 0 + 1) = 0 + 100 % 89 = 11, and the entire list of pitch values would be (64, 81, 11, 32, 55). Using a pitch range of 28 to 52 instead would produce a pitch value p = 28 + 100 % (52 - 28 + 1) = 28 + 100 % 25 = 28 for the output value 100, and the entire list of pitch values would be (42, 34, 28, 49, 47).

To derive the pitch values once you've made your choices, simply click the Scale values button. If the derived pitch values box was previously empty, the scaling will be performed on the algorithm output values. Otherwise, it will be performed on the existing pitch values. This allows you to apply several successive scalings on scaled values if you wish, choosing a new range and operation with each scaling. If you make a mistake or would just rather apply scaling to the original algorithm output only, click the Start over button, which will clear the derived pitch values box.