Advertisement
Guest User

IanniX Script Editor Simple MIDI Example

a guest
Aug 14th, 2011
362
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None
  1. //Template for IanniX Script Engine
  2. function onConfigure() {
  3. //Name of the script
  4. iannix.meta("Grid");
  5. iannix.ask("General", "Number of lines", "indexMax", 16);
  6. }
  7.  
  8. function onCreate() {
  9. iannix.execute("clear");
  10. iannix.execute("center 4 0");
  11. iannix.execute("zoom 100");
  12.  
  13. for(var index = 0 ; index < indexMax ; index++)
  14. addCurve(index, index / indexMax);
  15.  
  16. //Control
  17. iannix.execute("add curve 1100");
  18. iannix.execute("setPos current " + (indexMax/5) + " 0 0");
  19. iannix.execute("setGroup current lines");
  20. iannix.execute("setPointsEllipse current " + (indexMax/5) + " " + (indexMax/5));
  21. iannix.execute("setColorActive2 current 0 255 200 255");
  22.  
  23. iannix.execute("add cursor 100");
  24. iannix.execute("setPattern current 0 0 1");
  25. iannix.execute("setGroup current cursors");
  26. iannix.execute("setCurve current lastCurve");
  27. iannix.execute("setWidth current 0.1");
  28. iannix.execute("setColorActive2 current 0 255 255 255");
  29. iannix.execute("setBoundsSource current 0 " + (indexMax/2.5) + " " + (indexMax/2) + " 0 0");
  30. iannix.execute("setBoundsTarget current 0 127 127 0");
  31. iannix.execute("setMessage current 100, midi://LoopBeInternalMIDI/cc 0 0 cursor_value_y");
  32.  
  33. iannix.execute("add trigger " + (2000 + index));
  34. iannix.execute("setGroup current triggers");
  35. iannix.execute("setPos current " + (index/2.5) + " 0 0");
  36. iannix.execute("setMessage current 1, midi://LoopBeInternalMIDI/note 1 42 trigger_value");
  37. iannix.execute("setSize current 0.8");
  38. iannix.execute("setColorActiveMessage2 current " + transfertMid(0, 40, 0, percent) + " 0 255 255");
  39. }
  40.  
  41. function addCurve(index, percent) {
  42. iannix.execute("add curve " + (1000 + index));
  43. iannix.execute("setPos current " + (index/5) + " 0 0");
  44. iannix.execute("setGroup current lines");
  45. iannix.execute("setPointsEllipse current " + (index/5) + " " + (index/5));
  46. iannix.execute("setColorActive2 current " + transfert(20, 40, percent) + " 255 255 255");
  47.  
  48. iannix.execute("add cursor " + index);
  49. iannix.execute("setPattern current 0 0 1");
  50. iannix.execute("setGroup current cursors");
  51. iannix.execute("setCurve current lastCurve");
  52. iannix.execute("setWidth current 0.1");
  53. iannix.execute("setColorActive2 current 90 255 255 255");
  54.  
  55. iannix.execute("add trigger " + (2000 + index));
  56. iannix.execute("setGroup current triggers");
  57. iannix.execute("setPos current " + (index/5) + " " + (index/5) + " 0 ");
  58. iannix.execute("setTriggerOff current 1");
  59. iannix.execute("setMessage current 1, midi://LoopBeInternalMIDI/note 0 " + (index*3+42) + " trigger_value");
  60. iannix.execute("setSize current 0.8");
  61. iannix.execute("setColorActiveMessage2 current " + transfertMid(0, 40, 0, percent) + " 0 255 255");
  62. }
  63.  
  64.  
  65. function transfert(hueStart, hueEnd, percent) {
  66. return (hueStart + (hueEnd - hueStart) * percent);
  67. }
  68. function transfertMid(hueStart, hueMid, hueEnd, percent) {
  69. if(percent < 0.5)
  70. return (hueStart + (hueMid - hueStart) * 2*percent);
  71. else
  72. return (hueMid + (hueEnd - hueMid) * (percent-0.5)*2);
  73. }
Advertisement
RAW Paste Data Copied
Advertisement