Kyma Forum
  Kyma Support
  arays of arrays in InputOutputCharacteristic

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   arays of arrays in InputOutputCharacteristic
HectorBenard
Member
posted 16 April 2006 14:05         Edit/Delete Message   Reply w/Quote
In the OutValues field of an InputOutputCharacteristic I would like to be able to have several arrays with different tunings such as the following:

{(1 to: 14) collect: [ :i | (((i * 1/8) + (!Offset - 24)) / 12.0) twoExp - 1]} " 16ths of a tone"


{#(0 0 2 4 4 4 5 7 7 7 9 11 12 12) collect: [ :i | (((i ) + (!Offset - 24)) / 12.0) twoExp - 1]} "Major, biased Tonic"

{#(0 2 4 5 5 5 7 9 9 9 11 12 13 13) collect: [ :i | (((i ) + (!Offset - 24)) / 12.0) twoExp - 1]}" "Major, biased subdominant"


Is it possible to select form this arrays in real time by having an array of arrays? Something like:

{!Mode of: #( {first array above}
{second array}
{third array})}


Any ideas on how I can make this work? Thanks in advance.

[This message has been edited by HectorBenard (edited 19 April 2006).]

IP: Logged

SSC
Administrator
posted 16 April 2006 16:31         Edit/Delete Message   Reply w/Quote
You can do it, but you have to turn the arrays around: create one array of 14 where each element selects one of the three possibilities.

Here is one possible solution (not tested in Kyma, so there may be small syntax errors):

{| a1 a2 a3 |

a1 := (1 to: 14) collect: [ :i | (((i * 1/8) + (!Offset - 24)) / 12.0) twoExp - 1]. "16ths of a tone"

a2 := #(0 0 2 4 4 4 5 7 7 7 9 11 12 12) collect: [ :i | ((i + (!Offset - 24)) / 12.0) twoExp - 1]}. "Major, biased Tonic"

a3 := #(0 2 4 5 5 5 7 9 9 9 11 12 13 13) collect: [ :i | ((i + (!Offset - 24)) / 12.0) twoExp - 1]. "Major, biased subdominant"

(1 to: a1 size) collect: [ :i | !Mode of: (Array with: (a1 at: i) with: (a2 at: i) with: (a3 at: i))]}


First, three arrays are created with the values you want. Then a fourth array is created whose elements each select one of the corresponding elements of the three arrays.

IP: Logged

HectorBenard
Member
posted 17 April 2006 08:07         Edit/Delete Message   Reply w/Quote
Thanks! I thought it might require something like that. I understand what the idea is, but It still doesn't work, and I can't figure out why...

Oh wait, I just found it! Just an extra curly bracket in the second line. Works like a charm now!

Thanks so much, this is great! I'll upload the final patch in the twiki eventually.

H

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c