First time here? Check out the FAQ!
x

MPE Pitch Bend in Alternate Tunings

0 votes
294 views
Hi all,

I'm trying to use MPE pitch bendwith alternate tunings.

The Way I understand alternate tunings work in Kyma is thet they are an array with selectable frquencies or ratios.

I'm using a Striso board where the x-axis tilt of any key results in pitch bend for that key. This works really well when nn is used to control the frequency of a Sound but if the nn selects an entry in an array then the slightest move to the left selects the ratio immediately below (I guess this is because the selection is taken discarding any decimal in the nn and thus the slightest bend to the left goes immediately to the preceding number).

I'm making the tunings playable by using the "rounded" command but the pitch bend is (predictably) not working.

For example I'm using the "KBD-8 Just tonic=C" Sound.

I can extract the decimal part of a nn by subtracting (!NoteNumber rounded) from it.

 (!KeyNumber - (!KeyNumber rounded))

but I'm a bit at a loss about what can I do with that decimal to use it to bend the notes..

Thanks
asked Mar 31, 2023 in Using Kyma by georgina (Practitioner) (860 points)

1 Answer

0 votes
 
Best answer

You can use the pitch directly, without the need to calculate the note number fraction, by using into: (interpolating table lookup) instead of of: (indexing a discrete value from an array) in the pitch expression.

The original expression was:

(!KeyNumber - 60 // 12) twoExp * ((!KeyNumber - 60 mod: 12) of: #( 1 {(135 / 128)} {(9 / 8)} {(75 / 64)} {(5 / 4)} {(4 / 3)} {(45 / 32)} {(3 / 2)} {(25 / 16)} {(5 / 3)} {(225 / 128)} {(15 / 8)} )) * 261.626 hz

The middle part of this expression (!KeyNumber - 60 mod: 12) determines the scale step within the octave and uses the scale step as an index into an array of ratios.

To use the interpolating table lookup instead, create an Array containing each scale step and ratio as a Point of the form: {scaleStep @ ratio}.

For example, the above expression could be rewritten as:

(!KeyNumber - 60 // 12) twoExp
    * ((!KeyNumber - 60 mod: 12) into: #(
        {0 @ 1}         {1 @ (135 / 128)}  {2 @ (9 / 8)}

        {3 @ (75 / 64)} {4 @ (5 / 4)}      {5 @ (4 / 3)}

        {6 @ (45 / 32)} {7 @ (3 / 2)}      {8 @ (25 / 16)}

        {9 @ (5 / 3)}   {10 @ (225 / 128)} {11 @ (15 / 8)}

        {12 @ 2} ))
    * 261.626 hz}

In this example, if the scale step were 4.5, the looked-up ratio would be half-way between 5/4 and 4/3.

You can find more information and see examples of into: in the Capytalk help within Kyma.

We added a new example to the Kyma Sound Library to illustrate this: Kyma Sound Library/Feature extration/Tuning*.kym

 

 

answered Apr 2, 2023 by ssc (Savant) (127,540 points)
selected Jun 18, 2023 by georgina
Brilliant! Thanks!
I may be mistaken but I seem to notice that the "into:" version looks into an array where the positions are in the range (0, sizeOfArray) and it looks like when using of: the positions are (0, (sizeOfArray-1))
i.e.when using into: is it necessary to use the octave (2/1)  as the last point and using of: the last point (step)  is the one before the octave.
Am I correct?
"of:" creates a table of values so that you can lookup the interval at any integer index. "(!KeyNumber - 60 mod: 12)" will give you a value between 0 and just-up-to-12 and "of:" truncates the value, so the index will be integers between 0 and 11, inclusive.

"into:" creates a "connect the dots" linear function so that you can obtain the value of any continuous index into the linear function. The 12th point is needed in the case when you are accessing intervals that fall between the 11th and 12th half-steps.
that makes perfect sense, thank you!
...