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.

17 lines
463B

  1. // Voltage-controlled oscillator example
  2. import("stdfaust.lib");
  3. // Create a phasor with a given frequency
  4. phasor(freq) = freq/ma.SR : (+ : decimal) ~ _ with { decimal(x) = x-int(x); };
  5. // Pitch to freq conversion (also included in the rack.lib library)
  6. cv_pitch2freq(cv_pitch) = 440 * 2 ^ (cv_pitch - 0.75);
  7. gain = hslider("gain [knob:1]", 0.1, 0, 1, 0.01) * 10 - 5;
  8. pitch(x) = x + gain;
  9. process(x) = sin(2 * ma.PI * phasor(cv_pitch2freq(pitch(x)))) * 5;