You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4KB

  1. // Simplest possible script using all variables, demonstrating buffering
  2. // by Brian Heim
  3. ~i = 0;
  4. a = 0;
  5. // ~process = {|x| a = max(a, bench { 12.do { 256.do { |i| sin(i)} }; post(x); }); post(a) }
  6. ~vcv_bufferSize = 64;
  7. ~vcv_frameDivider = 1;
  8. ~text = "Hi! I am the first working proof of concept of the SuperCollider prototyper for VCV Rack!";
  9. ~textPos = 0;
  10. ~textWin = 22;
  11. ~counter = 1;
  12. ~text = String.fill(~textWin, $~) ++ ~text ++ String.fill(~textWin, $~);
  13. ~textLen = ~text.size - ~textWin;
  14. ~nSamp = 100;
  15. ~phases = ~nSamp.collect { |i| sin(i / ~nSamp * 2pi); };
  16. ~vcv_process = {|block|
  17. VcvPrototypeProcessBlock.numRows.do { |j|
  18. block.bufferSize.do { |i|
  19. block.outputs[j][i] = ~phases[~i] * block.knobs[j];
  20. ~i = ~i + block.knobs[j];
  21. ~i = ~i mod: ~nSamp;
  22. block.outputs[j][i] = block.inputs[j][i] * block.outputs[0][i];
  23. block.outputs[j][i] = block.outputs[j][i].squared;
  24. };
  25. };
  26. block.switchLights[3][0] = 1.0.rand();
  27. block.switchLights[3][1] = 1.0.rand();
  28. block.switchLights[3][2] = 1.0.rand();
  29. ~counter = ~counter + 1;
  30. if (~counter == 100) {
  31. (~text[~textPos..(~textPos+~textWin)]).post;
  32. ~textPos = ~textPos + 1;
  33. ~textPos = ~textPos mod: ~textLen;
  34. ~counter = 0;
  35. };
  36. block.knobs[4] = a / ~nSamp;
  37. a = a + 0.15;
  38. a = a mod: ~nSamp;
  39. block.lights[2][2] = a * ~i / 1000;
  40. block.switchLights[5][0] = block.switches[2].if { rand(3/4) } { 0 };
  41. block.outputs[0][3] = block.switches[1].if { rand(block.knobs[1]) } { block.outputs[0][3] };
  42. block
  43. }