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.

66 lines
1.1KB

  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. // Create our OSC receiver
  10. OscRecv recv;
  11. 9000 => recv.port;
  12. recv.listen();
  13. recv.event( "/test, f" ) @=> OscEvent oe;
  14. // Event loop
  15. while (true) {
  16. // Wait for event to arrive
  17. oe => now;
  18. // Grab the next message from the queue.
  19. while ( oe.nextMsg() != 0 ) {
  20. float val;
  21. <<<val>>>;
  22. oe.getFloat() => val;
  23. val::second => delay.delay;
  24. }
  25. }
  26. /*
  27. // Listen for messages regarding ADC input
  28. fun void oscListener( int port, string osctype ) {
  29. // create our OSC receiver
  30. OscRecv recv;
  31. port => recv.port;
  32. recv.listen();
  33. int val;
  34. string type;
  35. // create an address in the receiver, store in new variable
  36. recv.event( osctype ) @=> OscEvent oe;
  37. while( true ) {
  38. // wait for osc event to arrive
  39. oe => now;
  40. while( oe.nextMsg() ) {
  41. oe.getInt() => val;
  42. osctype => type;
  43. if( type == leftraw ) {
  44. val => raw.freq;
  45. }
  46. else if( type == leftavg ) {
  47. val => avg.freq;
  48. }
  49. me.yield();
  50. }
  51. }
  52. }
  53. */