Matching list item change with knob CC value change
Posted: 07 Oct 2017 12:43
I have knob that send CC 0-103 that select waveform on my DSI Tetra synth. Beside the knob I have a text object that display list items to show corresponding waveform. But I'm having a hard time matching them up precisely.
The knob label is set to value= x*103.
The list items:
I've tried some different ways and can't figure out what I am doing wrong:
and a few variations more. I couldn't get any of them matching precisely.
What am I doing wrong? A bug in my script? Is the math off? Am I going about this the wrong way?
The knob label is set to value= x*103.
The list items:
Code: Select all
modsrc={'Off','Saw','Tri','Saw-Tri','Pulse 0','Pulse 1','Pulse 2','Pulse 3','Pulse 4','Pulse 5','Pulse 6','Pulse 7','Pulse 8','Pulse 9','Pulse 10','Pulse 11','Pulse 12','Pulse 13','Pulse 14','Pulse 15','Pulse 16','Pulse 17','Pulse 18','Pulse 19','Pulse 20','Pulse 21','Pulse 22','Pulse 23','Pulse 24','Pulse 25','Pulse 26','Pulse 27','Pulse 28','Pulse 29','Pulse 30','Pulse 31','Pulse 32','Pulse 33','Pulse 34','Pulse 35','Pulse 36','Pulse 37','Pulse 38','Pulse 39','Pulse 40','Pulse 41','Pulse 42','Pulse 43','Pulse 44','Pulse 45','Pulse 46','Pulse 47','Pulse 48','Pulse 49','Pulse 50','Pulse 51','Pulse 52','Pulse 53','Pulse 54','Pulse 55','Pulse 56','Pulse 57','Pulse 58','Pulse 59','Pulse 60','Pulse 61','Pulse 62','Pulse 63','Pulse 64','Pulse 65','Pulse 66','Pulse 67','Pulse 68','Pulse 69','Pulse 70','Pulse 71','Pulse 72','Pulse 73','Pulse 74','Pulse 75','Pulse 76','Pulse 77','Pulse 78','Pulse 79','Pulse 80','Pulse 81','Pulse 82','Pulse 83','Pulse 84','Pulse 85','Pulse 86','Pulse 87','Pulse 88','Pulse 89','Pulse 90','Pulse 91','Pulse 92','Pulse 93','Pulse 94','Pulse 95','Pulse 96','Pulse 97','Pulse 98','Pulse 99'};
Code: Select all
setattribute(txtStatModSrc2,'content',textShape2_26.modsrc[x*103]);
setattribute(txtStatModSrc2,'content',textShape2_26.modsrc[round(x*103)]);
setattribute(txtStatModSrc2,'content',textShape2_26.modsrc[floor(x*103.999999999999999999999999)]);
setattribute(txtStatModSrc2,'content',textShape2_26.modsrc[ceil(x*103)]);
setattribute(txtStatModSrc2,'content',textShape2_26.modsrc[range(x,0,103)]);
What am I doing wrong? A bug in my script? Is the math off? Am I going about this the wrong way?