Search
How Section
All Sections
Symbolic Sound
TWiki Links
440 hz * (!KeyNumber * 17 / 12) twoExp
| lowKey hiKey fractKey roundKey fraction lowPitch highPitch | "Obtain the two key numbers that bracket the true key pitch." lowKey := !KeyPitch truncated removeUnits. hiKey := lowKey + 1. "Determine how far between the two key numbers the true key pitch is." fractKey := !KeyPitch removeUnits - lowKey. "Determine which way to go if we were to round the key pitch." roundKey := fractKey rounded. "The amount between the keys we want, due to the amount of rounding requested." fraction := !Round * roundKey + ((1 - !Round) * fractKey). "Determine the pitch that should be played for the two key numbers." lowPitch = (440 hz * (lowKey * 17 / 12) twoExp) nn removeUnits. hiPitch = (440 hz * (hiKey * 17 / 12) twoExp) nn removeUnits. "Compute the pitch that lies at the desired fraction between the two key numbers." fraction * hiPitch + ((1 - fraction) * loPitch) / 127