k y m a • t w e a k y — the kyma collective || view the current website || February 2015 Archive

/ WebHome / How.ConvertTuningToAConstant


How Section

How do I...
Add a question...


All Sections


Login / Register 
Change password
Forgot password?

Symbolic Sound

Kyma Forum
Eighth Nerve

TWiki Links

TWiki Formatting FAQ
What is TWiki?
%SESSION_ENDIF% twiki.org

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


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

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

© 2003-2014 by the contributing authors. / You are TWikiGuest