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.

49 lines
1.0KB

  1. public class SampleChan
  2. {
  3. // Chain
  4. LiSa sample => LPF filter;
  5. // Setup
  6. UGen @ mySource;
  7. 10::second => sample.duration; //This is the max duration
  8. 0::second => sample.recPos => sample.playPos;
  9. 1.0 => sample.feedback;
  10. 1 => sample.loop;
  11. setLoopPoint(1::second);
  12. filter.set(10000, 1);
  13. public void setLoopPoint( dur length ) {
  14. length => sample.loopEnd => sample.loopEndRec;
  15. }
  16. public void outputTo(UGen ugen) {
  17. 1 => sample.play;
  18. filter => ugen;
  19. }
  20. public void recordFrom(UGen ugen) {
  21. 1 => sample.record;
  22. ugen => sample;
  23. ugen @=> mySource;
  24. }
  25. public void stopRecording() {
  26. 0 => sample.record;
  27. mySource =< sample;
  28. }
  29. }
  30. // Effects chain
  31. Gain mixer => dac; // Main mixer
  32. //adc => Gain adcThru => mixer; // Monitor the input
  33. SampleChan sample; // Sampler
  34. sample.outputTo(mixer);
  35. sample.recordFrom(adc);
  36. 2::second => now;
  37. sample.stopRecording();
  38. 5::second=>now;
  39. /*while(true) { 1::second => now; }*/