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.

24 lines
722B

  1. import("stdfaust.lib");
  2. import("rack.lib");
  3. vol = hslider("vol [knob:1]", 0.3, 0, 10, 0.01);
  4. pan = hslider("pan [knob:2]", 0.5, 0, 1, 0.01);
  5. attack = hslider("attack", 0.01, 0, 1, 0.001);
  6. decay = hslider("decay", 0.3, 0, 1, 0.001);
  7. sustain = hslider("sustain", 0.5, 0, 1, 0.01);
  8. release = hslider("release", 0.2, 0, 1, 0.001);
  9. panner(c) = _ <: *(1-c), *(c);
  10. voice(freq) = os.osc(freq) + 0.5*os.osc(2*freq) + 0.25*os.osc(3*freq);
  11. /*
  12. Additive synth: 3 sine oscillators with adsr envelop.
  13. Use the 3 first VC inputs to control pitch, gate and velocity.
  14. */
  15. process(pitch, gate, vel) = voice(freq) * en.adsr(attack, decay, sustain, release, gate) * vel : *(vol) : panner(pan)
  16. with {
  17. freq = cv_pitch2freq(pitch);
  18. };