# K2 scripts not following CC reassignments well



## Thonex (Jun 6, 2006)

I was going to write a simple CC Converter whereby if you are playing CC1 (Mod) and you would like it to be read as CC 11 (Expression)... it would convert it for you.

But I discovered that it's not working very well... as if the script can't keep up.

Try copying this to the K2 script editor:

```
on init
   message ("")
   declare $CCValue
   declare ui_value_edit $InputCC (0,127,1)
   declare ui_value_edit $OutputCC (0,127,1)
   
end on

on controller 
   
   set_controller ($OutputCC,%CC[$InputCC])
   message ("CC#: " & $OutputCC & "   Value: " &%CC[$OutputCC])
   
end on
```

Assign $InputCC the same value as your (for example) mod wheel = 1. Now assign $OutputCC a new value like expression = 11

move your Mod wheel (or fader) and look at how the numbers react.... not nearly as smoothly as a regular CC change and the values never reach their limits.... something's not right. You can see the CC# and Value in the message area.

Can you verify this?

Thanks

T


----------



## kotori (Jun 7, 2006)

Hi Andrew,
There seems to be nothing wrong here. The CC change is reasonable smooth and I can get to both 0 and 127 without any problem. I modified your test script slightly, please try this one:

```
on init
   message ("")
   declare $CCValue
   declare ui_value_edit $InputCC (0,127,1)
   declare ui_value_edit $OutputCC (0,127,1)
   declare ui_table %table[128](6,4,1)
   declare $i
   declare ui_button $clear
   $InputCC := 1
end on

on controller   
   set_controller ($OutputCC,%CC[$InputCC])
   message ("CC#: " & $OutputCC & "   Value: " &%CC[$OutputCC])
   %table[%CC[$OutputCC]] := 1
end on 

on ui_control($clear)
  $clear := 0
   $i := 0
   while ($i <= 127)
     %table[$i] := 0
     inc($i)
   end while
end on
```

Cheers,
Nils


----------



## Nickie Fønshauge (Jun 7, 2006)

Andrew,

I have done something like that without any problems, so it should work. But, it might be a good idea to include *ignore_controller* in the controller callback, in case the InputCC is going to be used for something different later on in the script chain.


----------



## Thonex (Jun 7, 2006)

Thanks Nils... and Nickie... welcome to the board and a very informative (and correct) first post  

Nils, I loaded your script into my K2.1.0 and found pretty much the same thing as before except with one more thing of concern.

First, let me explain that I'm using the Kenton Control Freak as my CC controller You can see it here: http://www.kentonuk.com/keybds_conts_midi-players/controllers_knob-slider/cf16s.html (http://www.kentonuk.com/keybds_conts_mi ... cf16s.html)

It's very accurate and it displays the CC value on an LCD screen as you transmit... also I have buttons assigned to emit the CC value of the slider's position. K2 is just not "staying" with the CC changes. It lags 1 or 2 behind and skips some (skipping is normal)... however, it should always read the last value received though.

Another thing... set your CC to 127 and then hit apply and then move the CC down a little.... see what happens.... on my K2 the first bar (value 0) lights up and so does (say) 125 or so. Why is K2 logging a CC value of 0?

So.... I just want to make sure that you guys have an accurate means of comparison. Try it in you sequencer and see if they match up.

I still think this is cause for concern.... unless I'm completely missing something.

[Edit] Let me just add that this applys to the script assigning CC values... K2 in-and-of-itself seems to respond to CC fine.

Cheers,

T


----------



## Nickie Fønshauge (Jun 7, 2006)

I have to give it to you Andrew. You are sharpminded - and right.

Try this: 
Slot 1: "6 MIDI controllers" with "Ctrl1" = 1

Slot 2: Modified version of Nils' script, showing InputCC

Slot 3: Modified version of Nils' script, showing OutputCC

Slot 4: Modified (larger) version of the "MIDI Monitor" script

When you move the knob from 0 to 127 or vice versa, you get different results in each of the monitoring scripts. Weird :!: :?:


----------



## Thonex (Jun 7, 2006)

Thanks for taking the time Nickie  

Just for the record, what version of K2 are you runing?

This gives me no confidence in re-assigning CCs to another CC.

Nils... do you find the same thing?


Cheers,


T


----------



## kotori (Jun 7, 2006)

This sounds really strange. I'm a bit short of time right now, but I'll check this out as soon as I can.

Cheers,
Nils


----------



## Thonex (Jun 7, 2006)

kotori @ Wed Jun 07 said:


> This sounds really strange. I'm a bit short of time right now, but I'll check this out as soon as I can.
> 
> Cheers,
> Nils



THanks Nils,

Bob mentioned you were swamped right now... thanks for helping out when you can.

Cheers,

T


----------



## Nickie Fønshauge (Jun 8, 2006)

I am running Kontakt 2.1.1 on a Windows PC.


----------

