kyma•tweaky . How . ConvertTuningToAConstant

Question (or Task)

Background to this question:

I created this Pluck sound for the Continuum that does a really cool thing. The user can dynamically mix between non-corrected and rounded pitch. I did this by using a crossfader in linear mode and using two constants as the fade choices. One constant is !KeyPitch / 127 nn and the other is !KeyPitch rounded / 127 nn. Inside the Harmonic resonator this Crossfader value is multiplied by 127 nn. Now I'd like to be able to substitute a Just Tuned scale as derived from the Design Alternate Tunings tool instead of the equal tempered choice of !KeyPitch rounded / 127 nn. I was then going to use an array to select from several alternate tunings or equal temperament.

My question is how do I convert what is generated in the Design Alternate Tunings into something that my Constant can use? In other words, how do I make it a 0 to 1 value?

-- EdmundEagan - 21 Sep 2004

Solution(s)

You should be able to use the Tuning Tool to produce an example that will place the tuning expression into the Frequency field of an Oscillator or Sample. Let's say the expression is 440 hz * (!KeyNumber * 17 / 12) twoExp. Copy the tuning expression and paste it into a Constant., and edit the Value field to get the following result:

| 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

-- KurtHebel - 22 Sep 2004

WebForm
Question: How do I convert a tuning table into a zero to 1 value?
Keywords: tuning constant

----- Revision r1.2 - 22 Sep 2004 - 15:02 GMT - CarlaScaletti
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.