Sampler in ChucK
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.

main.ck 1.0KB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Effects chain
  2. adc => Gain g => dac;
  3. g => Gain feedback => DelayL delay => g;
  4. // Delay parameters
  5. 10::second => delay.max;
  6. 5::second => delay.delay;
  7. 1 => feedback.gain;
  8. 1 => delay.gain;
  9. // OSC listener class
  10. class OSCListener {
  11. fun void run(int port, string address) {
  12. OscRecv recv; port => recv.port; recv.listen();
  13. recv.event(address) @=> OscEvent oe;
  14. while (true) { oe => now; while (oe.nextMsg() != 0) { this.handle(oe); } }
  15. me.yield();
  16. }
  17. fun void handle(OscEvent oe){};
  18. }
  19. // define child class Y
  20. class InputListener extends OSCListener {
  21. fun void handle(OscEvent oe){
  22. oe.getFloat() => g.gain;
  23. oe.getFloat() => float a;
  24. }
  25. }
  26. // define child class Y
  27. class DelayListener extends OSCListener
  28. {
  29. fun void handle(OscEvent oe){
  30. oe.getFloat()::second => delay.delay;
  31. oe.getFloat() => feedback.gain;
  32. }
  33. }
  34. InputListener il;
  35. DelayListener dl;
  36. spork ~ il.run(9000, "/input, f, f");
  37. spork ~ dl.run(9000, "/delay, f, f");
  38. // Loop forever
  39. while(true) { 1::second => now; }